mirror of
https://github.com/retspen/webvirtcloud
synced 2024-10-31 19:44:16 +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.connection import wvmConnect
|
||||
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
|
||||
|
||||
|
||||
|
@ -23,7 +22,6 @@ def get_rbd_storage_data(stg):
|
|||
|
||||
|
||||
class wvmCreate(wvmConnect):
|
||||
image_extension = INSTANCE_VOLUME_DEFAULT_FILE_EXTENSION
|
||||
image_format = INSTANCE_VOLUME_DEFAULT_FORMAT
|
||||
|
||||
def get_storages_images(self):
|
||||
|
@ -53,12 +51,12 @@ class wvmCreate(wvmConnect):
|
|||
"""Get guest capabilities"""
|
||||
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
|
||||
stg = self.get_storage(storage)
|
||||
storage_type = util.get_xml_path(stg.XMLDesc(0), "/pool/@type")
|
||||
if storage_type == 'dir':
|
||||
name += '.' + image_extension
|
||||
name += '.img'
|
||||
alloc = 0
|
||||
else:
|
||||
alloc = size
|
||||
|
@ -70,6 +68,12 @@ class wvmCreate(wvmConnect):
|
|||
<allocation>%s</allocation>
|
||||
<target>
|
||||
<format type='%s'/>
|
||||
<permissions>
|
||||
<owner>107</owner>
|
||||
<group>107</group>
|
||||
<mode>0644</mode>
|
||||
<label>virt_image_t</label>
|
||||
</permissions>
|
||||
</target>
|
||||
</volume>""" % (name, size, alloc, image_format)
|
||||
stg.createXML(xml, metadata)
|
||||
|
@ -121,6 +125,12 @@ class wvmCreate(wvmConnect):
|
|||
<allocation>0</allocation>
|
||||
<target>
|
||||
<format type='%s'/>
|
||||
<permissions>
|
||||
<owner>107</owner>
|
||||
<group>107</group>
|
||||
<mode>0644</mode>
|
||||
<label>virt_image_t</label>
|
||||
</permissions>
|
||||
</target>
|
||||
</volume>""" % (clone, format)
|
||||
stg.createXMLFrom(xml, vol, metadata)
|
||||
|
|
Loading…
Reference in a new issue