storage/reflink: make resize()/import_volume() more readable
This commit is contained in:
parent
425d993769
commit
73db2751b8
@ -264,13 +264,14 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
|
|
||||||
try: # assume volume is not (cleanly) stopped ...
|
try: # assume volume is not (cleanly) stopped ...
|
||||||
_resize_file(self._path_dirty, size)
|
_resize_file(self._path_dirty, size)
|
||||||
self.size = size
|
update = True
|
||||||
except FileNotFoundError: # ... but it actually is.
|
except FileNotFoundError: # ... but it actually is.
|
||||||
_resize_file(self._path_clean, size)
|
_resize_file(self._path_clean, size)
|
||||||
self.size = size
|
update = False
|
||||||
return self
|
|
||||||
|
|
||||||
_update_loopdev_sizes(self._path_dirty)
|
self.size = size
|
||||||
|
if update:
|
||||||
|
_update_loopdev_sizes(self._path_dirty)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def export(self):
|
def export(self):
|
||||||
@ -301,11 +302,11 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
if not self.save_on_stop:
|
if not self.save_on_stop:
|
||||||
return self
|
return self
|
||||||
try:
|
try:
|
||||||
|
success = False
|
||||||
_copy_file(src_volume.export(), self._path_import)
|
_copy_file(src_volume.export(), self._path_import)
|
||||||
except:
|
success = True
|
||||||
self._import_data_end(False)
|
finally:
|
||||||
raise
|
self._import_data_end(success)
|
||||||
self._import_data_end(True)
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def _path_revision(self, number, timestamp=None):
|
def _path_revision(self, number, timestamp=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user