Skip to content

Commit 2bbcbf5

Browse files
committed
Handle int sizes such as default of 0 for a disk size.
1 parent 2ba6a53 commit 2bbcbf5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/blivet.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,8 +435,8 @@ def _get_format(self):
435435
return fmt
436436

437437
def _get_size(self):
438-
spec = self._volume['size'].strip()
439-
if '%' in spec and self._blivet_pool:
438+
spec = self._volume['size']
439+
if isinstance(spec, str) and '%' in spec and self._blivet_pool:
440440
try:
441441
percentage = int(spec[:-1].strip())
442442
except ValueError:
@@ -634,7 +634,7 @@ def _create(self):
634634

635635
size = Size("256 MiB")
636636
maxsize = None
637-
if '%' in self._volume['size']:
637+
if isinstance(self._volume['size'], str) and '%' in self._volume['size']:
638638
maxsize = self._get_size()
639639

640640
try:
@@ -661,7 +661,7 @@ def _get_device_id(self):
661661

662662
def _get_size(self):
663663
size = super(BlivetLVMVolume, self)._get_size()
664-
if '%' in self._volume['size']:
664+
if isinstance(self._volume['size'], str) and '%' in self._volume['size']:
665665
size = self._blivet_pool._device.align(size, roundup=True)
666666
return size
667667

0 commit comments

Comments
 (0)