diff options
author | James Thomas <james.thomas@codethink.co.uk> | 2016-01-13 15:52:12 +0000 |
---|---|---|
committer | Baserock Gerrit <gerrit@baserock.org> | 2016-02-25 17:41:30 +0000 |
commit | e93dd2b3531fff213a76063b3855ac6b8f773b61 (patch) | |
tree | 3abdc5cbbcd41511f6b58fe2639fba1b089d9753 /extensions/writeexts.py | |
parent | fd393b16341e467d07cde0259c335aadc5c4caea (diff) | |
download | definitions-e93dd2b3531fff213a76063b3855ac6b8f773b61.tar.gz |
Split btrfs filesystem functions in layout and rootfs creation
This will allow us to mirror the baserock btrfs layout on a non btrfs
partition
Change-Id: If5dbba133a187eeb26eae671da7dd71495127c8e
Diffstat (limited to 'extensions/writeexts.py')
-rw-r--r-- | extensions/writeexts.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/extensions/writeexts.py b/extensions/writeexts.py index 93f67433..a135eadb 100644 --- a/extensions/writeexts.py +++ b/extensions/writeexts.py @@ -303,6 +303,8 @@ class WriteExtension(Extension): with self.mount(raw_disk) as mp: try: self.create_btrfs_system_layout( + mp, version_label='factory') + self.create_btrfs_system_rootfs( temp_root, mp, version_label='factory', rootfs_uuid=self.get_uuid(raw_disk)) if self.bootloader_config_is_wanted(): @@ -434,9 +436,8 @@ class WriteExtension(Extension): subprocess.check_call(['umount', mount_point]) os.rmdir(mount_point) - def create_btrfs_system_layout(self, temp_root, mountpoint, version_label, - rootfs_uuid, device=None): - '''Separate base OS versions from state using subvolumes. + def create_btrfs_system_layout(self, mountpoint, version_label): + '''Create the btrfs folder layout required for baserock ''' version_root = os.path.join(mountpoint, 'systems', version_label) @@ -445,10 +446,12 @@ class WriteExtension(Extension): os.symlink( version_label, os.path.join(mountpoint, 'systems', 'default')) - # Only do the next step if the device is actually btrfs - if device and device.filesystem is not 'btrfs': - return + def create_btrfs_system_rootfs(self, temp_root, mountpoint, version_label, + rootfs_uuid, device=None): + '''Separate base OS versions from state using subvolumes. + ''' + version_root = os.path.join(mountpoint, 'systems', version_label) state_root = os.path.join(mountpoint, 'state') os.makedirs(state_root) @@ -946,8 +949,10 @@ class WriteExtension(Extension): # Install root filesystem rfs_uuid = self.get_uuid(location, part.extent.start * dev.sector_size) - self.create_btrfs_system_layout(temp_root, part_mount_dir, - 'factory', rfs_uuid, dev) + self.create_btrfs_system_layout(part_mount_dir, 'factory') + self.create_btrfs_system_rootfs(temp_root, part_mount_dir, + 'factory', rfs_uuid, dev) + if self.bootloader_config_is_wanted(): self.create_bootloader_config(temp_root, part_mount_dir, 'factory', rfs_uuid, dev) |