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,16 +432,18 @@ class ThinVolume(qubes.storage.Volume):
def start(self): def start(self):
try:
if self.snap_on_start or self.save_on_stop: if self.snap_on_start or self.save_on_stop:
if not self.save_on_stop or not self.is_dirty(): if not self.save_on_stop or not self.is_dirty():
self._snapshot() self._snapshot()
else: else:
self._reset() self._reset()
finally:
reset_cache() reset_cache()
return self return self
def stop(self): def stop(self):
try:
if self.save_on_stop: if self.save_on_stop:
self._commit() self._commit()
if self.snap_on_start or self.save_on_stop: if self.snap_on_start or self.save_on_stop:
@ -450,6 +452,7 @@ class ThinVolume(qubes.storage.Volume):
else: else:
cmd = ['remove', self.vid] cmd = ['remove', self.vid]
qubes_lvm(cmd, self.log) qubes_lvm(cmd, self.log)
finally:
reset_cache() reset_cache()
return self return self