storage/lvm: misc fixes
- add missing lvm remove call when commiting changes - delay creating volatile image until domain startup (it will be created then anyway) - reset cache only when really changed anything - attach VM to the volume (snapshot) created for its runtime - to not expose changes (for example in root volume) to child VMs until shutdown QubesOS/qubes-issues#2412 QubesOS/qubes-issues#2256
This commit is contained in:
parent
0471453773
commit
400e92b25a
@ -69,6 +69,7 @@ class ThinPool(qubes.storage.Pool):
|
|||||||
cmd = ['clone', volume._vid_snap, volume.vid]
|
cmd = ['clone', volume._vid_snap, volume.vid]
|
||||||
qubes_lvm(cmd, self.log)
|
qubes_lvm(cmd, self.log)
|
||||||
cmd = ['remove', volume._vid_snap]
|
cmd = ['remove', volume._vid_snap]
|
||||||
|
qubes_lvm(cmd, self.log)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config(self):
|
def config(self):
|
||||||
@ -83,8 +84,9 @@ class ThinPool(qubes.storage.Pool):
|
|||||||
assert volume.vid
|
assert volume.vid
|
||||||
assert volume.size
|
assert volume.size
|
||||||
if volume.source:
|
if volume.source:
|
||||||
return self.clone(volume.source, volume)
|
# will clone in start()
|
||||||
else:
|
return volume
|
||||||
|
elif not volume._is_volatile:
|
||||||
cmd = [
|
cmd = [
|
||||||
'create',
|
'create',
|
||||||
self._pool_id,
|
self._pool_id,
|
||||||
@ -92,7 +94,7 @@ class ThinPool(qubes.storage.Pool):
|
|||||||
str(volume.size)
|
str(volume.size)
|
||||||
]
|
]
|
||||||
qubes_lvm(cmd, self.log)
|
qubes_lvm(cmd, self.log)
|
||||||
reset_cache()
|
reset_cache()
|
||||||
return volume
|
return volume
|
||||||
|
|
||||||
def destroy(self):
|
def destroy(self):
|
||||||
@ -398,6 +400,16 @@ class ThinVolume(qubes.storage.Volume):
|
|||||||
raise qubes.storage.StoragePoolException(
|
raise qubes.storage.StoragePoolException(
|
||||||
"You shouldn't use lvm size setter")
|
"You shouldn't use lvm size setter")
|
||||||
|
|
||||||
|
def block_device(self):
|
||||||
|
''' Return :py:class:`qubes.devices.BlockDevice` for serialization in
|
||||||
|
the libvirt XML template as <disk>.
|
||||||
|
'''
|
||||||
|
if not self._is_volatile:
|
||||||
|
return qubes.devices.BlockDevice(
|
||||||
|
'/dev/' + self._vid_snap, self.name, self.script,
|
||||||
|
self.rw, self.domain, self.devtype)
|
||||||
|
else:
|
||||||
|
return super(ThinVolume, self).block_device()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def usage(self): # lvm thin usage always returns at least the same usage as
|
def usage(self): # lvm thin usage always returns at least the same usage as
|
||||||
|
Loading…
Reference in New Issue
Block a user