1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-01-12 08:25:18 +00:00

add performance parameters and owner properties to clone_template and create volume

This commit is contained in:
catborise 2018-10-05 17:07:25 +03:00
parent 016e93ebca
commit f2d88b9c65
2 changed files with 17 additions and 1 deletions

View file

@ -76,6 +76,10 @@ class wvmCreate(wvmConnect):
<mode>0644</mode> <mode>0644</mode>
<label>virt_image_t</label> <label>virt_image_t</label>
</permissions> </permissions>
<compat>1.1</compat>
<features>
<lazy_refcounts/>
</features>
</target> </target>
</volume>""" % (name, size, alloc, image_format, owner['uid'], owner['guid']) </volume>""" % (name, size, alloc, image_format, owner['uid'], owner['guid'])
stg.createXML(xml, metadata) stg.createXML(xml, metadata)

View file

@ -10,6 +10,7 @@ from datetime import datetime
from vrtManager.connection import wvmConnect from vrtManager.connection import wvmConnect
from vrtManager.storage import wvmStorage from vrtManager.storage import wvmStorage
from webvirtcloud.settings import QEMU_CONSOLE_TYPES from webvirtcloud.settings import QEMU_CONSOLE_TYPES
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner
class wvmInstances(wvmConnect): class wvmInstances(wvmConnect):
@ -721,6 +722,7 @@ class wvmInstance(wvmConnect):
if vol_format == 'qcow2' and meta_prealloc: if vol_format == 'qcow2' and meta_prealloc:
meta_prealloc = True meta_prealloc = True
vol_clone_xml = """ vol_clone_xml = """
<volume> <volume>
<name>%s</name> <name>%s</name>
@ -729,7 +731,17 @@ class wvmInstance(wvmConnect):
<target> <target>
<format type='%s'/> <format type='%s'/>
</target> </target>
</volume>""" % (target_file, vol_format) <permissions>
<owner>%s</owner>
<group>%s</group>
<mode>0644</mode>
<label>virt_image_t</label>
</permissions>
<compat>1.1</compat>
<features>
<lazy_refcounts/>
</features>
</volume>""" % (target_file, vol_format, owner['uid'], owner['guid'])
stg = vol.storagePoolLookupByVolume() stg = vol.storagePoolLookupByVolume()
stg.createXMLFrom(vol_clone_xml, vol, meta_prealloc) stg.createXMLFrom(vol_clone_xml, vol, meta_prealloc)