From: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
This test depended on some modifications in the core classes that resulted in
many other tests failing. This patch fixed this issue by moving the necessary
bits to the testcase itself.
Signed-off-by: Eduardo Lima (Etrunko) <eblima(a)br.ibm.com>
---
.../32_modify_cdrom_media.py | 16 +++++++++++++++-
suites/libvirt-cim/lib/XenKvmLib/vxml.py | 17 +++--------------
2 files changed, 18 insertions(+), 15 deletions(-)
diff --git
a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/32_modify_cdrom_media.py
b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/32_modify_cdrom_media.py
index 9b42831..ff9d034 100755
--- a/suites/libvirt-cim/cimtest/VirtualSystemManagementService/32_modify_cdrom_media.py
+++ b/suites/libvirt-cim/cimtest/VirtualSystemManagementService/32_modify_cdrom_media.py
@@ -32,9 +32,10 @@ import pywbem
from CimTest.ReturnCodes import PASS, FAIL, XFAIL, SKIP
from CimTest.Globals import logger, CIM_USER, CIM_PASS, CIM_NS
-from XenKvmLib.const import do_main, _image_dir
+from XenKvmLib.const import do_main, _image_dir, KVM_default_cdrom_dev
from XenKvmLib.classes import get_typed_class
from XenKvmLib.vxml import get_class
+from XenKvmLib import vsms
supported = ['KVM',]
@@ -49,6 +50,19 @@ class CIMDomain(object):
self.server = server
self.virt = virt
self._domain = get_class(virt)(name)
+
+ # CIM Instance for cdrom
+ dasd = vsms.get_dasd_class(virt)
+ cdrom_dasd = dasd(dev=KVM_default_cdrom_dev, source="",
+ name=name, emu_type=1)
+ self._domain.res_settings.append(str(cdrom_dasd))
+
+ # cdrom XML description
+ devices = self._domain.get_node('/domain/devices')
+ cdrom = self._domain.add_sub_node(devices, 'disk', type='file',
+ device='cdrom')
+ self._domain.add_sub_node(cdrom, 'source', file="")
+ self._domain.add_sub_node(cdrom, 'target', dev=KVM_default_cdrom_dev)
#__init__
def define(self):
diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py
b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
index 6790036..15859c1 100644
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
@@ -628,17 +628,13 @@ class VirtCIM:
self.iasd = vsms.get_iasd_class(virt)(name=dom_name,
res_sub_type=irstype,
bus_type=btype)
- if virt == "KVM":
- dasd = vsms.get_dasd_class(virt)
- self.cdrom_dasd = dasd(dev=const.KVM_default_cdrom_dev,
- source="",
- name=dom_name,
- emu_type=1)
+ self.res_settings = []
+
def cim_define(self, ip, ref_conf=None):
service = vsms.get_vsms_class(self.virt)(ip)
sys_settings = str(self.vssd)
- res_settings = []
+ res_settings = self.res_settings
if self.dasd is not None:
res_settings.append(str(self.dasd))
if self.pasd is not None:
@@ -651,10 +647,6 @@ class VirtCIM:
else:
res_settings.append(str(self.nasd))
- # CDROM device
- if self.virt == "KVM":
- res_settings.append(str(self.cdrom_dasd))
-
curr_cim_rev, changeset = get_provider_version(self.virt, ip)
if curr_cim_rev >= vsms_graphics_sup:
if self.gasd is not None:
@@ -952,9 +944,6 @@ class KVMXML(VirtXML, VirtCIM):
self.add_sub_node(disk, 'source', file=disk_img)
self.add_sub_node(disk, 'target', dev=disk_dev)
- cdrom = self.add_sub_node(devices, 'disk', type='file',
device='cdrom')
- self.add_sub_node(cdrom, 'source', file="")
- self.add_sub_node(cdrom, 'target', dev=const.KVM_default_cdrom_dev)
self.add_sub_node(devices, 'input', type='mouse',
bus='ps2')
self.add_sub_node(devices, 'graphics', type='vnc',
port='5900',
--
1.7.4.4