[libvirt-users] Getting "unknown device type" when attaching NPIV (vHBA) to vm

Laine Stump laine at laine.org
Tue Feb 9 00:13:16 UTC 2016


On 02/08/2016 06:01 PM, Vaknin, Rami wrote:
> Thank you for your reply,
> I'm still getting hard time to attach the hostdev, I couldn't make it work out of the doc.
>
> I took the address details from:
>
> # ll /sys/bus/scsi/devices/7:*
> lrwxrwxrwx 1 root root 0 Feb  8 12:58 /sys/bus/scsi/devices/7:0:0:0 -> ../../../devices/pci0000:00/0000:00:03.0/0000:08:00.1/host7/rport-7:0-0/target7:0:0/7:0:0:0
> lrwxrwxrwx 1 root root 0 Feb  8 12:58 /sys/bus/scsi/devices/7:0:1:0 -> ../../../devices/pci0000:00/0000:00:03.0/0000:08:00.1/host7/rport-7:0-1/target7:0:1/7:0:1:0
> lrwxrwxrwx 1 root root 0 Feb  8 12:58 /sys/bus/scsi/devices/7:0:2:0 -> ../../../devices/pci0000:00/0000:00:03.0/0000:08:00.1/host7/rport-7:0-2/target7:0:2/7:0:2:0
> lrwxrwxrwx 1 root root 0 Feb  8 12:58 /sys/bus/scsi/devices/7:0:3:0 -> ../../../devices/pci0000:00/0000:00:03.0/0000:08:00.1/host7/rport-7:0-3/target7:0:3/7:0:3:0
>
> and added them (7:0:3:0) to this base xml in various formats instead of the default zeros:
>
>      <hostdev mode="subsystem" " type="scsi">
>        <source>
>          <adapter name="scsi_host7"/>
>          <address bus="0" target="0" unit="0"/>
>        </source>
>        <readonly/>
>        <address bus="0" controller="0" target="0" type="drive" unit="0"/>
>      </hostdev>
>
> Libvirt keeps saying:
> " error : virDomainHostdevDefParseXMLSubsys:3091 : XML error: unknown host device source address type 'scsi'"
>
> I still can't figure it out, I still have open questions I can't understand from the docs:

You said in your original message that you are using libvirt 0.10.2 on 
CentOS 6. The documentation that Michal pointed you at says that hostdev 
type='scsi' works only since libvirt 1.0.6 - you are trying to do scsi 
hostdev which isn't supported in the version of libvirt you're using.

Depending on your requirements, you may be able to assign the scsi 
controller (a PCI device) to the guest (but that would require that no 
other disk on that same controller be in use by the host or another 
guest). Otherwise you should either assign the disk with <disk> (which 
will present an emulated device to the guest, using the contents of 
/dev/whatever as the content), or build your own libvirt of a later 
version (not recommended unless you really know what you're doing).


>
> Am I using the right subsystem type? Or maybe I should attach the host HBA PCI (QLogic) directly?
> Should I use the host scsi_host or should it be the vHBA created uding libvirt?
> How exactly I extract the host address and derives the destination address?
>
>
>
> -----Original Message-----
> From: Michal Privoznik [mailto:mprivozn at redhat.com]
> Sent: Wednesday, February 03, 2016 3:49 PM
> To: Vaknin, Rami; libvirt-users at redhat.com
> Subject: Re: [libvirt-users] Getting "unknown device type" when attaching NPIV (vHBA) to vm
>
> On 01.02.2016 22:48, Vaknin, Rami wrote:
>> Hi,
>>
>> I'm trying to attach a host FC HBA to VM (NPIV).
>>
>> Running ovirt 3.5 on CentOS 6.7, libvirt-0.10.2-46.el6_6.6.x86_64, I created vHBA using nodedev-create command - see below HBA and vHBA.
>> I wrote a vdsm hook which appends the vHBA xml stanza to the devices xml element but the vm start starts without the vHBA device.
>>
>> Also, when trying to attach the device manually as a live device - I get:
>> 2016-02-01 21:30:24.216+0000: 129764: debug :
>> qemuDomainObjBeginJobInternal:847 : Starting job: modify (async=none)
>> 2016-02-01 21:30:24.216+0000: 129764: error :
>> virDomainDeviceDefParse:8136 : XML error: unknown device type
>>
>> Could you please help?
>>
>> virsh # nodedev-dumpxml scsi_host6
>> <device>
>>    <name>scsi_host6</name>
>>    <parent>pci_0000_08_00_0</parent>
>>    <capability type='scsi_host'>
>>      <host>6</host>
>>      <capability type='fc_host'>
>>        <wwnn>20000024ff57d848</wwnn>
>>        <wwpn>21000024ff57d848</wwpn>
>>        <fabric_wwn>20018c604f101321</fabric_wwn>
>>      </capability>
>>      <capability type='vport_ops' />
>>    </capability>
>> </device>
>>
>>
>> virsh # nodedev-dumpxml scsi_host15
>> <device>
>>    <name>scsi_host15</name>
>>    <parent>scsi_host6</parent>
>>    <capability type='scsi_host'>
>>      <host>15</host>
>>      <capability type='fc_host'>
>>        <wwnn>5001a4a84992572a</wwnn>
>>        <wwpn>5001a4a76965d7b8</wwpn>
>>        <fabric_wwn>20018c604f101321</fabric_wwn>
>>      </capability>
>>    </capability>
>> </device>
>>
>>
>> The xml I appends:
>>
>>    <devices>
>> ...
>>        <device>
>>          <name>scsi_host16</name>
>>          <parent>scsi_host7</parent>
>>          <capability type="scsi_host">
>>            <host>16</host>
>>            <capability type="fc_host">
>>                <wwnn>5001a4a8cd978a73</wwnn>
>>                <wwpn>5001a4afa86a7378</wwpn>
>>                <fabric_wwn>20018c604f101411</fabric_wwn>
>>            </capability>
>>        </capability>
>>        </device>
>>        <device>
>>          <name>scsi_host15</name>
>>          <parent>scsi_host6</parent>
>>          <capability type="scsi_host">
>>            <host>15</host>
>>              <capability type="fc_host">
>>                <wwnn>5001a4a84992572a</wwnn>
>>                <wwpn>5001a4a76965d7b8</wwpn>
>>                <fabric_wwn>20018c604f101321</fabric_wwn>
>>              </capability>
>>          </capability>
>>        </device>
>>
>>    </devices>
>>
> This is not how you attach a hostdev to a domain. You need to be looking at <hostdev/>:
>
> http://libvirt.org/formatdomain.html#elementsHostDev
>
> Michal
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>




More information about the libvirt-users mailing list