From nobody Mon Feb 9 09:10:09 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1489180499548861.1085251034223; Fri, 10 Mar 2017 13:14:59 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2ALBVJj009196; Fri, 10 Mar 2017 16:11:31 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2ALB0K5024001 for ; Fri, 10 Mar 2017 16:11:00 -0500 Received: from localhost.localdomain.com (ovpn-117-9.phx2.redhat.com [10.3.117.9]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v2ALArRu011410 for ; Fri, 10 Mar 2017 16:11:00 -0500 From: John Ferlan To: libvir-list@redhat.com Date: Fri, 10 Mar 2017 16:10:46 -0500 Message-Id: <20170310211050.27784-15-jferlan@redhat.com> In-Reply-To: <20170310211050.27784-1-jferlan@redhat.com> References: <20170310211050.27784-1-jferlan@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 14/18] conf: Convert virStoragePoolSourceAdapter to virStorageAdapter X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move the virStoragePoolSourceAdapter from storage_conf.h and rename to virStorageAdapter. Continue with code realignment for brevity and flow. Signed-off-by: John Ferlan --- src/conf/storage_adapter_conf.c | 71 ++++++++++++++++++----------------= ---- src/conf/storage_adapter_conf.h | 51 ++++++++++++++++++++++++--- src/conf/storage_conf.c | 32 ++++++++--------- src/conf/storage_conf.h | 44 ++--------------------- src/libvirt_private.syms | 2 -- src/phyp/phyp_driver.c | 3 +- src/storage/storage_backend_scsi.c | 18 +++++----- src/test/test_driver.c | 5 ++- 8 files changed, 109 insertions(+), 117 deletions(-) diff --git a/src/conf/storage_adapter_conf.c b/src/conf/storage_adapter_con= f.c index 6efe5ae..53c07c7 100644 --- a/src/conf/storage_adapter_conf.c +++ b/src/conf/storage_adapter_conf.c @@ -19,7 +19,7 @@ =20 #include =20 -#include "storage_adapter_conf.h" +#include "storage_conf.h" =20 #include "viralloc.h" #include "virerror.h" @@ -32,11 +32,10 @@ =20 VIR_LOG_INIT("conf.storage_adapter_conf"); =20 -VIR_ENUM_IMPL(virStoragePoolSourceAdapter, - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST, +VIR_ENUM_IMPL(virStorageAdapter, + VIR_STORAGE_ADAPTER_TYPE_LAST, "default", "scsi_host", "fc_host") =20 - static void virStorageAdapterFCHostClear(virStorageAdapterFCHostPtr fchost) { @@ -50,12 +49,12 @@ virStorageAdapterFCHostClear(virStorageAdapterFCHostPtr= fchost) =20 =20 void -virStorageAdapterClear(virStoragePoolSourceAdapterPtr adapter) +virStorageAdapterClear(virStorageAdapterPtr adapter) { - if (adapter->type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST) virStorageAdapterFCHostClear(&adapter->data.fchost); =20 - if (adapter->type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOS= T) + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) VIR_FREE(adapter->data.scsi_host.name); } =20 @@ -123,7 +122,7 @@ virStorageAdapterSCSIHostParseXML(xmlNodePtr node, static int virStorageAdapterLegacyParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, - virStoragePoolSourceAdapterPtr adapter) + virStorageAdapterPtr adapter) { char *wwnn =3D virXMLPropString(node, "wwnn"); char *wwpn =3D virXMLPropString(node, "wwpn"); @@ -154,14 +153,14 @@ virStorageAdapterLegacyParseXML(xmlNodePtr node, * for scsi_host adapter. */ if ((adapter->data.scsi_host.name =3D virXMLPropString(node, "name"))) - adapter->type =3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST; + adapter->type =3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST; =20 return 0; } =20 =20 int -virStorageAdapterParseXML(virStoragePoolSourcePtr source, +virStorageAdapterParseXML(virStorageAdapterPtr adapter, xmlNodePtr node, xmlXPathContextPtr ctxt) { @@ -172,26 +171,24 @@ virStorageAdapterParseXML(virStoragePoolSourcePtr sou= rce, ctxt->node =3D node; =20 if ((adapter_type =3D virXMLPropString(node, "type"))) { - if ((source->adapter.type =3D - virStoragePoolSourceAdapterTypeFromString(adapter_type)) <=3D= 0) { + if ((adapter->type =3D + virStorageAdapterTypeFromString(adapter_type)) <=3D 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unknown pool adapter type '%s'"), adapter_type); goto cleanup; } =20 - if (source->adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { - if (virStorageAdapterFCHostParseXML(node, &source->adapter.dat= a.fchost) < 0) - goto cleanup; - } else if (source->adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { - if (virStorageAdapterSCSIHostParseXML(node, ctxt, &source->ada= pter.data.scsi_host) < 0) + if ((adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST) && + (virStorageAdapterFCHostParseXML(node, &adapter->data.fchost))= < 0) goto cleanup; =20 - } + if ((adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) && + (virStorageAdapterSCSIHostParseXML(node, ctxt, + &adapter->data.scsi_host)) = < 0) + goto cleanup; } else { - if (virStorageAdapterLegacyParseXML(node, ctxt, &source->adapter) = < 0) + if (virStorageAdapterLegacyParseXML(node, ctxt, adapter) < 0) goto cleanup; } =20 @@ -260,21 +257,19 @@ virStorageAdapterSCSIHostParseValidate(virStorageAdap= terSCSIHostPtr scsi_host) =20 =20 int -virStorageAdapterParseValidate(virStoragePoolDefPtr ret) +virStorageAdapterParseValidate(virStorageAdapterPtr adapter) { - if (!ret->source.adapter.type) { + if (!adapter->type) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing storage pool source adapter")); return -1; } =20 - if (ret->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) - return virStorageAdapterFCHostParseValidate(&ret->source.adapter.d= ata.fchost); + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST) + return virStorageAdapterFCHostParseValidate(&adapter->data.fchost); =20 - if (ret->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) - return virStorageAdapterSCSIHostParseValidate(&ret->source.adapter= .data.scsi_host); + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) + return virStorageAdapterSCSIHostParseValidate(&adapter->data.scsi_= host); =20 return 0; } @@ -285,13 +280,13 @@ virStorageAdapterFCHostFormat(virBufferPtr buf, virStorageAdapterFCHostPtr fchost) { virBufferEscapeString(buf, " parent=3D'%s'", fchost->parent); - if (fchost->managed) - virBufferAsprintf(buf, " managed=3D'%s'", - virTristateBoolTypeToString(fchost->managed)); virBufferEscapeString(buf, " parent_wwnn=3D'%s'", fchost->parent_wwnn); virBufferEscapeString(buf, " parent_wwpn=3D'%s'", fchost->parent_wwpn); virBufferEscapeString(buf, " parent_fabric_wwn=3D'%s'", fchost->parent_fabric_wwn); + if (fchost->managed !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(buf, " managed=3D'%s'", + virTristateBoolTypeToString(fchost->managed)); =20 virBufferAsprintf(buf, " wwnn=3D'%s' wwpn=3D'%s'/>\n", fchost->wwnn, fchost->wwpn); @@ -322,14 +317,14 @@ virStorageAdapterSCSIHostFormat(virBufferPtr buf, =20 void virStorageAdapterFormat(virBufferPtr buf, - virStoragePoolSourcePtr src) + virStorageAdapterPtr adapter) { virBufferAsprintf(buf, "adapter= .type)); + virStorageAdapterTypeToString(adapter->type)); =20 - if (src->adapter.type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_H= OST) - virStorageAdapterFCHostFormat(buf, &src->adapter.data.fchost); + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST) + virStorageAdapterFCHostFormat(buf, &adapter->data.fchost); =20 - if (src->adapter.type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI= _HOST) - virStorageAdapterSCSIHostFormat(buf, &src->adapter.data.scsi_host); + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) + virStorageAdapterSCSIHostFormat(buf, &adapter->data.scsi_host); } diff --git a/src/conf/storage_adapter_conf.h b/src/conf/storage_adapter_con= f.h index ec812a1..730a3ca 100644 --- a/src/conf/storage_adapter_conf.h +++ b/src/conf/storage_adapter_conf.h @@ -23,21 +23,62 @@ # include "virpci.h" # include "virxml.h" =20 -# include "storage_conf.h" + +typedef enum { + VIR_STORAGE_ADAPTER_TYPE_DEFAULT =3D 0, + VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST, + VIR_STORAGE_ADAPTER_TYPE_FC_HOST, + + VIR_STORAGE_ADAPTER_TYPE_LAST, +} virStorageAdapterType; +VIR_ENUM_DECL(virStorageAdapter) + +typedef struct _virStorageAdapterSCSIHost virStorageAdapterSCSIHost; +typedef virStorageAdapterSCSIHost *virStorageAdapterSCSIHostPtr; +struct _virStorageAdapterSCSIHost { + char *name; + virPCIDeviceAddress parentaddr; /* host address */ + int unique_id; + bool has_parent; +}; + +typedef struct _virStorageAdapterFCHost virStorageAdapterFCHost; +typedef virStorageAdapterFCHost *virStorageAdapterFCHostPtr; +struct _virStorageAdapterFCHost { + char *parent; + char *parent_wwnn; + char *parent_wwpn; + char *parent_fabric_wwn; + char *wwnn; + char *wwpn; + int managed; /* enum virTristateSwitch */ +}; + +typedef struct _virStorageAdapter virStorageAdapter; +typedef virStorageAdapter *virStorageAdapterPtr; +struct _virStorageAdapter { + int type; /* virStorageAdapterType */ + + union { + virStorageAdapterSCSIHost scsi_host; + virStorageAdapterFCHost fchost; + } data; +}; + =20 void -virStorageAdapterClear(virStoragePoolSourceAdapterPtr adapter); +virStorageAdapterClear(virStorageAdapterPtr adapter); =20 int -virStorageAdapterParseXML(virStoragePoolSourcePtr source, +virStorageAdapterParseXML(virStorageAdapterPtr adapter, xmlNodePtr node, xmlXPathContextPtr ctxt); =20 int -virStorageAdapterParseValidate(virStoragePoolDefPtr ret); +virStorageAdapterParseValidate(virStorageAdapterPtr adapter); =20 void virStorageAdapterFormat(virBufferPtr buf, - virStoragePoolSourcePtr src); + virStorageAdapterPtr adapter); =20 #endif /* __VIR_STORAGE_ADAPTER_CONF_H__ */ diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index 45dc860..7207605 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -565,7 +565,7 @@ virStoragePoolDefParseSource(xmlXPathContextPtr ctxt, goto cleanup; =20 if ((adapternode =3D virXPathNode("./adapter", ctxt))) { - if (virStorageAdapterParseXML(source, adapternode, ctxt) < 0) + if (virStorageAdapterParseXML(&source->adapter, adapternode, ctxt)= < 0) goto cleanup; } =20 @@ -802,7 +802,7 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) } =20 if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) && - (virStorageAdapterParseValidate(ret)) < 0) + (virStorageAdapterParseValidate(&ret->source.adapter)) < 0) goto error; =20 /* If DEVICE is the only source type, then its required */ @@ -958,9 +958,9 @@ virStoragePoolSourceFormat(virBufferPtr buf, virBufferEscapeString(buf, "\n", src->dir); =20 if ((options->flags & VIR_STORAGE_POOL_SOURCE_ADAPTER) && - (src->adapter.type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_= HOST || - src->adapter.type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCS= I_HOST)) - virStorageAdapterFormat(buf, src); + (src->adapter.type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST || + src->adapter.type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST)) + virStorageAdapterFormat(buf, &src->adapter); =20 if (options->flags & VIR_STORAGE_POOL_SOURCE_NAME) virBufferEscapeString(buf, "%s\n", src->name); @@ -2266,8 +2266,8 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, int ret =3D 1; virStoragePoolObjPtr pool =3D NULL; virStoragePoolObjPtr matchpool =3D NULL; - virStoragePoolSourceAdapterPtr pool_adapter; - virStoragePoolSourceAdapterPtr def_adapter; + virStorageAdapterPtr pool_adapter; + virStorageAdapterPtr def_adapter; =20 /* Check the pool list for duplicate underlying storage */ for (i =3D 0; i < pools->count; i++) { @@ -2306,10 +2306,8 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, pool_adapter =3D &pool->def->source.adapter; def_adapter =3D &def->source.adapter; =20 - if (pool_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST && - def_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { + if (pool_adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST= && + def_adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST)= { virStorageAdapterFCHostPtr pool_fchost =3D &pool_adapter->data.fchost; virStorageAdapterFCHostPtr def_fchost =3D @@ -2319,9 +2317,9 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, STREQ(pool_fchost->wwpn, def_fchost->wwpn)) matchpool =3D pool; } else if (pool_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST && + VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST && def_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { + VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) { virStorageAdapterSCSIHostPtr pool_scsi_host =3D &pool_adapter->data.scsi_host; virStorageAdapterSCSIHostPtr def_scsi_host =3D @@ -2341,9 +2339,9 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, if (pool_hostnum =3D=3D def_hostnum) matchpool =3D pool; } else if (pool_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST && + VIR_STORAGE_ADAPTER_TYPE_FC_HOST && def_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { + VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) { virStorageAdapterFCHostPtr pool_fchost =3D &pool_adapter->data.fchost; virStorageAdapterSCSIHostPtr def_scsi_host =3D @@ -2360,9 +2358,9 @@ virStoragePoolSourceFindDuplicate(virConnectPtr conn, } =20 } else if (pool_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST && + VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST && def_adapter->type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { + VIR_STORAGE_ADAPTER_TYPE_FC_HOST) { virStorageAdapterSCSIHostPtr pool_scsi_host =3D &pool_adapter->data.scsi_host; virStorageAdapterFCHostPtr def_fchost =3D diff --git a/src/conf/storage_conf.h b/src/conf/storage_conf.h index 1012e74..6f20111 100644 --- a/src/conf/storage_conf.h +++ b/src/conf/storage_conf.h @@ -31,6 +31,7 @@ # include "virthread.h" # include "device_conf.h" # include "object_event.h" +# include "storage_adapter_conf.h" =20 # include =20 @@ -170,47 +171,6 @@ struct _virStoragePoolSourceDevice { } geometry; }; =20 -typedef enum { - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_DEFAULT =3D 0, - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST, - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST, - - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_LAST, -} virStoragePoolSourceAdapterType; -VIR_ENUM_DECL(virStoragePoolSourceAdapter) - -typedef struct _virStorageAdapterSCSIHost virStorageAdapterSCSIHost; -typedef virStorageAdapterSCSIHost *virStorageAdapterSCSIHostPtr; -struct _virStorageAdapterSCSIHost { - char *name; - virPCIDeviceAddress parentaddr; /* host address */ - int unique_id; - bool has_parent; -}; - -typedef struct _virStorageAdapterFCHost virStorageAdapterFCHost; -typedef virStorageAdapterFCHost *virStorageAdapterFCHostPtr; -struct _virStorageAdapterFCHost { - char *parent; - char *parent_wwnn; - char *parent_wwpn; - char *parent_fabric_wwn; - char *wwnn; - char *wwpn; - int managed; /* enum virTristateSwitch */ -}; - -typedef struct _virStoragePoolSourceAdapter virStoragePoolSourceAdapter; -typedef virStoragePoolSourceAdapter *virStoragePoolSourceAdapterPtr; -struct _virStoragePoolSourceAdapter { - int type; /* virStoragePoolSourceAdapterType */ - - union { - virStorageAdapterSCSIHost scsi_host; - virStorageAdapterFCHost fchost; - } data; -}; - typedef struct _virStoragePoolSource virStoragePoolSource; typedef virStoragePoolSource *virStoragePoolSourcePtr; struct _virStoragePoolSource { @@ -226,7 +186,7 @@ struct _virStoragePoolSource { char *dir; =20 /* Or an adapter */ - virStoragePoolSourceAdapter adapter; + virStorageAdapter adapter; =20 /* Or a name */ char *name; diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 6a2bdf2..8a9e71b 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -883,8 +883,6 @@ virStoragePoolObjSaveDef; virStoragePoolObjUnlock; virStoragePoolSaveConfig; virStoragePoolSaveState; -virStoragePoolSourceAdapterTypeFromString; -virStoragePoolSourceAdapterTypeToString; virStoragePoolSourceClear; virStoragePoolSourceDeviceClear; virStoragePoolSourceFindDuplicate; diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index 7a5df3f..39fa026 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -2467,8 +2467,7 @@ phypBuildStoragePool(virConnectPtr conn, virStoragePo= olDefPtr def) int exit_status =3D 0; virBuffer buf =3D VIR_BUFFER_INITIALIZER; =20 - if (source.adapter.type !=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) { + if (source.adapter.type !=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) { virReportError(VIR_ERR_XML_ERROR, "%s", _("Only 'scsi_host' adapter is supported")); goto cleanup; diff --git a/src/storage/storage_backend_scsi.c b/src/storage/storage_backe= nd_scsi.c index 77a51ff..ff17409 100644 --- a/src/storage/storage_backend_scsi.c +++ b/src/storage/storage_backend_scsi.c @@ -176,12 +176,12 @@ virStoragePoolFCRefreshThread(void *opaque) } =20 static char * -getAdapterName(virStoragePoolSourceAdapterPtr adapter) +getAdapterName(virStorageAdapterPtr adapter) { char *name =3D NULL; char *parentaddr =3D NULL; =20 - if (adapter->type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOS= T) { + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_SCSI_HOST) { virStorageAdapterSCSIHostPtr scsi_host =3D &adapter->data.scsi_hos= t; =20 if (scsi_host->has_parent) { @@ -197,7 +197,9 @@ getAdapterName(virStoragePoolSourceAdapterPtr adapter) } else { ignore_value(VIR_STRDUP(name, scsi_host->name)); } - } else if (adapter->type =3D=3D VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_F= C_HOST) { + } + + if (adapter->type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_HOST) { virStorageAdapterFCHostPtr fchost =3D &adapter->data.fchost; =20 if (!(name =3D virVHBAGetHostByWWN(NULL, fchost->wwnn, fchost->wwp= n))) { @@ -451,7 +453,7 @@ virStorageBackendSCSICheckPool(virStoragePoolObjPtr poo= l, * the adapter based on might be not created yet. */ if (pool->def->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { + VIR_STORAGE_ADAPTER_TYPE_FC_HOST) { virResetLastError(); return 0; } else { @@ -505,24 +507,24 @@ virStorageBackendSCSIRefreshPool(virConnectPtr conn A= TTRIBUTE_UNUSED, return ret; } =20 + static int virStorageBackendSCSIStartPool(virConnectPtr conn, virStoragePoolObjPtr pool) { - if (pool->def->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) + if (pool->def->source.adapter.type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_= HOST) return createVport(conn, pool->def, pool->configFile, &pool->def->source.adapter.data.fchost); =20 return 0; } =20 + static int virStorageBackendSCSIStopPool(virConnectPtr conn, virStoragePoolObjPtr pool) { - if (pool->def->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) + if (pool->def->source.adapter.type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_= HOST) return deleteVport(conn, &pool->def->source.adapter.data.fchost); =20 return 0; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index cf7820a..18792bc 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -4420,8 +4420,7 @@ testStoragePoolCreateXML(virConnectPtr conn, goto cleanup; def =3D NULL; =20 - if (pool->def->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { + if (pool->def->source.adapter.type =3D=3D VIR_STORAGE_ADAPTER_TYPE_FC_= HOST) { /* In the real code, we'd call virVHBAManageVport followed by * find_new_device, but we cannot do that here since we're not * mocking udev. The mock routine will copy an existing vHBA and @@ -4623,7 +4622,7 @@ testStoragePoolDestroy(virStoragePoolPtr pool) privpool->active =3D 0; =20 if (privpool->def->source.adapter.type =3D=3D - VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) { + VIR_STORAGE_ADAPTER_TYPE_FC_HOST) { if (testDestroyVport(privconn, privpool->def->source.adapter.data.fchost.wwn= n, privpool->def->source.adapter.data.fchost.wwp= n) < 0) --=20 2.9.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list