diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2014-06-06 13:28:08 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2014-06-06 13:28:08 +0000 |
commit | e0d7338382ce69156de0514525ab3935971fcf85 (patch) | |
tree | a6a38ee02fb315ef9882661806d61421438e3edb | |
parent | 3d1b3d83b9e7782b856cd3dfc3f32948a8e8d268 (diff) | |
parent | 6daa22a652a622dfafc967b38cb7d123457bb23c (diff) | |
download | morph-e0d7338382ce69156de0514525ab3935971fcf85.tar.gz |
Merge branch 'baserock/richardmaw/S11226/writeext-fstab'
Reviewed-by: Pedro Alvarez
Reviewed-by: Sam Thursfield
-rw-r--r-- | morphlib/writeexts.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/morphlib/writeexts.py b/morphlib/writeexts.py index 334dc15c..d6f23e0d 100644 --- a/morphlib/writeexts.py +++ b/morphlib/writeexts.py @@ -221,7 +221,7 @@ class WriteExtension(cliapp.Application): os.rmdir(mount_point) def create_btrfs_system_layout(self, temp_root, mountpoint, version_label, - disk_uuid=None): + disk_uuid): '''Separate base OS versions from state using subvolumes. ''' @@ -235,7 +235,8 @@ class WriteExtension(cliapp.Application): self.create_orig(version_root, temp_root) system_dir = os.path.join(version_root, 'orig') - state_dirs = self.complete_fstab_for_btrfs_layout(system_dir) + state_dirs = self.complete_fstab_for_btrfs_layout(system_dir, + disk_uuid) for state_dir in state_dirs: self.create_state_subvolume(system_dir, mountpoint, state_dir) @@ -298,7 +299,7 @@ class WriteExtension(cliapp.Application): filepath = os.path.join(existing_state_dir, filename) cliapp.runcmd(['mv', filepath, subvolume]) - def complete_fstab_for_btrfs_layout(self, system_dir): + def complete_fstab_for_btrfs_layout(self, system_dir, rootfs_uuid=None): '''Fill in /etc/fstab entries for the default Btrfs disk layout. In the future we should move this code out of the write extension and @@ -322,8 +323,9 @@ class WriteExtension(cliapp.Application): if '/' in existing_mounts: root_device = existing_mounts['/'] else: - root_device = '/dev/sda' - fstab.add_line('/dev/sda / btrfs defaults,rw,noatime 0 1') + root_device = ('/dev/sda' if rootfs_uuid is None else + 'UUID=%s' % rootfs_uuid) + fstab.add_line('%s / btrfs defaults,rw,noatime 0 1' % root_device) state_dirs_to_create = set() for state_dir in shared_state_dirs: |