[Libvirt-cim] [PATCH 2 of 2] [TEST] XenKvmLib: Add cdrom device description to domain

Eduardo Lima (Etrunko) eblima at linux.vnet.ibm.com
Fri Sep 30 18:59:42 UTC 2011


 suites/libvirt-cim/lib/XenKvmLib/const.py |   1 +
 suites/libvirt-cim/lib/XenKvmLib/vxml.py  |  15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)


# HG changeset patch
# User Eduardo Lima (Etrunko) <eblima at br.ibm.com>
# Date 1317408948 10800
# Node ID f4bcd9833525c6914f61e29e9d2d8adbac240682
# Parent  eac4909ac68adc28cad9cb6389ea93a053b23aec
[TEST] XenKvmLib: Add cdrom device description to domain

The default domain created by libvirt-cim did not include a cdrom device,
which is required by a new test for VirtualSystemManagementService.

Signed-off-by: Eduardo Lima (Etrunko) <eblima at br.ibm.com>

diff --git a/suites/libvirt-cim/lib/XenKvmLib/const.py b/suites/libvirt-cim/lib/XenKvmLib/const.py
--- a/suites/libvirt-cim/lib/XenKvmLib/const.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/const.py
@@ -87,6 +87,7 @@
 KVM_disk_path = os.path.join(_image_dir, 'default-kvm-dimage')
 KVM_secondary_disk_path = os.path.join(_image_dir, 'default-kvm-dimage.2ND')
 KVM_default_disk_dev = 'hda'
+KVM_default_cdrom_dev = 'hdc'
 KVM_default_mac = '11:22:33:aa:bb:cc'
 
 # vxml.XenFVXML
diff --git a/suites/libvirt-cim/lib/XenKvmLib/vxml.py b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
--- a/suites/libvirt-cim/lib/XenKvmLib/vxml.py
+++ b/suites/libvirt-cim/lib/XenKvmLib/vxml.py
@@ -628,6 +628,12 @@
         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)
     def cim_define(self, ip, ref_conf=None):
         service = vsms.get_vsms_class(self.virt)(ip)
         sys_settings = str(self.vssd)
@@ -645,6 +651,10 @@
             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:
@@ -941,6 +951,11 @@
         disk = self.add_sub_node(devices, 'disk', type='file', device='disk')
         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',
                           keymap='en-us')




More information about the Libvirt-cim mailing list