Bug 992001 - get_node_device_scsihost_by_wwn will cause libvirt error.
get_node_device_scsihost_by_wwn will cause libvirt error.
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: perl-Sys-Virt (Show other bugs)
7.0
Unspecified Unspecified
medium Severity medium
: rc
: ---
Assigned To: John Ferlan
Virtualization Bugs
:
Depends On: 1140194
Blocks:
  Show dependency treegraph
 
Reported: 2013-08-04 23:05 EDT by zhe peng
Modified: 2016-04-26 10:36 EDT (History)
7 users (show)

See Also:
Fixed In Version: perl-Sys-Virt-1.2.8-1.el7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-03-05 05:53:50 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description zhe peng 2013-08-04 23:05:17 EDT
Description of problem:
Use libvirt-tck to testing libvirt api, when testing get_node_device_scsihost_by_wwn will get libvirt error.

Version-Release number of selected component (if applicable):
perl-Sys-Virt-1.1.1-1.el7.x86_64
libvirt-1.1.1-1.el7.x86_64


How reproducible:
always

Steps to Reproduce:
in libvirt tck,testing api:

my $dev = $vmm->get_node_device_scsihost_by_wwn($wwnn, $wwpn, $flags=0)

get error:
libvirt error code: 1, message: An error occurred, but the cause is unknown


Actual results:


Expected results:
return nodedev w/o error

Additional info:
python binding have same problem.
Comment 2 Dave Allan 2013-08-13 15:21:31 EDT
We also need expanded unit tests in this area.
Comment 4 Osier Yang 2013-11-20 09:39:39 EST
(In reply to zhe peng from comment #0)
> Description of problem:
> Use libvirt-tck to testing libvirt api, when testing
> get_node_device_scsihost_by_wwn will get libvirt error.
> 
> Version-Release number of selected component (if applicable):
> perl-Sys-Virt-1.1.1-1.el7.x86_64
> libvirt-1.1.1-1.el7.x86_64
> 
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> in libvirt tck,testing api:
> 
> my $dev = $vmm->get_node_device_scsihost_by_wwn($wwnn, $wwpn, $flags=0)
> 
> get error:
> libvirt error code: 1, message: An error occurred, but the cause is unknown
> 

Is the scsi host with the sepcified $wwnn/$wwpn existing on host?
Comment 5 zhe peng 2013-11-21 03:42:18 EST
yes
# virsh nodedev-dumpxml scsi_host4
<device>
  <name>scsi_host4</name>
  <path>/sys/devices/pci0000:00/0000:00:09.0/0000:18:00.1/host4</path>
  <parent>pci_0000_18_00_1</parent>
  <capability type='scsi_host'>
    <host>4</host>
    <capability type='fc_host'>
      <wwnn>20000024ff370479</wwnn>
      <wwpn>21000024ff370479</wwpn>
      <fabric_wwn>ffffffffffffffff</fabric_wwn>
    </capability>
    <capability type='vport_ops'>
      <max_vports>254</max_vports>
      <vports>0</vports>
    </capability>
  </capability>
</device>
Comment 6 Osier Yang 2013-11-21 07:58:00 EST
(In reply to zhe peng from comment #5)
> yes
> # virsh nodedev-dumpxml scsi_host4
> <device>
>   <name>scsi_host4</name>
>   <path>/sys/devices/pci0000:00/0000:00:09.0/0000:18:00.1/host4</path>
>   <parent>pci_0000_18_00_1</parent>
>   <capability type='scsi_host'>
>     <host>4</host>
>     <capability type='fc_host'>
>       <wwnn>20000024ff370479</wwnn>
>       <wwpn>21000024ff370479</wwpn>
>       <fabric_wwn>ffffffffffffffff</fabric_wwn>
>     </capability>
>     <capability type='vport_ops'>
>       <max_vports>254</max_vports>
>       <vports>0</vports>
>     </capability>
>   </capability>
> </device>

I don't have a NPIV box in hand to do the testing. But per the testing by timesu in BZ 

<quote>
> Test commands nodedev-destroy and nodedev-dumpxml can work with the
> wwnn,wwpn paremeter
> 
> nodedev-dumpxml:
> 
> #virsh nodedev-dumpxml --device 2000001b3289da4e,2100001b3289da4e
> <device>
> <name>scsi_host4</name>
> <path>/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.0/host4</path>
> <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>2001000dec987841</fabric_wwn>
> </capability>
> <capability type='vport_ops'>
> <max_vports>127</max_vports>
> <vports>0</vports>
> </capability>
> </capability>
> </device>
</quote>

Note that if you specify the device for "nodedev-dumpxml" by "wwnn,wwpn", it uses virNodeDeviceLookupSCSIHostByWWN.
Comment 7 Osier Yang 2013-11-21 08:04:15 EST
(In reply to Osier Yang from comment #6)
> (In reply to zhe peng from comment #5)
> > yes
> > # virsh nodedev-dumpxml scsi_host4
> > <device>
> >   <name>scsi_host4</name>
> >   <path>/sys/devices/pci0000:00/0000:00:09.0/0000:18:00.1/host4</path>
> >   <parent>pci_0000_18_00_1</parent>
> >   <capability type='scsi_host'>
> >     <host>4</host>
> >     <capability type='fc_host'>
> >       <wwnn>20000024ff370479</wwnn>
> >       <wwpn>21000024ff370479</wwpn>
> >       <fabric_wwn>ffffffffffffffff</fabric_wwn>
> >     </capability>
> >     <capability type='vport_ops'>
> >       <max_vports>254</max_vports>
> >       <vports>0</vports>
> >     </capability>
> >   </capability>
> > </device>
> 
> I don't have a NPIV box in hand to do the testing. But per the testing by
> timesu in BZ 
> 
> <quote>
> > Test commands nodedev-destroy and nodedev-dumpxml can work with the
> > wwnn,wwpn paremeter
> > 
> > nodedev-dumpxml:
> > 
> > #virsh nodedev-dumpxml --device 2000001b3289da4e,2100001b3289da4e
> > <device>
> > <name>scsi_host4</name>
> > <path>/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.0/host4</path>
> > <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>2001000dec987841</fabric_wwn>
> > </capability>
> > <capability type='vport_ops'>
> > <max_vports>127</max_vports>
> > <vports>0</vports>
> > </capability>
> > </capability>
> > </device>
> </quote>
> 
> Note that if you specify the device for "nodedev-dumpxml" by "wwnn,wwpn", it
> uses virNodeDeviceLookupSCSIHostByWWN.

Thanks for timesu left me a mail for the NPIV box. With my testing, it just works. 

>>> node = conn.nodeDeviceLookupSCSIHostByWWN("2001001b32a9da4e", "2101001b32a9da4e", 0)
>>> print node
<libvirt.virNodeDevice object at 0x7f1a1d997690>

That's why I asked if the device with $wwnn/$wwpn is existing. I admit that there is a problem that it should report error if the device doesn't exist. But it's not that important than failing to find the device if it's existing.
Comment 8 zhe peng 2013-11-22 00:52:35 EST
I re-test it, found only perl binding have this issue, python binding and libvirt worked well, so it's a perl-Sys-virt problem.
#virsh nodedev-dumpxml --device $wwnn,$wwpn
<device>
  <name>scsi_host4</name>
  <path>/sys/devices/pci0000:00/0000:00:09.0/0000:18:00.1/host4</path>
  <parent>pci_0000_18_00_1</parent>
  <capability type='scsi_host'>
    <host>4</host>
    <capability type='fc_host'>
      <wwnn>20000024ff370479</wwnn>
      <wwpn>21000024ff370479</wwpn>
      <fabric_wwn>ffffffffffffffff</fabric_wwn>
    </capability>
    <capability type='vport_ops'>
      <max_vports>254</max_vports>
      <vports>0</vports>
    </capability>
  </capability>
</device>
Comment 9 Osier Yang 2013-11-22 01:19:35 EST
(In reply to zhe peng from comment #8)
> I re-test it, found only perl binding have this issue, python binding and
> libvirt worked well, so it's a perl-Sys-virt problem.

Move to perl-Sys-Virt.
Comment 10 Osier Yang 2013-11-28 02:56:50 EST
Patch pushed in upstream:

commit a7f5eb3ae71cd8b8846f1581e9d21da4f7880cf1
Author: Osier Yang <jyang@redhat.com>
Date:   Wed Nov 27 15:00:27 2013 +0800

    libvirt-perl: Fix the wrong binding of virNodeDeviceLookupSCSIHostByWWN
    
    The second parameter for virNodeDeviceLookupSCSIHostByWWN is "wwnn"
    instead of "wwpn", and the API supports "flags".
Comment 12 John Ferlan 2014-09-10 10:25:21 EDT
Once bz 1140194 is resolved with the upstream libvirt-perl 1.2.8 bindings rebased into perl-Sys-Virt, this bug will be resolved.
Comment 14 zhe peng 2014-11-04 01:47:59 EST
veriy with build:
perl-Sys-Virt-1.2.8-2.el7.x86_64
libvirt-1.2.8-5.el7.x86_64

no error occured, issue is fixed.
my $dev = $conn->get_node_device_scsihost_by_wwn("2000001b3289da4e","2100001b3289da4e");
my $xml =  $dev->get_xml_description();
can find right nodedev and print nodedev's xml
<device>
#   <name>scsi_host4</name>
#   <path>/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.0/host4</path>
#   <parent>pci_0000_04_00_0</parent>
#   <capability type='scsi_host'>
#     <host>4</host>
#     <unique_id>4</unique_id>
#     <capability type='fc_host'>
#       <wwnn>2000001b3289da4e</wwnn>
#       <wwpn>2100001b3289da4e</wwpn>
#       <fabric_wwn>2001000dec987841</fabric_wwn>
#     </capability>
#     <capability type='vport_ops'>
#       <max_vports>127</max_vports>
#       <vports>0</vports>
#     </capability>
#   </capability>
# </device>

move to verified.
Comment 16 errata-xmlrpc 2015-03-05 05:53:50 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0470.html

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