[libvirt] [PATCH] storage_scsi: Handle physical HBA when deleting vHBA vport.

John Ferlan jferlan at redhat.com
Fri Apr 15 23:17:58 UTC 2016



On 04/15/2016 02:26 PM, Nitesh Konkar wrote:
> On Fri, Apr 15, 2016 at 8:08 PM, John Ferlan <jferlan at redhat.com> wrote:
> 

Please do not remove libvir-list from a response. I've replaced it.
Someone may have a different idea.

>>
>>
>> On 04/15/2016 10:11 AM, Nitesh Konkar wrote:
>>> Thanks John for the reply.
>>>
>>> On Fri, Apr 15, 2016 at 5:08 PM, John Ferlan <jferlan at redhat.com> wrote:
>>>
>>>>
>>>>
>>>> On 04/07/2016 05:09 AM, Nitesh Konkar wrote:
>>>>> HBA will get treated as vHBA if not returned
>>>>> after detecting vhba_parent format.
>>>>>
>>>>> Signed-off-by: Nitesh Konkar <nitkon12 at linux.vnet.ibm.com>
>>>>> ---
>>>>> Before Patch:
>>>>> # virsh pool-destroy poolhba_name
>>>>> error: Failed to destroy pool poolhba_name
>>>>> error: internal error: Invalid adapter name 'pci_000x_0x_00_x' for SCSI
>>>> pool
>>>>>
>>>>> # virsh nodedev-dumpxml scsi_host2
>>>>> <device>
>>>>>   <name>scsi_host2</name>
>>>>>   <path>xxxx</path>
>>>>>   <parent>pci_000x_0x_00_x</parent>
>>>>>   <capability type='scsi_host'>
>>>>>     <host>2</host>
>>>>>     ...
>>>>>     ...
>>>>>     <capability type='vport_ops'>
>>>>>       <max_vports>255</max_vports>
>>>>>       <vports>0</vports>
>>>>>     </capability>
>>>>>   </capability>
>>>>> </device>
>>>>>
>>>>> After Patch:
>>>>> # virsh pool-destroy poolhba_name
>>>>> Pool poolhba_name destroyed
>>>>>
>>>>>  src/storage/storage_backend_scsi.c | 5 +++++
>>>>>  1 file changed, 5 insertions(+)
>>>>>
>>>>
>>>> Can you provide the pool-dumpxml for poolhba_name? Can you provide the
>>>> nodedev-dumpxml of the 'scsi_host#' that was created for the vHBA pool?
>>>>
>>>>
>>> This patch is to destroy a pool created out from a Physical HBA.
>> Apologies,
>>> if the
>>> commit message was misleading.
>>>
>>>  # virsh pool-dumpxml poolhba_name
>>> <pool type='scsi'>
>>>   <name>poolhba_name</name>
>>>   <uuid>60d74134-0c18-4d4f-9305-24d96ce1a1b6</uuid>
>>>   <capacity unit='bytes'>268435456000</capacity>
>>>   <allocation unit='bytes'>268435456000</allocation>
>>>   <available unit='bytes'>0</available>
>>>   <source>
>>>     <adapter type='fc_host' managed='yes' wwnn='20000120fa8f1271'
>>> wwpn='10000090fa8f1271'/>
>>>   </source>
>>>   <target>
>>>     <path>/dev/disk/by-id</path>
>>>     <permissions>
>>>       <mode>0700</mode>
>>>       <owner>0</owner>
>>>       <group>0</group>
>>>     </permissions>
>>>   </target>
>>> </pool>
>>>
>>
>> OK, maybe I wasn't clear enough... Which 'scsi_host#' is *this* pool
>> associated with. Prior to creating it, do a virsh nodedev-list
>> scsi_host.  Then create it. Then generate the list again.
>>
>> The pool poolhba_name is associated with scsi_host2.
> 
> #virsh list --all
>  Id    Name                           State
> ----------------------------------------------------
> 
> # virsh nodedev-list scsi_host
> scsi_host0
> scsi_host1
> scsi_host2
> scsi_host3
> scsi_host4
> 
> #virsh pool-list --all
>  Name                 State      Autostart
> -------------------------------------------
>  poolhba_name          active     yes
> 
>  # virsh nodedev-dumpxml scsi_host2
> <device>
>   <name>scsi_host2</name>
> 
> <path>/sys/devices/pci0001:00/0001:00:00.0/0001:01:00.0/0001:02:09.0/0001:09:00.1/host2</path>
>   <parent>pci_0001_09_00_1</parent>
>   <capability type='scsi_host'>
>     <host>2</host>
>     <unique_id>1</unique_id>
>     <capability type='fc_host'>
>       <wwnn>20000120fa8f1271</wwnn>
>       <wwpn>10000090fa8f1271</wwpn>
>       <fabric_wwn>100050eb1a99d430</fabric_wwn>
>     </capability>
>     <capability type='vport_ops'>
>       <max_vports>255</max_vports>
>       <vports>1</vports>
>     </capability>
>   </capability>
> </device>
> 
> Or of course since you cannot delete the poolvhba_name, go through the
>> various scsi_host#'s on your host looking for the one with the match
>> wwwn/wwpn - then do the nodedev-dumpxml of that.  For you example you
>> are looking for the scsi_host# with the matching wwnn='20000120fa8f1271'
>> and wwpn='10000090fa8f1271'.
>>
>> That one is supposed to list 'scsi_host2' in the <parent> field as my
>> 'scsi_host19' does below.
>>
>>  # virsh pool-list --all
>  Name                 State      Autostart
> -------------------------------------------
>  poolhba_name          active     yes
> 
> # virsh nodedev-dumpxml scsi_host2
> <device>
>   <name>scsi_host2</name>
> 
> <path>/sys/devices/pci0001:00/0001:00:00.0/0001:01:00.0/0001:02:09.0/0001:09:00.1/host2</path>
>   <parent>pci_0001_09_00_1</parent>
>   <capability type='scsi_host'>
>     <host>2</host>
>     <unique_id>1</unique_id>
>     <capability type='fc_host'>
>       <wwnn>20000120fa8f1271</wwnn>
>       <wwpn>10000090fa8f1271</wwpn>
>       <fabric_wwn>100050eb1a99d430</fabric_wwn>
>     </capability>
>     <capability type='vport_ops'>
>       <max_vports>255</max_vports>
>       <vports>1</vports>
>     </capability>
>   </capability>
> </device>
> 
> Here the parent field has "pci_0001_09_00_1" and not 'scsi_host2' . This is
> why it errors out.
> 
>  # virsh pool-destroy poolhba_name
> 2016-04-15 18:21:07.054+0000: 113209: error : virGetSCSIHostNumber:1922 :
> internal error: Invalid adapter name 'pci_0001_09_00_1' for SCSI pool
> error: Failed to destroy pool poolhba_name
> error: internal error: Invalid adapter name 'pci_0001_09_00_1' for SCSI pool
> 
> Am I missing something?
> 

Perhaps - I think I explained how the vHBA is created before... Look at
the code for createVport() - see the 'parent_hoststr' description.

When you did a pool-{create|define} for the "poolhba_name", you provided
some XML which would search the existing 'scsi_host#' for one that's
capable of supporting a vHBA.

What that create is supposed to do (at least it does it on the systems I
used) is create another 'scsi_host#'. That scsi_host# is then the vHBA -
it's *parent* is supposed to be 'scsi_host2' - see my example. On your
host perhaps scsi_host3 or scsi_host4. Do either one of those two have
the wwnn/wwpn that's in your poolhba_name:

<adapter type='fc_host' managed='yes' wwnn='20000120fa8f1271'
wwpn='10000090fa8f1271'/>

I'm really not quite sure what's happening on your host/environment.
Perhaps you could follow how createVport generates things and report
back. You can always 'create' another vHBA using a different wwnn/wwpn

John




More information about the libvir-list mailing list