1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-24 15:15:22 +00:00

Remove cache tag for if device type is cdrom from add function.

This commit is contained in:
catborise 2019-01-29 09:29:52 +03:00
parent e28cc71710
commit 4b6ab68e7f

View file

@ -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)