storage/lvm: remove duplicated _reset function

There were two: _reset and _reset_volume. Neither of them was working,
but the later was closer. Remove the other one.

QubesOS/qubes-issues#2256
This commit is contained in:
Marek Marczykowski-Górecki 2016-11-04 02:03:46 +01:00
parent 37dbf29bc1
commit 4323651afb
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -218,14 +218,6 @@ class ThinPool(qubes.storage.Pool):
qubes_lvm(cmd, self.log)
reset_cache()
def _reset(self, volume):
try:
self.remove(volume)
except qubes.storage.StoragePoolException:
pass
self.create(volume)
def setup(self):
pass # TODO Should we create a non existing pool?
@ -233,7 +225,7 @@ class ThinPool(qubes.storage.Pool):
if volume._is_snapshot:
self._snapshot(volume)
elif volume._is_volatile:
self._reset(volume)
self._reset_volume(volume)
else:
if not self.is_dirty(volume):
self._snapshot(volume)
@ -298,11 +290,14 @@ class ThinPool(qubes.storage.Pool):
def _reset_volume(self, volume):
''' Resets a volatile volume '''
assert volume.volume_type == 'volatile', \
assert volume._is_volatile, \
'Expected a volatile volume, but got {!r}'.format(volume)
self.log.debug('Resetting volatile ' + volume.vid)
cmd = ['remove', volume.vid]
qubes_lvm(cmd, self.log)
try:
cmd = ['remove', volume.vid]
qubes_lvm(cmd, self.log)
except qubes.storage.StoragePoolException:
pass
cmd = ['create', self._pool_id, volume.vid.split('/')[1],
str(volume.size)]
qubes_lvm(cmd, self.log)