Bug 510427 - creating node device error
Summary: creating node device error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: libvirt
Version: 5.4
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Daniel Veillard
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-07-09 08:31 UTC by Alex Jia
Modified: 2010-03-30 08:09 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-03-30 08:09:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
patch for python generator and generated output (4.35 KB, patch)
2009-11-17 16:23 UTC, Daniel Veillard
no flags Details | Diff


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2010:0205 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2010-03-29 12:27:37 UTC

Description Alex Jia 2009-07-09 08:31:30 UTC
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:

Comment 1 Daniel Veillard 2009-11-17 16:21:53 UTC
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

Comment 2 Daniel Veillard 2009-11-17 16:23:38 UTC
Created attachment 369911 [details]
patch for python generator and generated output

This is directly backported from upstream current code,

Daniel

Comment 3 Daniel Veillard 2009-12-15 15:49:30 UTC
libvirt-0.6.3-25.el5 has been built in dist-5E-qu-candidate with the fix,

Daniel

Comment 5 Alex Jia 2009-12-16 08:50:32 UTC
This bug has been verified with libvirt 0.6.3-25.el5 on RHEL-5.4. Already
fixed, set status to VERIFIED.

Comment 6 Alex Jia 2009-12-29 09:02:12 UTC
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

Comment 11 errata-xmlrpc 2010-03-30 08:09:43 UTC
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


Note You need to log in before you can comment on or make changes to this bug.