storage/reflink: trivial style tweaks
Avoid early return for short and not deeply nested functions.
This commit is contained in:
parent
21971d6d0a
commit
ada27ee431
@ -207,18 +207,17 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
@_locked
|
@_locked
|
||||||
def start(self):
|
def start(self):
|
||||||
self._remove_incomplete_images()
|
self._remove_incomplete_images()
|
||||||
if self.is_dirty():
|
if not self.is_dirty():
|
||||||
return self
|
if self.snap_on_start:
|
||||||
if self.snap_on_start:
|
# pylint: disable=protected-access
|
||||||
# pylint: disable=protected-access
|
_copy_file(self.source._path_clean, self._path_clean)
|
||||||
_copy_file(self.source._path_clean, self._path_clean)
|
if self.snap_on_start or self.save_on_stop:
|
||||||
if self.snap_on_start or self.save_on_stop:
|
_copy_file(self._path_clean, self._path_dirty)
|
||||||
_copy_file(self._path_clean, self._path_dirty)
|
else:
|
||||||
else:
|
# Preferably use the size of a leftover image, in case
|
||||||
# Preferably use the size of a leftover image, in case
|
# the volume was previously resized - but then a crash
|
||||||
# the volume was previously resized - but then a crash
|
# prevented qubes.xml serialization of the new size.
|
||||||
# prevented qubes.xml serialization of the new size.
|
_create_sparse_file(self._path_dirty, self._get_size())
|
||||||
_create_sparse_file(self._path_dirty, self._get_size())
|
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@_coroutinized
|
@_coroutinized
|
||||||
@ -309,14 +308,13 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
@_coroutinized
|
@_coroutinized
|
||||||
@_locked
|
@_locked
|
||||||
def import_volume(self, src_volume):
|
def import_volume(self, src_volume):
|
||||||
if not self.save_on_stop:
|
if self.save_on_stop:
|
||||||
return self
|
try:
|
||||||
try:
|
success = False
|
||||||
success = False
|
_copy_file(src_volume.export(), self._path_import)
|
||||||
_copy_file(src_volume.export(), self._path_import)
|
success = True
|
||||||
success = True
|
finally:
|
||||||
finally:
|
self._import_data_end(success)
|
||||||
self._import_data_end(success)
|
|
||||||
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