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

Chip Vincent cvincent at linux.vnet.ibm.com
Thu Oct 13 12:37:45 UTC 2011


# ll /var/lib/libvirt/images
total 16844232
-rw------- 1 root root     372736 Sep 30 14:21 cdrom01.iso
-rw------- 1 root root     372736 Sep 30 14:21 cdrom02.iso


After extracting the .iso files and applying both patches, I get the 
following error:

Testing KVM hypervisor
--------------------------------------------------------------------
VirtualSystemManagementService - 32_modify_cdrom_media.py: FAIL
ERROR 	- New media '/var/lib/libvirt/images/cdrom01.iso' does not match 
expected ''
ERROR 	- TypeError : 'NoneType' object is unsubscriptable
Traceback (most recent call last):
   File 
"/home/cvincent/proj/dev/tmp/cimtest/suites/libvirt-cim/lib/XenKvmLib/const.py", 
line 141, in do_try
     rc = f()
   File "32_modify_cdrom_media.py", line 209, in main
     inst = modify_media(cim, inst, media_path)
   File "32_modify_cdrom_media.py", line 100, in modify_media
     val = set_device_addr(inst, addr)
   File "32_modify_cdrom_media.py", line 83, in set_device_addr
     inst["InstanceID"],
TypeError: 'NoneType' object is unsubscriptable
ERROR 	- None
--------------------------------------------------------------------


On 09/30/2011 02:59 PM, Eduardo Lima (Etrunko) wrote:
>   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')
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim

-- 
Chip Vincent
Open Virtualization
IBM Linux Technology Center
cvincent at linux.vnet.ibm.com




More information about the Libvirt-cim mailing list