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