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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxxxxx>
> ---
> 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?

Something just doesn't seem right. The 'parent' is optional and the path
you're changing is for the case when the XML doesn't provide the parent.
Thus on delete we have to look up the parent based upon the wwwn/wwpn of
the vHBA.  From that, we grab the 'parent' field in order to
automagically remove the vHBA.

For example, if I have:

# cat vhbapool_noparent.xml
    <pool type='scsi'>
      <name>vhbapool_noparent</name>
      <source>
        <adapter type='fc_host' wwnn='5001a4aea69b98a3'
wwpn='5001a4ac3f71c7e1'/>
      </source>
      <target>
        <path>/dev/disk/by-path</path>
        <permissions>
          <mode>0700</mode>
          <owner>0</owner>
          <group>0</group>
        </permissions>
      </target>
    </pool>


Then the code will search for HBA's that are capable of supporting vhost
(e.g., they have the vport_ops).  In my case, that's scsi_host3:

# virsh nodedev-dumpxml scsi_host3
<device>
  <name>scsi_host3</name>
  <path>/sys/devices/pci0000:00/0000:00:04.0/0000:10:00.0/host3</path>
  <parent>pci_0000_10_00_0</parent>
  <capability type='scsi_host'>
    <host>3</host>
    <unique_id>0</unique_id>
    <capability type='fc_host'>
      <wwnn>20000000c9848140</wwnn>
      <wwpn>10000000c9848140</wwpn>
      <fabric_wwn>2002000573de9a81</fabric_wwn>
    </capability>
    <capability type='vport_ops'>
      <max_vports>127</max_vports>
      <vports>5</vports>
    </capability>
  </capability>
</device>


I can start the pool:

# virsh pool-create vhbapool_noprent.xml
Pool vhbapool_noparent created from vhbapool_noparent.xml

If I look at the list of scsi_host's:

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15
scsi_host16
scsi_host17
scsi_host19
scsi_host2
scsi_host3
scsi_host4
scsi_host5

I can "assume" the one with the highest number is my vHBA and then dump
it's XML:

# virsh nodedev-dumpxml scsi_host19
<device>
  <name>scsi_host19</name>

<path>/sys/devices/pci0000:00/0000:00:04.0/0000:10:00.0/host3/vport-3:0-14/host19</path>
  <parent>scsi_host3</parent>
  <capability type='scsi_host'>
    <host>19</host>
    <unique_id>16</unique_id>
    <capability type='fc_host'>
      <wwnn>5001a4aea69b98a3</wwnn>
      <wwpn>5001a4ac3f71c7e1</wwpn>
      <fabric_wwn>2002000573de9a81</fabric_wwn>
    </capability>
  </capability>
</device>

Which it is since the 'wwnn' and 'wwpn' match.  Note the "<parent>" in
this case is "scsi_host3" (just like I assumed earlier).

When we go to delete the vHBA, the deleteVport code will do this lookup
for us and remove the parent scsi_host#

# virsh pool-destroy vhbapool_noparent
Pool vhbapool_noparent destroyed

# virsh nodedev-list scsi_host
scsi_host0
scsi_host1
scsi_host15
scsi_host16
scsi_host17
scsi_host2
scsi_host3
scsi_host4
scsi_host5

#

So can you show me what's different with the configuration you have that
the <parent> for the vHBA is not prefixed with scsi_host. Is there
perhaps a way to determine what the 'scsi_host#' is that was created for
the vHBA? (since it should be removed).

Thanks -

John
> diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
> index e6c8bb5..dd0343f 100644
> --- a/src/storage/storage_backend_scsi.c
> +++ b/src/storage/storage_backend_scsi.c
> @@ -842,6 +842,11 @@ deleteVport(virConnectPtr conn,
>          if (!(vhba_parent = virStoragePoolGetVhbaSCSIHostParent(conn, name)))
>              goto cleanup;
>  
> +        if (STRPREFIX(vhba_parent, "pci")) {
> +            ret = 0;
> +            goto cleanup;
> +        }
> +
>          if (virGetSCSIHostNumber(vhba_parent, &parent_host) < 0)
>              goto cleanup;
>      }
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]