1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

added new feature: create and attach new volume to existing instance

move wvmCreate.get_cache_modes() to wvmConnect

add wvmConnect.get_busses(), wvmConnect.get_image_formats(), used in forms

add corresponding default values to settings (INSTANCE_VOLUME_DEFAULT_FORMAT INSTANCE_VOLUME_DEFAULT_BUS INSTANCE_VOLUME_DEFAULT_CACHE)
This commit is contained in:
Ing. Jan KRCMAR 2017-07-19 15:34:03 +02:00
parent b095a77da5
commit 53f5518706
6 changed files with 170 additions and 15 deletions

View file

@ -48,23 +48,12 @@ class wvmCreate(wvmConnect):
"""Get guest capabilities"""
return util.get_xml_path(self.get_cap_xml(), "/capabilities/host/cpu/arch")
def get_cache_modes(self):
"""Get cache available modes"""
return {
'default': 'Default',
'none': 'Disabled',
'writethrough': 'Write through',
'writeback': 'Write back',
'directsync': 'Direct sync', # since libvirt 0.9.5
'unsafe': 'Unsafe', # since libvirt 0.9.7
}
def create_volume(self, storage, name, size, format='qcow2', metadata=False):
def create_volume(self, storage, name, size, format='qcow2', metadata=False, image_extension='img'):
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 += '.img'
name += '.' + image_extension
alloc = 0
else:
alloc = size