Bug 952105

Summary: [NPIV]Can't create a vHBA with libvirt and scsi_host information is not correct
Product: Red Hat Enterprise Linux 7 Reporter: zhpeng
Component: libvirtAssignee: John Ferlan <jferlan>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, cwei, dallan, dyuan, gsun, hui.xiao, jamorgan, jane.lv, juzhang, jvillalo, jwilleford, lsu, mzhan, ruwang, sluo, xiaolong.wang
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-1.1.0-1.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 10:30:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 726797, 1059956    

Description zhpeng 2013-04-15 08:17:51 UTC
Description
Can't create a vHBA with libvirt and nodedev-dumpxml scsi_host information is not correct

Version
libvirt-1.0.4-1.el7.x86_64

Steps
1. # 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>2001001b</wwnn>                ---> not correct
      <wwpn>2101001b</wwpn>                ---> not correct
      <fabric_wwn>2001000d</fabric_wwn>    ---> not correct
    </capability>
  </capability>
</device>

2. # virsh nodedev-create vHba.xml
[root@amd-1352-8-2 zhpeng]# virsh nodedev-create newvport.xml
error: Failed to create node device from newvport.xml
error: internal error Parent device scsi_host5 is not capable of vport operations

Actual result
As steps

Expect result
No error, and result is correct.

Additional info
I've confirmed this with osier

zhpeng
BR

Comment 3 Osier Yang 2013-05-13 09:20:55 UTC
commit e106c0112a3a5d06fcea74b0d1d130c720c1c829
Author: Osier Yang <jyang>
Date:   Mon May 6 20:45:12 2013 +0800

    util: Fix regression introduced by commit 4360a098441
    
    Which refactored the old code, and introduced new helper
    virIsCapableVport, but the path for checking with access() is not
    correctly constructed.

commit b76284afb1e2251b03a9d62a1cb5bde7f2255333
Author: Osier Yang <jyang>
Date:   Mon May 6 20:45:11 2013 +0800

    util: Fix regression of wwn reading
    
    Introduced by commit 244ce462e29, which refactored the helper for wwn
    reading, however, it forgot to change the old "strndup" and "sizeof(buf)",
    "sizeof(buf)" operates on the fixed length array ("buf") in the old code,
    but now "buf" is a pointer.

Comment 4 Luwen Su 2013-06-06 06:33:49 UTC
Hi Osier , 

The VHBA still can't be created with same error like before ,
and the libvirtd will report some error messages once it started,

Failed to open file '/sys/class/fc_host//host0/max_npiv_vports': No such file or directory
ibvirtd[1758]: Failed to read max_npiv_vports for host4

Any advices ? Thanks

Package:
libvirt-1.0.6-1.el7.x86_64
kernel-3.10.0-0.rc4.59.el7.x86_64

Steps:
1.# virsh nodedev-dumpxml scsi_host6
<device>
  <name>scsi_host6</name>
  <parent>scsi_host5</parent>
  <capability type='scsi_host'>
    <host>6</host>
    <capability type='fc_host'>
      <wwnn>2101001b32a9f25b</wwnn>
      <wwpn>2001001b32a9f001</wwpn>
      <fabric_wwn>2001000dec9877c1</fabric_wwn>
    </capability>
  </capability>
</device>

2.
# cat vHBA.xml 
<device>
  <parent>scsi_host5</parent>
  <capability type='scsi_host'>
    <capability type='fc_host'>
      <wwnn>2101001b32a9f25b</wwnn>
      <wwpn>2001001b32a9f001</wwpn>
      <fabric_wwn>2001000dec9877c1</fabric_wwn>
    </capability>
  </capability>
</device>

3.
# virsh nodedev-create vHBA.xml 
error: Failed to create node device from vHBA.xml
error: internal error Parent device scsi_host5 is not capable of vport operations

4.
When libvirtd start , it will report
Failed to open file '/sys/class/fc_host//host0/max_npiv_vports': No such file or directory
libvirtd[1758]: Failed to read max_npiv_vports for host4
libvirtd[1758]: Failed to open file '/sys/class/fc_host//host0/max_npiv_vports': No such file or directory
libvirtd[1758]: Failed to read max_npiv_vports for host5

Comment 5 Osier Yang 2013-06-17 07:17:50 UTC
(In reply to time.su from comment #4)
> Hi Osier , 
> 
> The VHBA still can't be created with same error like before ,
> and the libvirtd will report some error messages once it started,
> 
> Failed to open file '/sys/class/fc_host//host0/max_npiv_vports': No such
> file or directory

Hum, incorrect file path. Something is wrong.

> ibvirtd[1758]: Failed to read max_npiv_vports for host4
> 

I change back to ASSIGNED. Since the problem is not fixed exhaustively.

Comment 6 Osier Yang 2013-06-17 07:32:33 UTC
(In reply to Osier Yang from comment #5)
> (In reply to time.su from comment #4)
> > Hi Osier , 
> > 
> > The VHBA still can't be created with same error like before ,
> > and the libvirtd will report some error messages once it started,
> > 
> > Failed to open file '/sys/class/fc_host//host0/max_npiv_vports': No such
> > file or directory
> 
> Hum, incorrect file path. Something is wrong.

Fixed by http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=371c155. So move to POST again. 

> 
> > ibvirtd[1758]: Failed to read max_npiv_vports for host4
> > 
> 
> I change back to ASSIGNED. Since the problem is not fixed exhaustively.

Comment 7 zhpeng 2013-07-02 07:28:22 UTC
Test with: libvirt  1.1.0-1.el7

# virsh nodedev-dumpxml scsi_host5
<device>
  <name>scsi_host5</name>
  <path>/sys/devices/pci0000:00/0000:00:0d.0/0000:04:00.1/host5</path>
  <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'>
      <max_vports>127</max_vports>
      <vports>0</vports>
    </capability>
  </capability>
</device>


# virsh nodedev-create vHBA.xml 
Node device scsi_host6 created from vHBA.xml

# systemctl restart libvirtd
# echo $?
0

So it's verified.

Comment 10 Ludek Smid 2014-06-13 10:30:13 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.