From a124d8217333e943838bba41105e9d1b1255eb3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20Sch=C3=A4fer?= Date: Tue, 20 Oct 2020 20:51:05 +0200 Subject: [PATCH] Allow custom root volume name setup In addition to the custom size of the root volume it's now also possible to setup the name of the root volume as follows: If no name for the root volume is specified the default name: LVRoot applies as before. This Fixes #1530 --- .../working_with_images/custom_volumes.rst | 10 +++ dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh | 7 -- kiwi/defaults.py | 1 + kiwi/storage/disk.py | 3 +- kiwi/storage/setup.py | 4 +- kiwi/system/profile.py | 7 +- kiwi/volume_manager/base.py | 2 +- kiwi/volume_manager/btrfs.py | 2 +- kiwi/volume_manager/lvm.py | 15 ++-- kiwi/xml_state.py | 36 +++++++--- .../example_lvm_custom_rootvol_config.xml | 41 +++++++++++ test/unit/storage/disk_test.py | 1 - test/unit/system/profile_test.py | 10 +-- test/unit/volume_manager/base_test.py | 27 ++++--- test/unit/volume_manager/btrfs_test.py | 33 +++++---- test/unit/volume_manager/lvm_test.py | 26 ++++--- test/unit/xml_state_test.py | 71 +++++++++++++++---- 17 files changed, 216 insertions(+), 80 deletions(-) create mode 100644 test/data/example_lvm_custom_rootvol_config.xml diff --git a/doc/source/working_with_images/custom_volumes.rst b/doc/source/working_with_images/custom_volumes.rst index 15b15b6cad6..b334f66ad8b 100644 --- a/doc/source/working_with_images/custom_volumes.rst +++ b/doc/source/working_with_images/custom_volumes.rst @@ -54,6 +54,16 @@ attributes: + In addition to the custom size of the root volume it's also possible + to setup the name of the root volume as follows: + + .. code:: xml + + + + If no name for the root volume is specified the + default name: **LVRoot** applies. + - `freespace`: Optional attribute defining the additional free space added to the volume. If no suffix (`M` or `G`) is used, the value is considered to be in megabytes. diff --git a/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh b/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh index 674e08e7242..1b2a0845068 100644 --- a/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh +++ b/dracut/modules.d/99kiwi-lib/kiwi-lvm-lib.sh @@ -152,7 +152,6 @@ function read_volume_setup_all_free { local volume local name local mpoint - local have_root_volume_setup=false while read -r volspec;do if ! [[ "${volspec}" =~ "kiwi_Volume_" ]];then continue @@ -160,18 +159,12 @@ function read_volume_setup_all_free { volume=$(echo "${volspec}" | cut -f2 -d= | tr -d \' | tr -d \") size=$(echo "${volume}" | cut -f2 -d\| | cut -f2 -d:) name=$(echo "${volume}" | cut -f1 -d\|) - if [ "${name}" = "LVRoot" ];then - have_root_volume_setup=true - fi if [ "${size}" = "all" ];then mpoint=$(echo "${volume}" | cut -f3 -d\|) echo "${name},${mpoint}" return fi done < "${profile}" - if [ "${have_root_volume_setup}" = "false" ];then - echo LVRoot, - fi } function get_all_free_volume { diff --git a/kiwi/defaults.py b/kiwi/defaults.py index 8ead41d20c9..414cb7890cf 100644 --- a/kiwi/defaults.py +++ b/kiwi/defaults.py @@ -37,6 +37,7 @@ EDIT_BOOT_CONFIG_SCRIPT = 'edit_boot_config.sh' EDIT_BOOT_INSTALL_SCRIPT = 'edit_boot_install.sh' IMAGE_METADATA_DIR = 'image' +ROOT_VOLUME_NAME = 'LVRoot' class Defaults: diff --git a/kiwi/storage/disk.py b/kiwi/storage/disk.py index 14b4f6cfc75..ad463a3dab0 100644 --- a/kiwi/storage/disk.py +++ b/kiwi/storage/disk.py @@ -105,14 +105,13 @@ def create_root_lvm_partition(self, mbsize): """ Create root partition for use with LVM - Populates kiwi_RootPart(id) and kiwi_RootPartVol(LVRoot) + Populates kiwi_RootPart(id) :param int mbsize: partition size """ self.partitioner.create('p.lxlvm', mbsize, 't.lvm') self._add_to_map('root') self._add_to_public_id_map('kiwi_RootPart') - self._add_to_public_id_map('kiwi_RootPartVol', 'LVRoot') def create_root_raid_partition(self, mbsize): """ diff --git a/kiwi/storage/setup.py b/kiwi/storage/setup.py index ef809ed27f2..b93a3b25915 100644 --- a/kiwi/storage/setup.py +++ b/kiwi/storage/setup.py @@ -322,7 +322,7 @@ def _accumulate_volume_size(self, root_mbytes): def _get_root_volume_configuration(self): """ - Provide LVRoot volume configuration if present and in + Provide root volume configuration if present and in use according to the selected volume management. So far this only affects the LVM volume manager """ @@ -330,7 +330,7 @@ def _get_root_volume_configuration(self): 'root_volume_type', ['size_type', 'req_size'] ) for volume in self.volumes: - if volume.name == 'LVRoot': + if volume.is_root_volume: if volume.size: [size_type, req_size] = volume.size.split(':') return root_volume_type( diff --git a/kiwi/system/profile.py b/kiwi/system/profile.py index 58e4512a21d..392eb6930ba 100644 --- a/kiwi/system/profile.py +++ b/kiwi/system/profile.py @@ -232,7 +232,11 @@ def _systemdisk_to_profile(self): volume_count = 1 for volume in self.xml_state.get_volumes(): - volume_id_name = 'kiwi_Volume_{id}'.format(id=volume_count) + if volume.is_root_volume: + volume_id_name = 'kiwi_Volume_Root' + else: + volume_id_name = 'kiwi_Volume_{id}'.format(id=volume_count) + volume_count += 1 self.dot_profile[volume_id_name] = '|'.join( [ volume.name, @@ -240,7 +244,6 @@ def _systemdisk_to_profile(self): volume.mountpoint or '' ] ) - volume_count += 1 def _preferences_to_profile(self): # kiwi_iversion diff --git a/kiwi/volume_manager/base.py b/kiwi/volume_manager/base.py index 408524fdd8e..973f625da6a 100644 --- a/kiwi/volume_manager/base.py +++ b/kiwi/volume_manager/base.py @@ -299,7 +299,7 @@ def get_volume_mbsize( if lookup_path == volume_path: continue if lookup_path == os.sep: - # exclude any sub volume path if lookup_path is / [LVRoot] + # exclude any sub volume path if lookup_path is / exclude_paths.append( os.path.normpath(self.root_dir + os.sep + volume_path) ) diff --git a/kiwi/volume_manager/btrfs.py b/kiwi/volume_manager/btrfs.py index 48c5110067a..e2e67055207 100644 --- a/kiwi/volume_manager/btrfs.py +++ b/kiwi/volume_manager/btrfs.py @@ -157,7 +157,7 @@ def create_volumes(self, filesystem_name): ) for volume in canonical_volume_list.volumes: - if volume.name == 'LVRoot': + if volume.is_root_volume: # the btrfs root volume named '@' has been created as # part of the setup procedure pass diff --git a/kiwi/volume_manager/lvm.py b/kiwi/volume_manager/lvm.py index 7d459819ba1..2f48e9539d3 100644 --- a/kiwi/volume_manager/lvm.py +++ b/kiwi/volume_manager/lvm.py @@ -70,8 +70,8 @@ def get_device(self): """ device_map = {} for volume_name, volume_node in list(self.volume_map.items()): - if volume_name == 'LVRoot': - # LVRoot volume device takes precedence over the + if self._is_root_volume(volume_name): + # root volume device takes precedence over the # root partition device from the disk. Therefore use # the same key to put them on the same level volume_name = 'root' @@ -228,7 +228,7 @@ def get_fstab(self, persistency_type, filesystem_name): """ fstab_entries = [] for volume_mount in self.mount_list: - if 'LVRoot' not in volume_mount.device: + if not self._is_root_volume(volume_mount.device): mount_path = '/'.join(volume_mount.mountpoint.split('/')[3:]) if not mount_path.startswith('/'): mount_path = '/' + mount_path @@ -288,7 +288,7 @@ def umount_volumes(self): def _create_filesystem(self, volume_name, volume_label, filesystem_name): device_node = self.volume_map[volume_name] - if volume_name == 'LVRoot' and not volume_label: + if self._is_root_volume(volume_name) and not volume_label: # if there is no @root volume definition for the root volume, # perform a second lookup of a label specified via the # rootfs_label from the type setup @@ -306,7 +306,7 @@ def _create_filesystem(self, volume_name, volume_label, filesystem_name): def _add_to_mount_list(self, volume_name, realpath): device_node = self.volume_map[volume_name] - if volume_name == 'LVRoot': + if self._is_root_volume(volume_name): # root volume must be first in the list self.mount_list.insert( 0, MountManager( @@ -343,6 +343,11 @@ def _volume_group_in_use_on_host_system(self, volume_group_name): # group name, it is considered to be not used return False + def _is_root_volume(self, name): + for volume in self.volumes: + if name in volume.name and volume.is_root_volume: + return True + def __del__(self): if self.volume_group: log.info('Cleaning up %s instance', type(self).__name__) diff --git a/kiwi/xml_state.py b/kiwi/xml_state.py index 755756a5c79..a6e6e5bb482 100644 --- a/kiwi/xml_state.py +++ b/kiwi/xml_state.py @@ -23,6 +23,8 @@ from textwrap import dedent # project +import kiwi.defaults as defaults + from kiwi import xml_parse from kiwi.system.uri import Uri from kiwi.defaults import Defaults @@ -1223,7 +1225,8 @@ def get_volumes(self): # noqa C901 mountpoint=path, fullsize=True, label=volume_label, - attributes=['no-copy-on-write'] + attributes=['no-copy-on-write'], + is_root_volume=True|False ) ] @@ -1243,7 +1246,8 @@ def get_volumes(self): # noqa C901 'mountpoint', 'fullsize', 'label', - 'attributes' + 'attributes', + 'is_root_volume' ] ) @@ -1262,6 +1266,7 @@ def get_volumes(self): # noqa C901 fullsize = False label = volume.get_label() attributes = [] + is_root_volume = False if volume.get_copy_on_write() is False: # by default copy-on-write is switched on for any @@ -1270,11 +1275,21 @@ def get_volumes(self): # noqa C901 attributes.append('no-copy-on-write') if '@root' in name: - # setup root volume, it takes a fixed volume name and - # has no specific mountpoint + # setup root volume, it takes an optional volume + # name if specified as @root=name and has no specific + # mountpoint. The default name is set to + # defaults.ROOT_VOLUME_NAME if no other root volume + # name is provided mountpoint = None realpath = '/' - name = 'LVRoot' + is_root_volume = True + root_volume_expression = re.match( + r'@root=(.+)', name + ) + if root_volume_expression: + name = root_volume_expression.group(1) + else: + name = defaults.ROOT_VOLUME_NAME have_root_volume_setup = True elif not mountpoint: # setup volume without mountpoint. In this case the name @@ -1310,7 +1325,8 @@ def get_volumes(self): # noqa C901 mountpoint=mountpoint, realpath=realpath, label=label, - attributes=attributes + attributes=attributes, + is_root_volume=is_root_volume ) ) @@ -1327,13 +1343,14 @@ def get_volumes(self): # noqa C901 fullsize = True volume_type_list.append( volume_type( - name='LVRoot', + name=defaults.ROOT_VOLUME_NAME, size=size, fullsize=fullsize, mountpoint=None, realpath='/', label=None, - attributes=[] + attributes=[], + is_root_volume=True ) ) @@ -1346,7 +1363,8 @@ def get_volumes(self): # noqa C901 mountpoint=None, realpath='swap', label='SWAP', - attributes=[] + attributes=[], + is_root_volume=False ) ) diff --git a/test/data/example_lvm_custom_rootvol_config.xml b/test/data/example_lvm_custom_rootvol_config.xml new file mode 100644 index 00000000000..aef74d9072a --- /dev/null +++ b/test/data/example_lvm_custom_rootvol_config.xml @@ -0,0 +1,41 @@ + + + + + Marcus Schäfer + ms@suse.com + + openSUSE 13.2 JeOS, is a small text based image + + + + 1.13.2 + zypper + en_US + us.map.gz + Europe/Berlin + true + false + openSUSE + openSUSE + + + + + + + + + + + + + + + + + + + + + diff --git a/test/unit/storage/disk_test.py b/test/unit/storage/disk_test.py index c4f766dde48..9880a056e81 100644 --- a/test/unit/storage/disk_test.py +++ b/test/unit/storage/disk_test.py @@ -73,7 +73,6 @@ def test_create_root_lvm_partition(self): 'p.lxlvm', 100, 't.lvm' ) assert self.disk.public_partition_id_map['kiwi_RootPart'] == 1 - assert self.disk.public_partition_id_map['kiwi_RootPartVol'] == 'LVRoot' def test_create_root_raid_partition(self): self.disk.create_root_raid_partition(100) diff --git a/test/unit/system/profile_test.py b/test/unit/system/profile_test.py index 2ef62698a8f..887b0dd37ec 100644 --- a/test/unit/system/profile_test.py +++ b/test/unit/system/profile_test.py @@ -29,11 +29,11 @@ def test_create(self, mock_which, mock_temp): os.remove(self.profile_file) assert self.profile.dot_profile == { 'kiwi_Volume_1': 'usr_lib|size:1024|usr/lib', - 'kiwi_Volume_2': 'LVRoot|freespace:500|', - 'kiwi_Volume_3': 'etc_volume|freespace:30|etc', - 'kiwi_Volume_4': 'bin_volume|size:all|/usr/bin', - 'kiwi_Volume_5': 'usr_bin|freespace:30|usr/bin', - 'kiwi_Volume_6': 'LVSwap|size:128|', + 'kiwi_Volume_2': 'etc_volume|freespace:30|etc', + 'kiwi_Volume_3': 'bin_volume|size:all|/usr/bin', + 'kiwi_Volume_4': 'usr_bin|freespace:30|usr/bin', + 'kiwi_Volume_5': 'LVSwap|size:128|', + 'kiwi_Volume_Root': 'LVRoot|freespace:500|', 'kiwi_bootkernel': None, 'kiwi_bootloader': 'grub2', 'kiwi_bootprofile': None, diff --git a/test/unit/volume_manager/base_test.py b/test/unit/volume_manager/base_test.py index 6e71a363ad6..12d4bf98e37 100644 --- a/test/unit/volume_manager/base_test.py +++ b/test/unit/volume_manager/base_test.py @@ -19,7 +19,8 @@ def setup(self, mock_path): 'realpath', 'mountpoint', 'fullsize', - 'attributes' + 'attributes', + 'is_root_volume' ] ) mock_path.return_value = True @@ -38,11 +39,13 @@ def setup(self, mock_path): self.volume_manager.volumes = [ self.volume_type( name='LVetc', size='freespace:200', realpath='/etc', - mountpoint='/etc', fullsize=False, attributes=[] + mountpoint='/etc', fullsize=False, attributes=[], + is_root_volume=False ), self.volume_type( name='LVRoot', size='size:500', realpath='/', - mountpoint='/', fullsize=True, attributes=[] + mountpoint='/', fullsize=True, attributes=[], + is_root_volume=True ) ] @@ -146,11 +149,13 @@ def test_get_volume_mbsize_nested_volumes( self.volume_manager.volumes = [ self.volume_type( name='LVusr', size='freespace:200', realpath='/usr', - mountpoint='/usr', fullsize=False, attributes=[] + mountpoint='/usr', fullsize=False, attributes=[], + is_root_volume=False ), self.volume_type( name='LVusr_lib', size='freespace:100', realpath='/usr/lib', - mountpoint='/usr/lib', fullsize=False, attributes=[] + mountpoint='/usr/lib', fullsize=False, attributes=[], + is_root_volume=False ) ] assert self.volume_manager.get_volume_mbsize( @@ -175,15 +180,18 @@ def test_get_volume_mbsize_root_volume( self.volume_manager.volumes = [ self.volume_type( name='LVusr', size='freespace:200', realpath='/usr', - mountpoint='/usr', fullsize=False, attributes=[] + mountpoint='/usr', fullsize=False, attributes=[], + is_root_volume=False ), self.volume_type( name='LVusr_lib', size='freespace:100', realpath='/usr/lib', - mountpoint='/usr/lib', fullsize=False, attributes=[] + mountpoint='/usr/lib', fullsize=False, attributes=[], + is_root_volume=False ), self.volume_type( name='LVRoot', size='size:500', realpath='/', - mountpoint='/', fullsize=True, attributes=[] + mountpoint='/', fullsize=True, attributes=[], + is_root_volume=True ) ] assert self.volume_manager.get_volume_mbsize( @@ -244,7 +252,8 @@ def test_apply_attributes_on_volume(self, mock_command): 'toplevel', self.volume_type( name='LVetc', size='freespace:200', realpath='/etc', mountpoint='/etc', fullsize=False, - attributes=['no-copy-on-write'] + attributes=['no-copy-on-write'], + is_root_volume=False ) ) mock_command.assert_called_once_with( diff --git a/test/unit/volume_manager/btrfs_test.py b/test/unit/volume_manager/btrfs_test.py index 1c473124fa4..9ad545293f1 100644 --- a/test/unit/volume_manager/btrfs_test.py +++ b/test/unit/volume_manager/btrfs_test.py @@ -32,29 +32,30 @@ def setup(self, mock_path): 'realpath', 'mountpoint', 'fullsize', - 'attributes' + 'attributes', + 'is_root_volume' ] ) self.volumes = [ self.volume_type( name='LVRoot', size='freespace:100', realpath='/', mountpoint=None, fullsize=False, - attributes=[] + attributes=[], is_root_volume=True ), self.volume_type( name='LVetc', size='freespace:200', realpath='/etc', mountpoint='/etc', fullsize=False, - attributes=[] + attributes=[], is_root_volume=False ), self.volume_type( name='myvol', size='size:500', realpath='/data', mountpoint='LVdata', fullsize=False, - attributes=[] + attributes=[], is_root_volume=False ), self.volume_type( name='LVhome', size=None, realpath='/home', mountpoint='/home', fullsize=True, - attributes=[] + attributes=[], is_root_volume=False ) ] mock_path.return_value = True @@ -186,15 +187,23 @@ def test_create_volumes( call( 'tmpdir/@/', self.volume_type( name='myvol', size='size:500', realpath='/data', - mountpoint='LVdata', fullsize=False, attributes=[]) + mountpoint='LVdata', fullsize=False, attributes=[], + is_root_volume=False + ) ), - call('tmpdir/@/', self.volume_type( - name='LVetc', size='freespace:200', realpath='/etc', - mountpoint='/etc', fullsize=False, attributes=[]) + call( + 'tmpdir/@/', self.volume_type( + name='LVetc', size='freespace:200', realpath='/etc', + mountpoint='/etc', fullsize=False, attributes=[], + is_root_volume=False + ) ), - call('tmpdir/@/', self.volume_type( - name='LVhome', size=None, realpath='/home', - mountpoint='/home', fullsize=True, attributes=[]) + call( + 'tmpdir/@/', self.volume_type( + name='LVhome', size=None, realpath='/home', + mountpoint='/home', fullsize=True, attributes=[], + is_root_volume=False + ) ) ] assert mock_path.call_args_list == [ diff --git a/test/unit/volume_manager/lvm_test.py b/test/unit/volume_manager/lvm_test.py index aae30c18238..155d9b70f34 100644 --- a/test/unit/volume_manager/lvm_test.py +++ b/test/unit/volume_manager/lvm_test.py @@ -28,29 +28,35 @@ def setup(self, mock_path): 'mountpoint', 'fullsize', 'label', - 'attributes' + 'attributes', + 'is_root_volume' ] ) self.volumes = [ self.volume_type( name='LVRoot', size='freespace:100', realpath='/', - mountpoint=None, fullsize=False, label=None, attributes=[] + mountpoint=None, fullsize=False, label=None, attributes=[], + is_root_volume=True ), self.volume_type( name='LVSwap', size='size:100', realpath='swap', - mountpoint=None, fullsize=False, label='SWAP', attributes=[] + mountpoint=None, fullsize=False, label='SWAP', attributes=[], + is_root_volume=False ), self.volume_type( name='LVetc', size='freespace:200', realpath='/etc', - mountpoint='/etc', fullsize=False, label='etc', attributes=[] + mountpoint='/etc', fullsize=False, label='etc', attributes=[], + is_root_volume=False ), self.volume_type( name='myvol', size='size:500', realpath='/data', - mountpoint='LVdata', fullsize=False, label=None, attributes=[] + mountpoint='LVdata', fullsize=False, label=None, attributes=[], + is_root_volume=False ), self.volume_type( name='LVhome', size=None, realpath='/home', - mountpoint='/home', fullsize=True, label=None, attributes=[] + mountpoint='/home', fullsize=True, label=None, attributes=[], + is_root_volume=False ), ] mock_path.return_value = True @@ -178,28 +184,28 @@ def mock_os_exists_return(path): 'root_dir', self.volume_type( name='LVSwap', size='size:100', realpath='swap', mountpoint=None, fullsize=False, label='SWAP', - attributes=[] + attributes=[], is_root_volume=False ) ), call( 'root_dir', self.volume_type( name='LVRoot', size='freespace:100', realpath='/', mountpoint=None, fullsize=False, label=None, - attributes=[] + attributes=[], is_root_volume=True ) ), call( 'root_dir', self.volume_type( name='myvol', size='size:500', realpath='/data', mountpoint='LVdata', fullsize=False, label=None, - attributes=[] + attributes=[], is_root_volume=False ) ), call( 'root_dir', self.volume_type( name='LVetc', size='freespace:200', realpath='/etc', mountpoint='/etc', fullsize=False, label='etc', - attributes=[] + attributes=[], is_root_volume=False ) ) ] diff --git a/test/unit/xml_state_test.py b/test/unit/xml_state_test.py index 8309e183387..f9608433793 100644 --- a/test/unit/xml_state_test.py +++ b/test/unit/xml_state_test.py @@ -292,6 +292,35 @@ def test_profile_requires(self): 'composedProfile', 'vmxSimpleFlavour', 'xenDomUFlavour' ] + def test_get_volumes_custom_root_volume_name(self): + description = XMLDescription( + '../data/example_lvm_custom_rootvol_config.xml' + ) + xml_data = description.load() + state = XMLState(xml_data) + volume_type = namedtuple( + 'volume_type', [ + 'name', + 'size', + 'realpath', + 'mountpoint', + 'fullsize', + 'label', + 'attributes', + 'is_root_volume' + ] + ) + assert state.get_volumes() == [ + volume_type( + name='myroot', size='freespace:500', + realpath='/', + mountpoint=None, fullsize=False, + label=None, + attributes=[], + is_root_volume=True + ) + ] + def test_get_volumes(self): description = XMLDescription('../data/example_lvm_default_config.xml') xml_data = description.load() @@ -304,44 +333,51 @@ def test_get_volumes(self): 'mountpoint', 'fullsize', 'label', - 'attributes' + 'attributes', + 'is_root_volume' ] ) assert state.get_volumes() == [ volume_type( name='usr_lib', size='size:1024', realpath='usr/lib', - mountpoint='usr/lib', fullsize=False, + mountpoint='usr/lib', + fullsize=False, label='library', - attributes=[] + attributes=[], + is_root_volume=False ), volume_type( name='LVRoot', size='freespace:500', realpath='/', mountpoint=None, fullsize=False, label=None, - attributes=[] + attributes=[], + is_root_volume=True ), volume_type( name='etc_volume', size='freespace:30', realpath='etc', mountpoint='etc', fullsize=False, label=None, - attributes=['no-copy-on-write'] + attributes=['no-copy-on-write'], + is_root_volume=False ), volume_type( name='bin_volume', size=None, realpath='/usr/bin', mountpoint='/usr/bin', fullsize=True, label=None, - attributes=[] + attributes=[], + is_root_volume=False ), volume_type( name='LVSwap', size='size:128', realpath='swap', mountpoint=None, fullsize=False, label='SWAP', - attributes=[] + attributes=[], + is_root_volume=False ) ] @@ -357,7 +393,8 @@ def test_get_volumes_no_explicit_root_setup(self): 'mountpoint', 'fullsize', 'label', - 'attributes' + 'attributes', + 'is_root_volume' ] ) assert state.get_volumes() == [ @@ -365,14 +402,16 @@ def test_get_volumes_no_explicit_root_setup(self): name='LVRoot', size=None, realpath='/', mountpoint=None, fullsize=True, label=None, - attributes=[] + attributes=[], + is_root_volume=True ), volume_type( name='LVSwap', size='size:128', realpath='swap', mountpoint=None, fullsize=False, label='SWAP', - attributes=[] + attributes=[], + is_root_volume=False ) ] @@ -390,7 +429,8 @@ def test_get_volumes_no_explicit_root_setup_other_fullsize_volume(self): 'mountpoint', 'fullsize', 'label', - 'attributes' + 'attributes', + 'is_root_volume' ] ) assert state.get_volumes() == [ @@ -398,20 +438,23 @@ def test_get_volumes_no_explicit_root_setup_other_fullsize_volume(self): name='usr', size=None, realpath='usr', mountpoint='usr', fullsize=True, label=None, - attributes=[] + attributes=[], + is_root_volume=False ), volume_type( name='LVRoot', size='freespace:30', realpath='/', mountpoint=None, fullsize=False, label=None, - attributes=[] + attributes=[], + is_root_volume=True ), volume_type( name='LVSwap', size='size:128', realpath='swap', mountpoint=None, fullsize=False, label='SWAP', - attributes=[] + attributes=[], + is_root_volume=False ) ]