mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Remove cache tag for if device type is cdrom from add function.
This commit is contained in:
parent
e28cc71710
commit
4b6ab68e7f
1 changed files with 7 additions and 5 deletions
|
@ -479,13 +479,15 @@ class wvmInstance(wvmConnect):
|
||||||
|
|
||||||
def attach_disk(self, source, target, sourcetype='file', device='disk', driver='qemu', subdriver='raw', cache='none', targetbus='ide'):
|
def attach_disk(self, source, target, sourcetype='file', device='disk', driver='qemu', subdriver='raw', cache='none', targetbus='ide'):
|
||||||
tree = ElementTree.fromstring(self._XMLDesc(0))
|
tree = ElementTree.fromstring(self._XMLDesc(0))
|
||||||
xml_disk = """
|
xml_disk = "<disk type='%s' device='%s'>" % (sourcetype, device)
|
||||||
<disk type='%s' device='%s'>
|
if device == 'cdrom':
|
||||||
<driver name='%s' type='%s' cache='%s'/>
|
xml_disk += "<driver name='%s' type='%s'/>" % (driver, subdriver)
|
||||||
<source file='%s'/>
|
elif device == 'disk':
|
||||||
|
xml_disk += "<driver name='%s' type='%s' cache='%s'/>" % (driver, subdriver, cache)
|
||||||
|
xml_disk += """<source file='%s'/>
|
||||||
<target dev='%s' bus='%s'/>
|
<target dev='%s' bus='%s'/>
|
||||||
</disk>
|
</disk>
|
||||||
""" % (sourcetype, device, driver, subdriver, cache, source, target, targetbus)
|
""" % (source, target, targetbus)
|
||||||
if self.get_status() == 5:
|
if self.get_status() == 5:
|
||||||
devices = tree.find('devices')
|
devices = tree.find('devices')
|
||||||
elm_disk = ElementTree.fromstring(xml_disk)
|
elm_disk = ElementTree.fromstring(xml_disk)
|
||||||
|
|
Loading…
Reference in a new issue