[libvirt] [PATCH] storage: Returns earlier if source adapter of the scsi pool is a HBA

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. --- 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 1426121..6f86ffc 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -667,6 +667,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.1.4

On 11/20/2013 05:44 AM, Osier Yang wrote:
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. --- src/storage/storage_backend_scsi.c | 8 ++++++++ 1 file changed, 8 insertions(+)
ACK.
diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backend_scsi.c index 1426121..6f86ffc 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -667,6 +667,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;
-- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 20/11/13 23:57, Eric Blake wrote:
On 11/20/2013 05:44 AM, Osier Yang wrote:
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. --- src/storage/storage_backend_scsi.c | 8 ++++++++ 1 file changed, 8 insertions(+) ACK.
Thanks, pushed. Osier
participants (2)
-
Eric Blake
-
Osier Yang