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
|
|
@ -340,6 +340,22 @@ class wvmInstance(wvmConnect):
|
|||
xmldom = ElementTree.tostring(tree)
|
||||
self._defineXML(xmldom)
|
||||
|
||||
def attach_disk(self, source, target, sourcetype='file', type='disk', driver='qemu', subdriver='raw', cache='none', targetbus='ide'):
|
||||
tree = ElementTree.fromstring(self._XMLDesc(0))
|
||||
xml_disk = """
|
||||
<disk type='%s' device='%s'>
|
||||
<driver name='%s' type='%s' cache='%s'/>
|
||||
<source file='%s'/>
|
||||
<target dev='%s' bus='%s'/>
|
||||
</disk>
|
||||
""" % (sourcetype, type, driver, subdriver, cache, source, target, targetbus)
|
||||
if self.get_status() == 5:
|
||||
devices = tree.find('devices')
|
||||
elm_disk = ElementTree.fromstring(xml_disk)
|
||||
devices.append(elm_disk)
|
||||
xmldom = ElementTree.tostring(tree)
|
||||
self._defineXML(xmldom)
|
||||
|
||||
def cpu_usage(self):
|
||||
cpu_usage = {}
|
||||
if self.get_status() == 1:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue