mirror of
https://github.com/virt-manager/virt-manager.git
synced 2024-12-22 13:34:07 +03:00
storage: Use qcow2 metadata preallocation if supported
This commit is contained in:
parent
fa8422f278
commit
37350859ce
@ -661,6 +661,16 @@ class StorageVolume(_StorageObject):
|
||||
if not meter:
|
||||
meter = urlgrabber.progress.BaseMeter()
|
||||
|
||||
cloneflags = 0
|
||||
createflags = 0
|
||||
if (self.format == "qcow2" and
|
||||
not self.backing_store and
|
||||
not self.conn.is_test() and
|
||||
self.conn.check_pool_support(
|
||||
self.pool, self.conn.SUPPORT_POOL_METADATA_PREALLOC)):
|
||||
createflags |= libvirt.VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA
|
||||
|
||||
|
||||
try:
|
||||
self._install_finished = False
|
||||
t.start()
|
||||
@ -668,9 +678,10 @@ class StorageVolume(_StorageObject):
|
||||
text=_("Allocating '%s'") % self.name)
|
||||
|
||||
if self.input_vol:
|
||||
vol = self.pool.createXMLFrom(xml, self.input_vol, 0)
|
||||
vol = self.pool.createXMLFrom(xml, self.input_vol, cloneflags)
|
||||
else:
|
||||
vol = self.pool.createXML(xml, 0)
|
||||
logging.debug("Using vol create flags=%s", createflags)
|
||||
vol = self.pool.createXML(xml, createflags)
|
||||
|
||||
self._install_finished = True
|
||||
t.join()
|
||||
|
@ -356,6 +356,9 @@ SUPPORT_POOL_CREATEVOLFROM = _make(function="virStoragePool.createXMLFrom",
|
||||
SUPPORT_POOL_ISACTIVE = _make(function="virStoragePool.isActive", args=())
|
||||
SUPPORT_POOL_LISTALLVOLUMES = _make(function="virStoragePool.listAllVolumes",
|
||||
args=())
|
||||
SUPPORT_POOL_METADATA_PREALLOC = _make(
|
||||
flag="VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA",
|
||||
version="1000001")
|
||||
|
||||
|
||||
# Interface checks
|
||||
|
Loading…
Reference in New Issue
Block a user