Hide Forgot
Description of problem: The current libvirt upstream commit 448be8f7 has implemented dumping max vports and vports in use for HBA's XML, and it's backported to libvirt rhel7.0 downstream, but the libvirt rhel6.5 is missing the patch. Except this, it will be more convenient to create vHBA for users if they can know connectivity of the port. In addition, if the port state is Linkdown/Offline then users will hit error like "error: Write of 'XXXX:XXXX' to '/sys/class/fc_host/host$NUM/vport_create' during vport create/delete failed: Operation not supported", it's also not friendly for users. Version-Release number of selected component (if applicable): rpm -q libvirt kernel libvirt-0.10.2-29.el6.x86_64 kernel-2.6.32-288.el6.x86_64 How reproducible: always Steps to Reproduce: 1. # cat /tmp/check_vhba.sh for i in $(virsh nodedev-list --cap scsi_host); do if virsh nodedev-dumpxml $i | grep vport_ops > /dev/null; then echo $i; fi done 2. # sh /tmp/check_vhba.sh scsi_host4 scsi_host5 3. # cat /tmp/vhba.scsi_host4.xml <device> <parent>scsi_host4</parent> <capability type='scsi_host'> <capability type='fc_host'> </capability> </capability> </device> 4. # virsh nodedev-create /tmp/vhba.scsi_host4.xml error: Failed to create node device from /tmp/vhba.scsi_host4.xml error: Write of '5001a4a94a1c33d0:5001a4ae1b949893' to '/sys/class/fc_host/host4/vport_create' during vport create/delete failed: Operation not supported Notes, to improve error message and show port state. 5. # cat /tmp/vhba.scsi_host5.xml <device> <parent>scsi_host5</parent> <capability type='scsi_host'> <capability type='fc_host'> </capability> </capability> </device> 6. # virsh nodedev-create /tmp/vhba.scsi_host5.xml Node device scsi_host6 created from /tmp/vhba.scsi_host5.xml Actual results: please see above Expected results: Can dump max vports, vports and port state and improve error message for creating device on Linkdown/Offline port. Additional info: # virsh nodedev-dumpxml scsi_host4 <device> <name>scsi_host4</name> <parent>pci_0000_04_00_0</parent> <capability type='scsi_host'> <host>4</host> <capability type='fc_host'> <wwnn>2000001b3289da4e</wwnn> <wwpn>2100001b3289da4e</wwpn> <fabric_wwn>ffffffff</fabric_wwn> </capability> <capability type='vport_ops' /> </capability> </device> # 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>2001001b32a9da4e</wwnn> <wwpn>2101001b32a9da4e</wwpn> <fabric_wwn>2001000dec9877c1</fabric_wwn> </capability> <capability type='vport_ops' /> </capability> </device> Notes, to show max_vports, vports and port_state. # virsh nodedev-dumpxml scsi_host6 <device> <name>scsi_host6</name> <parent>scsi_host5</parent> <capability type='scsi_host'> <host>9</host> <capability type='fc_host'> <wwnn>5001a4a3551abf31</wwnn> <wwpn>5001a4a408e2e86b</wwpn> <fabric_wwn>ffffffff</fabric_wwn> </capability> </capability> </device> Notes, the fabric_wwn of the scsi_host6 inherits scsi_host4 not scsi_host5, is it an expected result? in addition, the 'ffffffff' means the port isn't available or offline? or we also need to check '/sys/class/fc_host/host$NUM/port_state' to make sure connectivity of the port. # git show 448be8f7 commit 448be8f706693327d77756fb47aa275edfb14977 Author: Osier Yang <jyang> Date: Tue Jan 8 01:05:32 2013 +0800 nodedev: Dump max vports and vports in use for HBA's XML This enrichs HBA's xml by dumping the number of max vports and vports in use. Format is like: <capability type='vport_ops'> <max_vports>164</max_vports> <vports>5</vports> </capability> * docs/formatnode.html.in: (Document the new XML) * docs/schemas/nodedev.rng: (Add the schema) * src/conf/node_device_conf.h: (New member for data.scsi_host) * src/node_device/node_device_linux_sysfs.c: (Collect the value of max_vports and vports)
*** This bug has been marked as a duplicate of bug 997756 ***