mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 15:15:22 +00:00
volume filename extension converted to choosable with settings. And file extensions reorganized.
This commit is contained in:
parent
73ce98b63e
commit
4769c5cf1b
2 changed files with 11 additions and 2 deletions
|
@ -399,6 +399,10 @@ class wvmConnect(object):
|
||||||
"""Get available image formats"""
|
"""Get available image formats"""
|
||||||
return [ 'raw', 'qcow', 'qcow2' ]
|
return [ 'raw', 'qcow', 'qcow2' ]
|
||||||
|
|
||||||
|
def get_file_extensions(self):
|
||||||
|
"""Get available image filename extensions"""
|
||||||
|
return [ 'img', 'qcow', 'qcow2' ]
|
||||||
|
|
||||||
def get_iface(self, name):
|
def get_iface(self, name):
|
||||||
return self.wvm.interfaceLookupByName(name)
|
return self.wvm.interfaceLookupByName(name)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ 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
|
||||||
|
|
||||||
|
|
||||||
def get_rbd_storage_data(stg):
|
def get_rbd_storage_data(stg):
|
||||||
|
@ -21,6 +23,9 @@ 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
|
||||||
|
|
||||||
def get_storages_images(self):
|
def get_storages_images(self):
|
||||||
"""
|
"""
|
||||||
Function return all images on all storages
|
Function return all images on all storages
|
||||||
|
@ -30,7 +35,7 @@ class wvmCreate(wvmConnect):
|
||||||
for storage in storages:
|
for storage in storages:
|
||||||
stg = self.get_storage(storage)
|
stg = self.get_storage(storage)
|
||||||
if not stg.isActive():
|
if not stg.isActive():
|
||||||
pass
|
continue
|
||||||
try:
|
try:
|
||||||
stg.refresh(0)
|
stg.refresh(0)
|
||||||
except:
|
except:
|
||||||
|
@ -50,7 +55,7 @@ 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, format='qcow2', metadata=False, image_extension='img'):
|
def create_volume(self, storage, name, size, format=image_format, metadata=False, image_extension=image_extension):
|
||||||
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")
|
||||||
|
|
Loading…
Reference in a new issue