3e5111
From aa337656da6b3e44ccaae85ec64538dee80000cf Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <aa337656da6b3e44ccaae85ec64538dee80000cf@dist-git>
3e5111
From: John Ferlan <jferlan@redhat.com>
3e5111
Date: Thu, 13 Apr 2017 10:38:35 -0400
3e5111
Subject: [PATCH] conf: Add check for non scsi_host parent during vport delete
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1420740
3e5111
3e5111
If the parent is not a scsi_host, then we can just happily return since
3e5111
we won't be removing a vport.
3e5111
3e5111
Fixes a bug with the following output:
3e5111
3e5111
$ virsh pool-destroy host4_hba_pool
3e5111
error: Failed to destroy pool host4_hba_pool
3e5111
error: internal error: Invalid adapter name 'pci_0000_10_00_1' for SCSI pool
3e5111
3e5111
$
3e5111
3e5111
(cherry picked from commit 84f178bdc7ab38011cc1f76759b0a41335285a4f)
3e5111
Signed-off-by: John Ferlan <jferlan@redhat.com>
3e5111
---
3e5111
 src/conf/node_device_conf.c | 7 +++++++
3e5111
 1 file changed, 7 insertions(+)
3e5111
3e5111
diff --git a/src/conf/node_device_conf.c b/src/conf/node_device_conf.c
3e5111
index 7d0baa9d1..cc3fad8b9 100644
3e5111
--- a/src/conf/node_device_conf.c
3e5111
+++ b/src/conf/node_device_conf.c
3e5111
@@ -2074,6 +2074,13 @@ virNodeDeviceDeleteVport(virConnectPtr conn,
3e5111
         if (!(vhba_parent = virNodeDeviceGetParentName(conn, scsi_host_name)))
3e5111
             goto cleanup;
3e5111
 
3e5111
+        /* If the parent is not a scsi_host, then this is a pool backed
3e5111
+         * directly to an HBA and there's no vHBA to remove - so we're done */
3e5111
+        if (!STRPREFIX(vhba_parent, "scsi_host")) {
3e5111
+            ret = 0;
3e5111
+            goto cleanup;
3e5111
+        }
3e5111
+
3e5111
         if (virSCSIHostGetNumber(vhba_parent, &parent_host) < 0)
3e5111
             goto cleanup;
3e5111
     }
3e5111
-- 
3e5111
2.12.2
3e5111