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): def start(self):
if self.snap_on_start or self.save_on_stop: try:
if not self.save_on_stop or not self.is_dirty(): if self.snap_on_start or self.save_on_stop:
self._snapshot() if not self.save_on_stop or not self.is_dirty():
else: self._snapshot()
self._reset() else:
self._reset()
reset_cache() finally:
reset_cache()
return self return self
def stop(self): def stop(self):
if self.save_on_stop: try:
self._commit() if self.save_on_stop:
if self.snap_on_start or self.save_on_stop: self._commit()
cmd = ['remove', self._vid_snap] if self.snap_on_start or self.save_on_stop:
qubes_lvm(cmd, self.log) cmd = ['remove', self._vid_snap]
else: qubes_lvm(cmd, self.log)
cmd = ['remove', self.vid] else:
qubes_lvm(cmd, self.log) cmd = ['remove', self.vid]
reset_cache() qubes_lvm(cmd, self.log)
finally:
reset_cache()
return self return self
def verify(self): def verify(self):