storage/lvm: make sure volume cache is refreshed after changes

Even if start/stop fails, still refresh the cache. The failed operation
might still modified something.
This commit is contained in:
Marek Marczykowski-Górecki 2017-10-16 00:44:52 +02:00
parent 145ccfb34e
commit 08583af1ff
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -432,25 +432,28 @@ class ThinVolume(qubes.storage.Volume):
def start(self):
if self.snap_on_start or self.save_on_stop:
if not self.save_on_stop or not self.is_dirty():
self._snapshot()
else:
self._reset()
reset_cache()
try:
if self.snap_on_start or self.save_on_stop:
if not self.save_on_stop or not self.is_dirty():
self._snapshot()
else:
self._reset()
finally:
reset_cache()
return self
def stop(self):
if self.save_on_stop:
self._commit()
if self.snap_on_start or self.save_on_stop:
cmd = ['remove', self._vid_snap]
qubes_lvm(cmd, self.log)
else:
cmd = ['remove', self.vid]
qubes_lvm(cmd, self.log)
reset_cache()
try:
if self.save_on_stop:
self._commit()
if self.snap_on_start or self.save_on_stop:
cmd = ['remove', self._vid_snap]
qubes_lvm(cmd, self.log)
else:
cmd = ['remove', self.vid]
qubes_lvm(cmd, self.log)
finally:
reset_cache()
return self
def verify(self):