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

Wayne Xia xiawenc at linux.vnet.ibm.com
Fri Oct 14 07:50:53 UTC 2011


于 2011-10-13 20:37, Chip Vincent 写道:
> # 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
> --------------------------------------------------------------------
>
strange, I think the case failed in the switch phase:
cdrom01.iso->empty->cdrom2.iso.

ERROR - TypeError : 'NoneType' object is unsubscriptable
seems related to a python grammar issue, maybe it is caused by
python version, what is it on your PC?

Mine version:
python 2.6.6
Distro: Red Hat Enterprise Linux Server release 6.0 (Santiago)
Kernel: 2.6.32-71.el6.x86_64
libvirt: 0.9.4
Hypervisor: QEMU 0.14.50
CIMOM: Pegasus 2.9.1
Libvirt-cim revision: 1152
Libvirt-cim changeset: 2714b9a5e842+
Cimtest revision: 881
Cimtest changeset: a550ae7da806


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


-- 
Best Regards

Wayne Xia
mail:xiawenc at linux.vnet.ibm.com
tel:86-010-82450803




More information about the Libvirt-cim mailing list