Dennis Chen
2013-Jun-20 09:07 UTC
[libvirt-users] Question about vport operation for FC HBA
Hi, When I want to use NPIV for a FC HBA in my Linux machine, I got the below error msg in virsh: virsh # nodedev-create /home/kvm/vHBA.xml error: Failed to create node device from /home/kvm/vHBA.xml error: internal error Parent device scsi_host20 is not capable of vport operations I checked the /sys/class folder for my HBA device that I want to use its NPIV feature, it's there: /sys/class/fc_host/host20/vport_create I can create a vHBA by using "echo 'xxxx:xxxx' > ./vport_create", a new fc host will be created after that. But I can't find any FC host with: #virsh nodedev-list --cap fc_host SCSI hosts can be found for above "nodedev-list --cap scsi_host". The libvirt I am working on is based ver 1.0.5, I checked the code and found below function is seems related with this issue: src/util/virutil.c: int virIsCapableVport(const char *sysfs_prefix, int host) This function looks up if there is "vport_create" file under /sys/class/fc_host/host20, as the way to decide if a HBA device is capable of vport operation. But seems this file is not compiled and virsh doesn't call it in my source code environment... is there any tips ? BRs, Dennis
Ján Tomko
2013-Jun-20 10:05 UTC
Re: [libvirt-users] Question about vport operation for FC HBA
On 06/20/2013 11:07 AM, Dennis Chen wrote:> Hi, > > When I want to use NPIV for a FC HBA in my Linux machine, I got the below > error msg in virsh: > > virsh # nodedev-create /home/kvm/vHBA.xml > error: Failed to create node device from /home/kvm/vHBA.xml > error: internal error Parent device scsi_host20 is not capable of vport > operations > > I checked the /sys/class folder for my HBA device that I want to use its NPIV > feature, it's there: > /sys/class/fc_host/host20/vport_create > > I can create a vHBA by using "echo 'xxxx:xxxx' > ./vport_create", a new fc > host will be created after that. > > But I can't find any FC host with: > #virsh nodedev-list --cap fc_host > > SCSI hosts can be found for above "nodedev-list --cap scsi_host". > > The libvirt I am working on is based ver 1.0.5, I checked the code and found > below function is seems related with this issue: > src/util/virutil.c: > int > virIsCapableVport(const char *sysfs_prefix, > int host) > > This function looks up if there is "vport_create" file under > /sys/class/fc_host/host20, as the way to decide if a HBA device is capable of > vport operation. > > But seems this file is not compiled and virsh doesn't call it in my source > code environment... is there any tips ?Hi, there was a bug in the nodedev driver, it used ../fc_host/host0/.. even when the host number was different. It should be fixed by this commit (pushed in the git, but not yet a part of a release): http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=371c155 Hopefully that fixes it for you. Relevant bugs: https://bugzilla.redhat.com/show_bug.cgi?id=952105 https://bugzilla.redhat.com/show_bug.cgi?id=973543 Jan
Dennis Chen
2013-Jun-21 02:33 UTC
Re: [libvirt-users] Question about vport operation for FC HBA
On 06/20/2013 06:05 PM, Ján Tomko wrote:> On 06/20/2013 11:07 AM, Dennis Chen wrote: >> Hi, >> >> When I want to use NPIV for a FC HBA in my Linux machine, I got the below >> error msg in virsh: >> >> virsh # nodedev-create /home/kvm/vHBA.xml >> error: Failed to create node device from /home/kvm/vHBA.xml >> error: internal error Parent device scsi_host20 is not capable of vport >> operations >> ... >> But seems this file is not compiled and virsh doesn't call it in my source >> code environment... is there any tips ? > Hi, there was a bug in the nodedev driver, it used ../fc_host/host0/.. even > when the host number was different. > > It should be fixed by this commit (pushed in the git, but not yet a part of a > release): > http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=371c155 > > Hopefully that fixes it for you. > > Relevant bugs: > https://bugzilla.redhat.com/show_bug.cgi?id=952105 > https://bugzilla.redhat.com/show_bug.cgi?id=973543 > > Jan >After use the latest libvirt 1.0.6 + your patch, it resolved below issues in my environment: 1. The internal error Parent device scsi_host20 is not capable of vport 2. nodedev-dumpxml can get correct info of the HBA device. But seems there's another problem--- My vHBA.xml: <device> <parent>scsi_host20</parent> <capability type='scsi_host'> <capability type='fc_host'> <wwpn>20008c7cff30be58</wwpn> <wwnn>10008d7cff30beb8</wwnn> </capability> </capability> </device> The output of the nodedev-create command: virsh # nodedev-create /home/kvm/vHBA.xml (after about 30s silence...) error: Failed to create node device from /home/kvm/vHBA.xml error: Node device not found Actually I found that the new vHBA device is generated sucessfully (scsi_host31), and the "nodedev-dumpxml" for this device is: virsh # nodedev-dumpxml scsi_host31 <device> <name>scsi_host31</name> <parent>scsi_host20</parent> <capability type='scsi_host'> <host>31</host> <capability type='fc_host'> <wwnn>20008c7cff30be58</wwnn> ----- the wwpn value in vHBA.xml <wwpn>10008d7cff30beb8</wwpn> ----- the wwnn value in vHBA.xml <fabric_wwn>0</fabric_wwn> </capability> </capability> </device> any suggestion? BRs, Dennis