From f2d88b9c6598582f6eba701f9a354d117affecbf Mon Sep 17 00:00:00 2001 From: catborise <catborise@yahoo.com> Date: Fri, 5 Oct 2018 17:07:25 +0300 Subject: [PATCH] add performance parameters and owner properties to clone_template and create volume --- vrtManager/create.py | 4 ++++ vrtManager/instance.py | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/vrtManager/create.py b/vrtManager/create.py index 24f2def..e4199d9 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -76,6 +76,10 @@ class wvmCreate(wvmConnect): <mode>0644</mode> <label>virt_image_t</label> </permissions> + <compat>1.1</compat> + <features> + <lazy_refcounts/> + </features> </target> </volume>""" % (name, size, alloc, image_format, owner['uid'], owner['guid']) stg.createXML(xml, metadata) diff --git a/vrtManager/instance.py b/vrtManager/instance.py index d5bc1b9..b5f3f16 100644 --- a/vrtManager/instance.py +++ b/vrtManager/instance.py @@ -10,6 +10,7 @@ from datetime import datetime from vrtManager.connection import wvmConnect from vrtManager.storage import wvmStorage from webvirtcloud.settings import QEMU_CONSOLE_TYPES +from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_OWNER as owner class wvmInstances(wvmConnect): @@ -721,6 +722,7 @@ class wvmInstance(wvmConnect): if vol_format == 'qcow2' and meta_prealloc: meta_prealloc = True + vol_clone_xml = """ <volume> <name>%s</name> @@ -729,7 +731,17 @@ class wvmInstance(wvmConnect): <target> <format type='%s'/> </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.createXMLFrom(vol_clone_xml, vol, meta_prealloc)