Description of problem: when creating node device from xml,the result is failed(including xen and kvm host),which reasons is named error in libvirt.py,because domain and node use the same name "createXML" in class VirConnect(/usr/lib64/python2.4/site-packages/libvirt.py). Version-Release number of selected component (if applicable): [root@dhcp-66-70-18 libvirt]# uname -a Linux dhcp-66-70-18.nay.redhat.com 2.6.18-153.el5 #1 SMP Wed Jun 10 17:53:33 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux [root@dhcp-66-70-18 libvirt]# lsmod|grep kvm kvm_intel 85992 0 kvm 222368 2 ksm,kvm_intel [root@dhcp-66-70-18 libvirt]# rpm -qa|grep kvm kvm-qemu-img-83-76.el5 kvm-83-84.el5 etherboot-zroms-kvm-5.4.4-10.el5 kmod-kvm-83-76.el5 [root@dhcp-66-70-18 libvirt]# rpm -qa|grep libvirt libvirt-cim-0.5.5-2.el5 libvirt-0.6.3-14.el5 libvirt-python-0.6.3-14.el5 libvirt-debuginfo-0.6.3-14.el5 libvirt-devel-0.6.3-14.el5 How reproducible: 100% Steps to Reproduce: [root@dhcp-66-70-18 libvirt]# python Python 2.4.3 (#1, Sep 17 2008, 16:07:08) [GCC 4.1.2 20071124 (Red Hat 4.1.2-41)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import libvirt >>> conn=libvirt.open(None) >>> dev=conn.nodeDeviceLookupByName("storage_model_DVD__RW_DH_16A6S") >>> dir(dev) ['XMLDesc', '__del__', '__doc__', '__init__', '__module__', '_conn', '_o', 'destroy', 'dettach', 'listCaps', 'name', 'numOfCaps', 'parent', 'reAttach', 'ref', 'reset'] >>> dev.nodeDeviceLookupByName("storage_model_DVD__RW_DH_16A6S") Traceback (most recent call last): File "<stdin>", line 1, in ? AttributeError: virNodeDevice instance has no attribute 'nodeDeviceLookupByName' >>> dev.name() 'storage_model_DVD__RW_DH_16A6S' >>> devxml=dev.XMLDesc(0) >>> print devxml <device> <name>storage_model_DVD__RW_DH_16A6S</name> <parent>pci_8086_2922_scsi_host_3_scsi_device_lun0</parent> <capability type='storage'> <block>/dev/scd0</block> <bus>scsi</bus> <drive_type>cdrom</drive_type> <model>DVD+-RW DH-16A6S</model> <vendor>PLDS</vendor> <capability type='removable'> <media_available>0</media_available> <media_size>0</media_size> </capability> </capability> </device> >>> conn.createXML(devxml,0) libvir: Domain Config error : internal error incorrect root element Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib64/python2.4/site-packages/libvirt.py", line 994, in createXML if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self) libvirt.libvirtError: internal error incorrect root element Actual results: use the same name "createXML" in creating domain and node device Expected results: use different name Additional info:
yup problem from python/generator.py creating in the class virConnect: [...] def createXML(self, xmlDesc, flags): """Create a new device on the VM host machine, for example, virtual HBAs created using vport_create. """ ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags) if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self) __tmp = virNodeDevice(self, _obj=ret) return __tmp def createXML(self, xmlDesc, flags): """Launch a new guest domain, based on an XML description similar to the one returned by virDomainGetXMLDesc() This function may requires privileged access to the hypervisor. The domain is not persistent, so its definition will disappear when it is destroyed, or if the host is restarted (see virDomainDefineXML() to define persistent domains). """ ret = libvirtmod.virDomainCreateXML(self._o, xmlDesc, flags) if ret is None:raise libvirtError('virDomainCreateXML() failed', conn=self) __tmp = virDomain(self,_obj=ret) return __tmp two methods with the same name for different libvirt entry points. After applying the fix from upstream for the nameFixup() function in generator.py, the virNodeDeviceCreateXML entry point is now mapped to the following method: def nodeDeviceCreateXML(self, xmlDesc, flags): """Create a new device on the VM host machine, for example, virtual HBAs created using vport_create. """ ret = libvirtmod.virNodeDeviceCreateXML(self._o, xmlDesc, flags) if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self) __tmp = virNodeDevice(self, _obj=ret) return __tmp Daniel
Created attachment 369911 [details] patch for python generator and generated output This is directly backported from upstream current code, Daniel
libvirt-0.6.3-25.el5 has been built in dist-5E-qu-candidate with the fix, Daniel
This bug has been verified with libvirt 0.6.3-25.el5 on RHEL-5.4. Already fixed, set status to VERIFIED.
This bug has been verified with libvirt 0.6.3-25.el5 on RHEL-5.5.Already fixed, set status to VERIFIED. The same name "createXML" error has been fixed,but I met another error when creating a node device from xml: "libvir: Node Device error : this function is not supported by the hypervisor: Device is not a fibre channel HBA" I think that it should be another bug: https://bugzilla.redhat.com/show_bug.cgi?id=510426 Version-Release number of selected component (if applicable): [root@dhcp-66-70-62 ~]# uname -a Linux dhcp-66-70-62.nay.redhat.com 2.6.18-183.el5xen #1 SMP Mon Dec 21 18:46:14 EST 2009 x86_64 x86_64 x86_64 GNU/Linux [root@dhcp-66-70-62 ~]# rpm -qa|grep libvirt libvirt-0.6.3-25.el5 libvirt-python-0.6.3-25.el5 libvirt-debuginfo-0.6.3-25.el5 [root@dhcp-66-70-62 ~]# rpm -qa|grep xen xen-libs-3.0.3-102.el5 xen-devel-3.0.3-102.el5 kmod-gnbd-xen-0.1.5-2.el5 kmod-gfs-xen-0.1.34-9.el5 xen-3.0.3-102.el5 xen-libs-3.0.3-102.el5 kernel-xen-2.6.18-183.el5 kmod-cmirror-xen-0.1.22-3.el5 Steps to Reproduce: [root@dhcp-66-70-62 ~]# python Python 2.4.3 (#1, Jun 11 2009, 14:09:37) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import libvirt >>> conn = libvirt.open(None) >>> caps = conn.getCapabilities() >>> conn.listDevices(caps, 0) [] >>> conn.numOfDevices(caps, 0) 0 >>> dev = conn.nodeDeviceLookupByName("storage_model_DVD__RW_DH_16A6S") >>> devxml = dev.XMLDesc(0) >>> print devxml <device> <name>storage_model_DVD__RW_DH_16A6S</name> <parent>pci_8086_2922_scsi_host_3_scsi_device_lun0</parent> <capability type='storage'> <block>/dev/scd0</block> <bus>pci</bus> <drive_type>cdrom</drive_type> <model>DVD+-RW DH-16A6S</model> <vendor>PLDS</vendor> <capability type='removable'> <media_available>0</media_available> <media_size>0</media_size> </capability> </capability> </device> >>> node = conn.nodeDeviceCreateXML(devxml, 0) libvir: Node Device error : this function is not supported by the hypervisor: Device is not a fibre channel HBA Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib64/python2.4/site-packages/libvirt.py", line 1162, in nodeDeviceCreateXML if ret is None:raise libvirtError('virNodeDeviceCreateXML() failed', conn=self) libvirt.libvirtError: this function is not supported by the hypervisor: Device is not a fibre channel HBA
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2010-0205.html