Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 593995 - [NPIV] <parent> is 'computer' in nodedev-dumpxml after I created nodedev using parent=scsi_host5(not computer)
Summary: [NPIV] <parent> is 'computer' in nodedev-dumpxml after I created nodedev usin...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: libvirt
Version: 6.0
Hardware: All
OS: Linux
high
high
Target Milestone: rc
: ---
Assignee: Dave Allan
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 599016
TreeView+ depends on / blocked
 
Reported: 2010-05-20 09:56 UTC by dyuan
Modified: 2016-04-26 13:40 UTC (History)
7 users (show)

Fixed In Version: libvirt-0_8_1-10_el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-11 14:47:55 UTC
Target Upstream Version:


Attachments (Terms of Use)
node device tree after patch (deleted)
2010-05-27 22:15 UTC, Dave Allan
no flags Details
node device tree before patch (deleted)
2010-05-27 22:15 UTC, Dave Allan
no flags Details

Description dyuan 2010-05-20 09:56:52 UTC
Description of problem:
nodedev-create from xml, <parent> point to 'scsi_host5', but when I execute nodedev-dumpxml, the <parent> shows 'computer'.

it works fine in rhel5u5. 

Version-Release number of selected component (if applicable):
kernel-2.6.32-27.el6.x86_64
qemu-kvm-0.12.1.2-2.59.el6.x86_64
libvirt-0.8.1-5.el6.x86_64

How reproducible:
100%

Steps to Reproduce:

prepare:
# cd /sys/class/fc_host/
[root@amd-1352-8-3 fc_host]# ls
host4  host5
# virsh nodedev-list --cap=scsi_host
scsi_host0
scsi_host1
scsi_host2
scsi_host3
scsi_host4
scsi_host5

# virsh nodedev-dumpxml scsi_host5
<device>
  <name>scsi_host5</name>
  <parent>pci_0000_04_00_1</parent>
  <capability type='scsi_host'>
    <host>5</host>
    <capability type='fc_host'>
      <wwnn>2001001b32a9f25b</wwnn>
      <wwpn>2101001b32a9f25b</wwpn>
    </capability>
    <capability type='vport_ops' />
  </capability>
</device>


1. create using 'echo', the <parent> is computer.

# echo '2101001b32a9f2aa:2001001b32a9f25b' > /sys/class/fc_host/host5/vport_create 

# ls /sys/class/fc_host/
host4  host5  host6

# virsh nodedev-dumpxml scsi_host6
<device>
  <name>scsi_host6</name>
  <parent>computer</parent>
  <capability type='scsi_host'>
    <host>6</host>
    <capability type='fc_host'>
      <wwnn>2001001b32a9f25b</wwnn>
      <wwpn>2101001b32a9f2aa</wwpn>
    </capability>
  </capability>
</device>


2. create a file newhba.xml using <parent>=computer, create from xml with error: 'Parent HBA computer is not capable of vport operations'

# cat /tmp/newhba.xml 
<device>
<parent>computer</parent>
<capability type='scsi_host'>
<capability type='fc_host'>
<wwnn>2001001b32a9f25b</wwnn>
<wwpn>2101001b32a9f2bb</wwpn>
</capability>
</capability>
</device>

# virsh nodedev-create /tmp/newhba.xml 
error: Failed to create node device from /tmp/newhba.xml
error: internal error Parent HBA computer is not capable of vport operations


3. edit the file newhba.xml using <parent>=pci_0000_04_00_1 which is the same as scsi_host5, create from xml with error: 'internal error Parent HBA pci_0000_04_00_1 is not capable of vport operations'
  

4. edit the file newhba.xml using <parent>=scsi_host5, create from xml, then dumpxml with scsi_host7, the <parent> point to 'computer' too.

# cat /tmp/newhba.xml 
<device>
<parent>scsi_host5</parent>
<capability type='scsi_host'>
<capability type='fc_host'>
<wwnn>2001001b32a9f25b</wwnn>
<wwpn>2101001b32a9f2bb</wwpn>
</capability>
</capability>
</device>

[root@amd-1352-8-3 fc_host]# virsh nodedev-create /tmp/newhba.xml 
Node device scsi_host7 created from /tmp/newhba.xml


# virsh nodedev-dumpxml scsi_host7
<device>
  <name>scsi_host7</name>
  <parent>computer</parent>
  <capability type='scsi_host'>
    <host>7</host>
    <capability type='fc_host'>
      <wwnn>2001001b32a9f25b</wwnn>
      <wwpn>2101001b32a9f2bb</wwpn>
    </capability>
  </capability>
</device>


Actual results:


Expected results:
in rhel5 , the parent in nodedev-dumpxml will be the same as which it create from.


Additional info:

# tail -f /var/log/messages
May 20 17:46:06 amd-1352-8-3 libvirtd: 17:46:06.866: error : virNodeDeviceGetParentHost:1333 : internal error Parent HBA computer is not capable of vport operations
May 20 17:46:37 amd-1352-8-3 libvirtd: 17:46:37.078: error : virNodeDeviceGetParentHost:1333 : internal error Parent HBA pci_0000_04_00_1 is not capable of vport operations
May 20 17:47:05 amd-1352-8-3 kernel: qla2xxx 0000:04:00.1: VP entry id 3 assigned.
May 20 17:47:05 amd-1352-8-3 kernel: scsi8 : qla2xxx
May 20 17:47:05 amd-1352-8-3 kernel: scsi host5: vport-5:0-2 created via shost5 channel 0


# virsh nodedev-list --tree

  +- pci_0000_00_0d_0
  |   |
  |   +- pci_0000_04_00_0
  |   |   |
  |   |   +- scsi_host4
  |   |     
  |   +- pci_0000_04_00_1
  |       |
  |       +- scsi_host5
  |         
  +- pci_0000_00_0e_0
  +- pci_0000_00_18_0
  +- pci_0000_00_18_1
  +- pci_0000_00_18_2
  +- pci_0000_00_18_3
  +- pci_0000_00_18_4
  +- scsi_host6
  +- scsi_host7

Comment 2 Dave Allan 2010-05-27 22:12:29 UTC
This behavior is partially due to the change from HAL to udev for the node device information.  The device parent information is simply being reported by libvirt; we get that information from the underlying subsystem, so we're dependent on what is reported to us for parent/child relationships.

udev reports a huge number of devices, many of which are not important to libvirt users, so we don't include them in the node device tree.  The existing code simply sets the parent to "computer" when it finds a parent it doesn't want to display.  That makes for a pretty ugly tree display, and I've submitted a patch upstream to make the parent of a device the first device in the tree that we do want to display, and I think the display is a lot better for it.  I'm attaching output before and after my fix to this BZ.

Having said that, the PCI device being reported by HAL for the parent is incorrect: the parent of a vHBA is the scsi_host on which it's created, not the PCI device.  udev reports the parent correctly as the scsi host, so that's what's reported as the parent after my fix is applied.  libvirt doesn't guarantee stability of names or the stability of parent/child relationships.

I've submitted a patch upstream.

Comment 3 Dave Allan 2010-05-27 22:15:16 UTC
Created attachment 417405 [details]
node device tree after patch

Comment 4 Dave Allan 2010-05-27 22:15:44 UTC
Created attachment 417406 [details]
node device tree before patch

Comment 5 Dave Allan 2010-05-28 19:25:02 UTC
I have committed the patch upstream, commit 8b46a7bbdbf19775a4825d24f0ad6cf36acb58d0

Comment 7 Dave Allan 2010-06-23 21:28:39 UTC
libvirt-0_8_1-10_el6 has been built in RHEL-6-candidate with the fix.

Dave

Comment 8 wangyimiao 2010-06-25 10:03:47 UTC
Verified this bug PASS with libvirt-0.8.1-10.el6.x86_64
- kernel-2.6.32-36.el6.x86_64
- qemu-img-0.12.1.2-2.80.el6.x86_64
- qemu-kvm-0.12.1.2-2.80.el6.x86_64

Comment 9 releng-rhel@redhat.com 2010-11-11 14:47:55 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.


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