Merge pull request #1063 from mwhudson/lp-1941968

allow a lvm_partition to not have a size
This commit is contained in:
Michael Hudson-Doyle 2021-09-28 10:01:14 +13:00 committed by GitHub
commit 1a3a25bb4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -380,8 +380,8 @@ class attributes:
return attr.ib(default=value)
@staticmethod
def size():
return attr.ib(converter=_conv_size)
def size(default=None):
return attr.ib(converter=_conv_size, default=None)
@staticmethod
def ptable():
@ -774,13 +774,16 @@ class LVM_VolGroup(_Device):
class LVM_LogicalVolume(_Formattable):
name = attr.ib()
volgroup = attributes.ref(backlink="_partitions") # LVM_VolGroup
size = attributes.size()
size = attributes.size(default=None)
wipe = attr.ib(default=None)
preserve = attr.ib(default=False)
def serialize_size(self):
return {'size': "{}B".format(self.size)}
if self.size is None:
return {}
else:
return {'size': "{}B".format(self.size)}
def available(self):
if self._constructed_device is not None: