From 85a9692bb630be29ff07a7ffa1c1eec3fbcd022b Mon Sep 17 00:00:00 2001
Message-Id: <85a9692bb630be29ff07a7ffa1c1eec3fbcd022b.1385135432.git.jdenemar@redhat.com>
From: Osier Yang <jyang@redhat.com>
Date: Thu, 21 Nov 2013 12:24:57 +0800
Subject: [PATCH] storage: Returns earlier if source adapter of the scsi pool
is a HBA
https://bugzilla.redhat.com/show_bug.cgi?id=1027680
It makes no sense to go forward to get the parent host number of a
HBA, and treat the HBA as a vHBA with trying to delete it.
Signed-off-by: Osier Yang <jyang@redhat.com>
(cherry picked from commit b96651dec09850dcc9fdace5a149c06a793f611e)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/storage/storage_backend_scsi.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c
index 8cb762a..64b7843 100644
--- a/src/storage/storage_backend_scsi.c
+++ b/src/storage/storage_backend_scsi.c
@@ -664,6 +664,14 @@ deleteVport(virStoragePoolSourceAdapter adapter)
if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST)
return 0;
+ /* It must be a HBA instead of a vHBA as long as "parent"
+ * is NULL. "createVport" guaranteed "parent" for a vHBA
+ * cannot be NULL, it's either specified in XML, or detected
+ * automatically.
+ */
+ if (!adapter.data.fchost.parent)
+ return 0;
+
if (!(virGetFCHostNameByWWN(NULL, adapter.data.fchost.wwnn,
adapter.data.fchost.wwpn)))
return -1;
--
1.8.4.4