[libvirt] [PATCH] conf: Add check for non scsi_host parent during vport delete

John Ferlan posted 1 patch 7 years ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20170404185605.7634-1-jferlan@redhat.com
src/conf/node_device_conf.c | 7 +++++++
1 file changed, 7 insertions(+)
[libvirt] [PATCH] conf: Add check for non scsi_host parent during vport delete
Posted by John Ferlan 7 years ago
https://bugzilla.redhat.com/show_bug.cgi?id=1420740

If the parent is not a scsi_host, then we can just happily return since
we won't be removing a vport.

Fixes a bug with the following output:

$ virsh pool-destroy host4_hba_pool
error: Failed to destroy pool host4_hba_pool
error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool

$

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/conf/node_device_conf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
index 7d0baa9..cc3fad8 100644
--- a/src/conf/node_device_conf.c
+++ b/src/conf/node_device_conf.c
@@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
         if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name)))
             goto cleanup;
 
+        /* If the parent is not a scsi_host, then this is a pool backed
+         * directly to an HBA and there's no vHBA to remove - so we're done */
+        if (!STRPREFIX(vhba_parent, "scsi_host")) {
+            ret = 0;
+            goto cleanup;
+        }
+
         if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0)
             goto cleanup;
     }
-- 
2.9.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: Add check for non scsi_host parent during vport delete
Posted by John Ferlan 7 years ago

ping?

Tks -

John

On 04/04/2017 02:56 PM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1420740
> 
> If the parent is not a scsi_host, then we can just happily return since
> we won't be removing a vport.
> 
> Fixes a bug with the following output:
> 
> $ virsh pool-destroy host4_hba_pool
> error: Failed to destroy pool host4_hba_pool
> error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool
> 
> $
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/conf/node_device_conf.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index 7d0baa9..cc3fad8 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
>          if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name)))
>              goto cleanup;
>  
> +        /* If the parent is not a scsi_host, then this is a pool backed
> +         * directly to an HBA and there's no vHBA to remove - so we're done */
> +        if (!STRPREFIX(vhba_parent, "scsi_host")) {
> +            ret = 0;
> +            goto cleanup;
> +        }
> +
>          if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0)
>              goto cleanup;
>      }
> 

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: Add check for non scsi_host parent during vport delete
Posted by Michal Privoznik 7 years ago
On 04/04/2017 08:56 PM, John Ferlan wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1420740
>
> If the parent is not a scsi_host, then we can just happily return since
> we won't be removing a vport.
>
> Fixes a bug with the following output:
>
> $ virsh pool-destroy host4_hba_pool
> error: Failed to destroy pool host4_hba_pool
> error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool
>
> $
>
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/conf/node_device_conf.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
> index 7d0baa9..cc3fad8 100644
> --- a/src/conf/node_device_conf.c
> +++ b/src/conf/node_device_conf.c
> @@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
>          if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name)))
>              goto cleanup;
>
> +        /* If the parent is not a scsi_host, then this is a pool backed
> +         * directly to an HBA and there's no vHBA to remove - so we're done */
> +        if (!STRPREFIX(vhba_parent, "scsi_host")) {
> +            ret = 0;
> +            goto cleanup;
> +        }
> +
>          if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0)
>              goto cleanup;
>      }
>


ACK

Michal

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