mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-25 15:45:23 +00:00
revert of image extension choosing changes. and modify create xmls
This commit is contained in:
parent
171f98b232
commit
c7b8d1ece0
1 changed files with 14 additions and 4 deletions
|
@ -2,7 +2,6 @@ import string
|
||||||
from vrtManager import util
|
from vrtManager import util
|
||||||
from vrtManager.connection import wvmConnect
|
from vrtManager.connection import wvmConnect
|
||||||
from webvirtcloud.settings import QEMU_CONSOLE_DEFAULT_TYPE
|
from webvirtcloud.settings import QEMU_CONSOLE_DEFAULT_TYPE
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_FILE_EXTENSION
|
|
||||||
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_FORMAT
|
from webvirtcloud.settings import INSTANCE_VOLUME_DEFAULT_FORMAT
|
||||||
|
|
||||||
|
|
||||||
|
@ -23,7 +22,6 @@ def get_rbd_storage_data(stg):
|
||||||
|
|
||||||
|
|
||||||
class wvmCreate(wvmConnect):
|
class wvmCreate(wvmConnect):
|
||||||
image_extension = INSTANCE_VOLUME_DEFAULT_FILE_EXTENSION
|
|
||||||
image_format = INSTANCE_VOLUME_DEFAULT_FORMAT
|
image_format = INSTANCE_VOLUME_DEFAULT_FORMAT
|
||||||
|
|
||||||
def get_storages_images(self):
|
def get_storages_images(self):
|
||||||
|
@ -53,12 +51,12 @@ class wvmCreate(wvmConnect):
|
||||||
"""Get guest capabilities"""
|
"""Get guest capabilities"""
|
||||||
return util.get_xml_path(self.get_cap_xml(), "/capabilities/host/cpu/arch")
|
return util.get_xml_path(self.get_cap_xml(), "/capabilities/host/cpu/arch")
|
||||||
|
|
||||||
def create_volume(self, storage, name, size, image_format=image_format, metadata=False, image_extension=image_extension):
|
def create_volume(self, storage, name, size, image_format=image_format, metadata=False):
|
||||||
size = int(size) * 1073741824
|
size = int(size) * 1073741824
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type")
|
storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type")
|
||||||
if storage_type == 'dir':
|
if storage_type == 'dir':
|
||||||
name += '.' + image_extension
|
name += '.img'
|
||||||
alloc = 0
|
alloc = 0
|
||||||
else:
|
else:
|
||||||
alloc = size
|
alloc = size
|
||||||
|
@ -70,6 +68,12 @@ class wvmCreate(wvmConnect):
|
||||||
<allocation>%s</allocation>
|
<allocation>%s</allocation>
|
||||||
<target>
|
<target>
|
||||||
<format type='%s'/>
|
<format type='%s'/>
|
||||||
|
<permissions>
|
||||||
|
<owner>107</owner>
|
||||||
|
<group>107</group>
|
||||||
|
<mode>0644</mode>
|
||||||
|
<label>virt_image_t</label>
|
||||||
|
</permissions>
|
||||||
</target>
|
</target>
|
||||||
</volume>""" % (name, size, alloc, image_format)
|
</volume>""" % (name, size, alloc, image_format)
|
||||||
stg.createXML(xml, metadata)
|
stg.createXML(xml, metadata)
|
||||||
|
@ -121,6 +125,12 @@ class wvmCreate(wvmConnect):
|
||||||
<allocation>0</allocation>
|
<allocation>0</allocation>
|
||||||
<target>
|
<target>
|
||||||
<format type='%s'/>
|
<format type='%s'/>
|
||||||
|
<permissions>
|
||||||
|
<owner>107</owner>
|
||||||
|
<group>107</group>
|
||||||
|
<mode>0644</mode>
|
||||||
|
<label>virt_image_t</label>
|
||||||
|
</permissions>
|
||||||
</target>
|
</target>
|
||||||
</volume>""" % (clone, format)
|
</volume>""" % (clone, format)
|
||||||
stg.createXMLFrom(xml, vol, metadata)
|
stg.createXMLFrom(xml, vol, metadata)
|
||||||
|
|
Loading…
Reference in a new issue