storage/reflink: reorder start() to be more readable
This also makes slightly more sense in the exotic (and currently unused) case of restarting a crashed snap_on_start *and* save_on_stop volume.
This commit is contained in:
parent
31810db977
commit
1743c76ca9
@ -151,12 +151,12 @@ class ReflinkVolume(qubes.storage.Volume):
|
|||||||
return self.save_on_stop and os.path.exists(self._path_dirty)
|
return self.save_on_stop and os.path.exists(self._path_dirty)
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
|
if self.is_dirty(): # implies self.save_on_stop
|
||||||
|
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.is_dirty(): # implies self.save_on_stop
|
if self.snap_on_start or self.save_on_stop:
|
||||||
return self
|
|
||||||
if self.save_on_stop or self.snap_on_start:
|
|
||||||
_copy_file(self._path_clean, self._path_dirty)
|
_copy_file(self._path_clean, self._path_dirty)
|
||||||
else:
|
else:
|
||||||
_create_sparse_file(self._path_dirty, self.size)
|
_create_sparse_file(self._path_dirty, self.size)
|
||||||
|
Loading…
Reference in New Issue
Block a user