}
static void
-virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapter adapter)
+virStoragePoolSourceAdapterClear(virStoragePoolSourceAdapterPtr adapter)
{
- if (adapter.type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
- VIR_FREE(adapter.data.fchost.wwnn);
- VIR_FREE(adapter.data.fchost.wwpn);
- VIR_FREE(adapter.data.fchost.parent);
- } else if (adapter.type ==
+ if (adapter->type == VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST) {
+ VIR_FREE(adapter->data.fchost.wwnn);
+ VIR_FREE(adapter->data.fchost.wwpn);
+ VIR_FREE(adapter->data.fchost.parent);
+ } else if (adapter->type ==
VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_SCSI_HOST) {
- VIR_FREE(adapter.data.scsi_host.name);
+ VIR_FREE(adapter->data.scsi_host.name);
}
}
VIR_FREE(source->devices);
VIR_FREE(source->dir);
VIR_FREE(source->name);
- virStoragePoolSourceAdapterClear(source->adapter);
+ virStoragePoolSourceAdapterClear(&source->adapter);
VIR_FREE(source->initiator.iqn);
virStorageAuthDefFree(source->auth);
VIR_FREE(source->vendor);
static int
createVport(virConnectPtr conn,
- virStoragePoolSourceAdapter adapter)
+ virStoragePoolDefPtr def)
{
+ virStoragePoolSourceAdapterPtr adapter = &def->source.adapter;
unsigned int parent_host;
char *name = NULL;
- if (adapter.type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST)
+ if (adapter->type != VIR_STORAGE_POOL_SOURCE_ADAPTER_TYPE_FC_HOST)
return 0;
/* If a parent was provided, then let's make sure it's vhost capable */
- if (adapter.data.fchost.parent) {
- if (virGetSCSIHostNumber(adapter.data.fchost.parent, &parent_host) < 0)
+ if (adapter->data.fchost.parent) {
+ if (virGetSCSIHostNumber(adapter->data.fchost.parent, &parent_host) < 0)
return -1;
if (!virIsCapableFCHost(NULL, parent_host)) {
virReportError(VIR_ERR_XML_ERROR,
_("parent '%s' specified for vHBA "
"is not vport capable"),
- adapter.data.fchost.parent);
+ adapter->data.fchost.parent);
return -1;
}
}
* using the wwnn/wwpn, then a nodedev is already created for
* this pool and we don't have to create the vHBA
*/
- if ((name = virGetFCHostNameByWWN(NULL, adapter.data.fchost.wwnn,
- adapter.data.fchost.wwpn))) {
+ if ((name = virGetFCHostNameByWWN(NULL, adapter->data.fchost.wwnn,
+ adapter->data.fchost.wwpn))) {
int retval = 0;
/* If a parent was provided, let's make sure the 'name' we've
* retrieved has the same parent
*/
- if (adapter.data.fchost.parent &&
- !checkVhbaSCSIHostParent(conn, name, adapter.data.fchost.parent))
+ if (adapter->data.fchost.parent &&
+ !checkVhbaSCSIHostParent(conn, name, adapter->data.fchost.parent))
retval = -1;
VIR_FREE(name);
return retval;
}
- if (!adapter.data.fchost.parent) {
- if (!(adapter.data.fchost.parent = virFindFCHostCapableVport(NULL))) {
+ if (!adapter->data.fchost.parent) {
+ if (!(adapter->data.fchost.parent = virFindFCHostCapableVport(NULL))) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("'parent' for vHBA not specified, and "
"cannot find one on this host"));
return -1;
}
- if (virGetSCSIHostNumber(adapter.data.fchost.parent, &parent_host) < 0)
+ if (virGetSCSIHostNumber(adapter->data.fchost.parent, &parent_host) < 0)
return -1;
}
- if (virManageVport(parent_host, adapter.data.fchost.wwpn,
- adapter.data.fchost.wwnn, VPORT_CREATE) < 0)
+ if (virManageVport(parent_host, adapter->data.fchost.wwpn,
+ adapter->data.fchost.wwnn, VPORT_CREATE) < 0)
return -1;
virFileWaitForDevices();
virStorageBackendSCSIStartPool(virConnectPtr conn,
virStoragePoolObjPtr pool)
{
- virStoragePoolSourceAdapter adapter = pool->def->source.adapter;
- return createVport(conn, adapter);
+ return createVport(conn, pool->def);
}
static int