~raharper/curtin/trunk.vmtest_add_huge_disk_tests

« back to all changes in this revision

Viewing changes to curtin/commands/install.py

  • Committer: Scott Moser
  • Date: 2017-04-12 01:38:04 UTC
  • mfrom: (483.2.1 trunk.umount_r)
  • Revision ID: smoser@ubuntu.com-20170412013804-5oarnqx8wnu1qq49
add recursive flag to do_umount, add --umount to block-meta

This adds a 'recursive' argument to util.do_umount, and utilizes
it from install.py. The basic idea of do_umount with recursive
is to walk through /proc/mounts in reverse and unmount anything
mounted under the provided mountpoint (or the mountpoint itself).

Also added here is use of that function from block-meta command.
We add a flag --umount to unmount filesystems at its end.


Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
import sys
26
26
import tempfile
27
27
 
28
 
from curtin import block
29
28
from curtin.block import iscsi
30
29
from curtin import config
31
30
from curtin import util
451
450
                                      '/root/curtin-install.log')
452
451
        if log_target_path:
453
452
            copy_install_log(logfile, workingd.target, log_target_path)
454
 
        for d in ('sys', 'dev', 'proc'):
455
 
            util.do_umount(os.path.join(workingd.target, d))
456
453
        # need to do some processing on iscsi disks to disconnect?
457
454
        iscsi.disconnect_target_disks(workingd.target)
458
 
        mounted = block.get_mountpoints()
459
 
        mounted.sort(key=lambda x: -1 * x.count("/"))
460
 
        for d in filter(lambda x: workingd.target in x, mounted):
461
 
            util.do_umount(d)
462
 
        util.do_umount(workingd.target)
 
455
        util.do_umount(workingd.target, recursive=True)
463
456
        shutil.rmtree(workingd.top)
464
457
 
465
458
    apply_power_state(cfg.get('power_state'))