storage/reflink: volume.resize(): succeed without image
Successfully resize volumes without any currently existing image file, e.g. cleanly stopped volatile volumes: Just update the nominal size in this case.
This commit is contained in:
parent
25e92bd19b
commit
ef128156a3
@ -263,15 +263,13 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
raise qubes.storage.StoragePoolException(
|
raise qubes.storage.StoragePoolException(
|
||||||
'Cannot resize: {} is read-only'.format(self.vid))
|
'Cannot resize: {} is read-only'.format(self.vid))
|
||||||
|
|
||||||
try: # assume volume is not (cleanly) stopped ...
|
for path in (self._path_dirty, self._path_clean):
|
||||||
_resize_file(self._path_dirty, size)
|
with suppress(FileNotFoundError):
|
||||||
update = True
|
_resize_file(path, size)
|
||||||
except FileNotFoundError: # ... but it actually is.
|
break
|
||||||
_resize_file(self._path_clean, size)
|
|
||||||
update = False
|
|
||||||
|
|
||||||
self.size = size
|
self.size = size
|
||||||
if update:
|
if path == self._path_dirty:
|
||||||
_update_loopdev_sizes(self._path_dirty)
|
_update_loopdev_sizes(self._path_dirty)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user