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:
parent
b095a77da5
commit
53f5518706
6 changed files with 170 additions and 15 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue