Update ESX driver to always use privateData

Since the secondary drivers are only active when the primary
driver is also the ESX driver, there is no need to use the
different type specific privateData fields.
This commit is contained in:
Daniel P. Berrange 2014-10-23 14:33:11 +01:00
parent 9fa26f6c8e
commit e84666c576
8 changed files with 68 additions and 92 deletions

View File

@ -47,18 +47,14 @@ esxNodeDeviceOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->nodeDevicePrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxNodeDeviceClose(virConnectPtr conn) esxNodeDeviceClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->nodeDevicePrivateData = NULL;
return 0; return 0;
} }

View File

@ -50,18 +50,14 @@ esxInterfaceOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->interfacePrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxInterfaceClose(virConnectPtr conn) esxInterfaceClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->interfacePrivateData = NULL;
return 0; return 0;
} }
@ -70,7 +66,7 @@ esxInterfaceClose(virConnectPtr conn)
static int static int
esxConnectNumOfInterfaces(virConnectPtr conn) esxConnectNumOfInterfaces(virConnectPtr conn)
{ {
esxPrivate *priv = conn->interfacePrivateData; esxPrivate *priv = conn->privateData;
esxVI_PhysicalNic *physicalNicList = NULL; esxVI_PhysicalNic *physicalNicList = NULL;
esxVI_PhysicalNic *physicalNic = NULL; esxVI_PhysicalNic *physicalNic = NULL;
int count = 0; int count = 0;
@ -96,7 +92,7 @@ static int
esxConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames) esxConnectListInterfaces(virConnectPtr conn, char **const names, int maxnames)
{ {
bool success = false; bool success = false;
esxPrivate *priv = conn->interfacePrivateData; esxPrivate *priv = conn->privateData;
esxVI_PhysicalNic *physicalNicList = NULL; esxVI_PhysicalNic *physicalNicList = NULL;
esxVI_PhysicalNic *physicalNic = NULL; esxVI_PhysicalNic *physicalNic = NULL;
int count = 0; int count = 0;
@ -161,7 +157,7 @@ static virInterfacePtr
esxInterfaceLookupByName(virConnectPtr conn, const char *name) esxInterfaceLookupByName(virConnectPtr conn, const char *name)
{ {
virInterfacePtr iface = NULL; virInterfacePtr iface = NULL;
esxPrivate *priv = conn->interfacePrivateData; esxPrivate *priv = conn->privateData;
esxVI_PhysicalNic *physicalNic = NULL; esxVI_PhysicalNic *physicalNic = NULL;
if (esxVI_EnsureSession(priv->primary) < 0 || if (esxVI_EnsureSession(priv->primary) < 0 ||
@ -183,7 +179,7 @@ static virInterfacePtr
esxInterfaceLookupByMACString(virConnectPtr conn, const char *mac) esxInterfaceLookupByMACString(virConnectPtr conn, const char *mac)
{ {
virInterfacePtr iface = NULL; virInterfacePtr iface = NULL;
esxPrivate *priv = conn->interfacePrivateData; esxPrivate *priv = conn->privateData;
esxVI_PhysicalNic *physicalNic = NULL; esxVI_PhysicalNic *physicalNic = NULL;
if (esxVI_EnsureSession(priv->primary) < 0 || if (esxVI_EnsureSession(priv->primary) < 0 ||
@ -205,7 +201,7 @@ static char *
esxInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags) esxInterfaceGetXMLDesc(virInterfacePtr iface, unsigned int flags)
{ {
char *xml = NULL; char *xml = NULL;
esxPrivate *priv = iface->conn->interfacePrivateData; esxPrivate *priv = iface->conn->privateData;
esxVI_PhysicalNic *physicalNic = NULL; esxVI_PhysicalNic *physicalNic = NULL;
virInterfaceDef def; virInterfaceDef def;
bool hasAddress = false; bool hasAddress = false;

View File

@ -56,18 +56,14 @@ esxNetworkOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->networkPrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxNetworkClose(virConnectPtr conn) esxNetworkClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->networkPrivateData = NULL;
return 0; return 0;
} }
@ -76,7 +72,7 @@ esxNetworkClose(virConnectPtr conn)
static int static int
esxConnectNumOfNetworks(virConnectPtr conn) esxConnectNumOfNetworks(virConnectPtr conn)
{ {
esxPrivate *priv = conn->networkPrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
int count = 0; int count = 0;
@ -103,7 +99,7 @@ static int
esxConnectListNetworks(virConnectPtr conn, char **const names, int maxnames) esxConnectListNetworks(virConnectPtr conn, char **const names, int maxnames)
{ {
bool success = false; bool success = false;
esxPrivate *priv = conn->networkPrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
int count = 0; int count = 0;
@ -169,7 +165,7 @@ static virNetworkPtr
esxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid) esxNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{ {
virNetworkPtr network = NULL; virNetworkPtr network = NULL;
esxPrivate *priv = conn->networkPrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitchList = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
@ -214,7 +210,7 @@ static virNetworkPtr
esxNetworkLookupByName(virConnectPtr conn, const char *name) esxNetworkLookupByName(virConnectPtr conn, const char *name)
{ {
virNetworkPtr network = NULL; virNetworkPtr network = NULL;
esxPrivate *priv = conn->networkPrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ unsigned char md5[MD5_DIGEST_SIZE]; /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
@ -318,7 +314,7 @@ static virNetworkPtr
esxNetworkDefineXML(virConnectPtr conn, const char *xml) esxNetworkDefineXML(virConnectPtr conn, const char *xml)
{ {
virNetworkPtr network = NULL; virNetworkPtr network = NULL;
esxPrivate *priv = conn->networkPrivateData; esxPrivate *priv = conn->privateData;
virNetworkDefPtr def = NULL; virNetworkDefPtr def = NULL;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
esxVI_HostPortGroup *hostPortGroupList = NULL; esxVI_HostPortGroup *hostPortGroupList = NULL;
@ -527,7 +523,7 @@ static int
esxNetworkUndefine(virNetworkPtr network) esxNetworkUndefine(virNetworkPtr network)
{ {
int result = -1; int result = -1;
esxPrivate *priv = network->conn->networkPrivateData; esxPrivate *priv = network->conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
esxVI_HostPortGroup *hostPortGroupList = NULL; esxVI_HostPortGroup *hostPortGroupList = NULL;
esxVI_String *hostPortGroupKey = NULL; esxVI_String *hostPortGroupKey = NULL;
@ -670,7 +666,7 @@ static char *
esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags) esxNetworkGetXMLDesc(virNetworkPtr network_, unsigned int flags)
{ {
char *xml = NULL; char *xml = NULL;
esxPrivate *priv = network_->conn->networkPrivateData; esxPrivate *priv = network_->conn->privateData;
esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL; esxVI_HostVirtualSwitch *hostVirtualSwitch = NULL;
int count = 0; int count = 0;
esxVI_PhysicalNic *physicalNicList = NULL; esxVI_PhysicalNic *physicalNicList = NULL;

View File

@ -47,18 +47,14 @@ esxNWFilterOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->nwfilterPrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxNWFilterClose(virConnectPtr conn) esxNWFilterClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->nwfilterPrivateData = NULL;
return 0; return 0;
} }

View File

@ -45,18 +45,14 @@ esxSecretOpen(virConnectPtr conn, virConnectAuthPtr auth ATTRIBUTE_UNUSED,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->secretPrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxSecretClose(virConnectPtr conn) esxSecretClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->secretPrivateData = NULL;
return 0; return 0;
} }

View File

@ -54,7 +54,7 @@ esxConnectNumOfStoragePools(virConnectPtr conn)
{ {
bool success = false; bool success = false;
int count = 0; int count = 0;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL; esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target; esxVI_HostInternetScsiHbaStaticTarget *target;
@ -99,7 +99,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names,
{ {
bool success = false; bool success = false;
int count = 0; int count = 0;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL; esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target; esxVI_HostInternetScsiHbaStaticTarget *target;
size_t i; size_t i;
@ -156,7 +156,7 @@ static virStoragePoolPtr
esxStoragePoolLookupByName(virConnectPtr conn, esxStoragePoolLookupByName(virConnectPtr conn,
const char *name) const char *name)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHbaStaticTarget *target = NULL; esxVI_HostInternetScsiHbaStaticTarget *target = NULL;
/* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
unsigned char md5[MD5_DIGEST_SIZE]; unsigned char md5[MD5_DIGEST_SIZE];
@ -199,7 +199,7 @@ esxStoragePoolLookupByUUID(virConnectPtr conn,
const unsigned char *uuid) const unsigned char *uuid)
{ {
virStoragePoolPtr pool = NULL; virStoragePoolPtr pool = NULL;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL; esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target; esxVI_HostInternetScsiHbaStaticTarget *target;
/* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
@ -248,7 +248,7 @@ esxStoragePoolRefresh(virStoragePoolPtr pool,
unsigned int flags) unsigned int flags)
{ {
int result = -1; int result = -1;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL; esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -295,7 +295,7 @@ static char *
esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags) esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
{ {
char *xml = NULL; char *xml = NULL;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL; esxVI_HostInternetScsiHba *hostInternetScsiHba = NULL;
esxVI_HostInternetScsiHbaStaticTarget *target; esxVI_HostInternetScsiHbaStaticTarget *target;
virStoragePoolDef def; virStoragePoolDef def;
@ -358,7 +358,7 @@ static int
esxStoragePoolNumOfVolumes(virStoragePoolPtr pool) esxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
{ {
int count = 0; int count = 0;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostScsiTopologyLun *hostScsiTopologyLunList = NULL; esxVI_HostScsiTopologyLun *hostScsiTopologyLunList = NULL;
esxVI_HostScsiTopologyLun *hostScsiTopologyLun; esxVI_HostScsiTopologyLun *hostScsiTopologyLun;
@ -386,7 +386,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
{ {
bool success = false; bool success = false;
int count = 0; int count = 0;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostScsiTopologyLun *hostScsiTopologyLunList = NULL; esxVI_HostScsiTopologyLun *hostScsiTopologyLunList = NULL;
esxVI_HostScsiTopologyLun *hostScsiTopologyLun; esxVI_HostScsiTopologyLun *hostScsiTopologyLun;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
@ -445,7 +445,7 @@ esxStorageVolLookupByName(virStoragePoolPtr pool,
const char *name) const char *name)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun; esxVI_ScsiLun *scsiLun;
/* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
@ -491,7 +491,7 @@ static virStorageVolPtr
esxStorageVolLookupByPath(virConnectPtr conn, const char *path) esxStorageVolLookupByPath(virConnectPtr conn, const char *path)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun; esxVI_ScsiLun *scsiLun;
esxVI_HostScsiDisk *hostScsiDisk = NULL; esxVI_HostScsiDisk *hostScsiDisk = NULL;
@ -539,7 +539,7 @@ static virStorageVolPtr
esxStorageVolLookupByKey(virConnectPtr conn, const char *key) esxStorageVolLookupByKey(virConnectPtr conn, const char *key)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
char *poolName = NULL; char *poolName = NULL;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun; esxVI_ScsiLun *scsiLun;
@ -626,7 +626,7 @@ esxStorageVolGetInfo(virStorageVolPtr volume,
virStorageVolInfoPtr info) virStorageVolInfoPtr info)
{ {
int result = -1; int result = -1;
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun; esxVI_ScsiLun *scsiLun;
esxVI_HostScsiDisk *hostScsiDisk = NULL; esxVI_HostScsiDisk *hostScsiDisk = NULL;
@ -672,7 +672,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume,
unsigned int flags) unsigned int flags)
{ {
char *xml = NULL; char *xml = NULL;
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStoragePoolDef pool; virStoragePoolDef pool;
esxVI_ScsiLun *scsiLunList = NULL; esxVI_ScsiLun *scsiLunList = NULL;
esxVI_ScsiLun *scsiLun; esxVI_ScsiLun *scsiLun;

View File

@ -116,7 +116,7 @@ static int
esxConnectNumOfStoragePools(virConnectPtr conn) esxConnectNumOfStoragePools(virConnectPtr conn)
{ {
int count = 0; int count = 0;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_ObjectContent *datastoreList = NULL; esxVI_ObjectContent *datastoreList = NULL;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
@ -141,7 +141,7 @@ esxConnectListStoragePools(virConnectPtr conn, char **const names,
const int maxnames) const int maxnames)
{ {
bool success = false; bool success = false;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL; esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_ObjectContent *datastoreList = NULL; esxVI_ObjectContent *datastoreList = NULL;
@ -204,7 +204,7 @@ static virStoragePoolPtr
esxStoragePoolLookupByName(virConnectPtr conn, esxStoragePoolLookupByName(virConnectPtr conn,
const char *name) const char *name)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
esxVI_DatastoreHostMount *hostMount = NULL; esxVI_DatastoreHostMount *hostMount = NULL;
/* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */ /* MD5_DIGEST_SIZE = VIR_UUID_BUFLEN = 16 */
@ -257,7 +257,7 @@ static virStoragePoolPtr
esxStoragePoolLookupByUUID(virConnectPtr conn, esxStoragePoolLookupByUUID(virConnectPtr conn,
const unsigned char *uuid) const unsigned char *uuid)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *datastoreList = NULL; esxVI_ObjectContent *datastoreList = NULL;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
@ -326,7 +326,7 @@ static int
esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags) esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags)
{ {
int result = -1; int result = -1;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
virCheckFlags(0, -1); virCheckFlags(0, -1);
@ -352,7 +352,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool,
virStoragePoolInfoPtr info) virStoragePoolInfoPtr info)
{ {
int result = -1; int result = -1;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
esxVI_DynamicProperty *dynamicProperty = NULL; esxVI_DynamicProperty *dynamicProperty = NULL;
@ -411,7 +411,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool,
static char * static char *
esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags) esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
esxVI_DatastoreHostMount *hostMount = NULL; esxVI_DatastoreHostMount *hostMount = NULL;
@ -531,7 +531,7 @@ static int
esxStoragePoolNumOfVolumes(virStoragePoolPtr pool) esxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
{ {
bool success = false; bool success = false;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostDatastoreBrowserSearchResults *searchResultsList = NULL; esxVI_HostDatastoreBrowserSearchResults *searchResultsList = NULL;
esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL; esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL;
esxVI_FileInfo *fileInfo = NULL; esxVI_FileInfo *fileInfo = NULL;
@ -566,7 +566,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
int maxnames) int maxnames)
{ {
bool success = false; bool success = false;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
esxVI_HostDatastoreBrowserSearchResults *searchResultsList = NULL; esxVI_HostDatastoreBrowserSearchResults *searchResultsList = NULL;
esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL; esxVI_HostDatastoreBrowserSearchResults *searchResults = NULL;
esxVI_FileInfo *fileInfo = NULL; esxVI_FileInfo *fileInfo = NULL;
@ -646,7 +646,7 @@ esxStorageVolLookupByName(virStoragePoolPtr pool,
const char *name) const char *name)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
char *datastorePath = NULL; char *datastorePath = NULL;
char *key = NULL; char *key = NULL;
@ -674,7 +674,7 @@ static virStorageVolPtr
esxStorageVolLookupByPath(virConnectPtr conn, const char *path) esxStorageVolLookupByPath(virConnectPtr conn, const char *path)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
char *datastoreName = NULL; char *datastoreName = NULL;
char *directoryAndFileName = NULL; char *directoryAndFileName = NULL;
char *key = NULL; char *key = NULL;
@ -706,7 +706,7 @@ static virStorageVolPtr
esxStorageVolLookupByKey(virConnectPtr conn, const char *key) esxStorageVolLookupByKey(virConnectPtr conn, const char *key)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
esxVI_String *propertyNameList = NULL; esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *datastoreList = NULL; esxVI_ObjectContent *datastoreList = NULL;
esxVI_ObjectContent *datastore = NULL; esxVI_ObjectContent *datastore = NULL;
@ -842,7 +842,7 @@ esxStorageVolCreateXML(virStoragePoolPtr pool,
unsigned int flags) unsigned int flags)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStoragePoolDef poolDef; virStoragePoolDef poolDef;
virStorageVolDefPtr def = NULL; virStorageVolDefPtr def = NULL;
char *tmp; char *tmp;
@ -1064,7 +1064,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool,
unsigned int flags) unsigned int flags)
{ {
virStorageVolPtr volume = NULL; virStorageVolPtr volume = NULL;
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStoragePoolDef poolDef; virStoragePoolDef poolDef;
char *sourceDatastorePath = NULL; char *sourceDatastorePath = NULL;
virStorageVolDefPtr def = NULL; virStorageVolDefPtr def = NULL;
@ -1248,7 +1248,7 @@ static int
esxStorageVolDelete(virStorageVolPtr volume, unsigned int flags) esxStorageVolDelete(virStorageVolPtr volume, unsigned int flags)
{ {
int result = -1; int result = -1;
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
char *datastorePath = NULL; char *datastorePath = NULL;
esxVI_ManagedObjectReference *task = NULL; esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
@ -1291,7 +1291,7 @@ static int
esxStorageVolWipe(virStorageVolPtr volume, unsigned int flags) esxStorageVolWipe(virStorageVolPtr volume, unsigned int flags)
{ {
int result = -1; int result = -1;
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
char *datastorePath = NULL; char *datastorePath = NULL;
esxVI_ManagedObjectReference *task = NULL; esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState; esxVI_TaskInfoState taskInfoState;
@ -1335,7 +1335,7 @@ esxStorageVolGetInfo(virStorageVolPtr volume,
virStorageVolInfoPtr info) virStorageVolInfoPtr info)
{ {
int result = -1; int result = -1;
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
char *datastorePath = NULL; char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL; esxVI_FileInfo *fileInfo = NULL;
esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL; esxVI_VmDiskFileInfo *vmDiskFileInfo = NULL;
@ -1379,7 +1379,7 @@ static char *
esxStorageVolGetXMLDesc(virStorageVolPtr volume, esxStorageVolGetXMLDesc(virStorageVolPtr volume,
unsigned int flags) unsigned int flags)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStoragePoolDef pool; virStoragePoolDef pool;
char *datastorePath = NULL; char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL; esxVI_FileInfo *fileInfo = NULL;

View File

@ -64,18 +64,14 @@ esxStorageOpen(virConnectPtr conn,
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
} }
conn->storagePrivateData = conn->privateData;
return VIR_DRV_OPEN_SUCCESS; return VIR_DRV_OPEN_SUCCESS;
} }
static int static int
esxStorageClose(virConnectPtr conn) esxStorageClose(virConnectPtr conn ATTRIBUTE_UNUSED)
{ {
conn->storagePrivateData = NULL;
return 0; return 0;
} }
@ -85,7 +81,7 @@ static int
esxConnectNumOfStoragePools(virConnectPtr conn) esxConnectNumOfStoragePools(virConnectPtr conn)
{ {
int count = 0; int count = 0;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
size_t i; size_t i;
int tmp; int tmp;
@ -112,7 +108,7 @@ static int
esxConnectListStoragePools(virConnectPtr conn, char **const names, int maxnames) esxConnectListStoragePools(virConnectPtr conn, char **const names, int maxnames)
{ {
bool success = false; bool success = false;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
int count = 0; int count = 0;
size_t i; size_t i;
int tmp; int tmp;
@ -174,7 +170,7 @@ esxConnectListDefinedStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED,
static virStoragePoolPtr static virStoragePoolPtr
esxStoragePoolLookupByName(virConnectPtr conn, const char *name) esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
size_t i; size_t i;
virStoragePoolPtr pool; virStoragePoolPtr pool;
@ -203,7 +199,7 @@ esxStoragePoolLookupByName(virConnectPtr conn, const char *name)
static virStoragePoolPtr static virStoragePoolPtr
esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid) esxStoragePoolLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
size_t i; size_t i;
virStoragePoolPtr pool; virStoragePoolPtr pool;
char uuid_string[VIR_UUID_STRING_BUFLEN] = ""; char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
@ -242,7 +238,7 @@ esxStoragePoolLookupByVolume(virStorageVolPtr volume)
static int static int
esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags) esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, -1); virCheckNonNullArgReturn(pool->privateData, -1);
@ -259,7 +255,7 @@ esxStoragePoolRefresh(virStoragePoolPtr pool, unsigned int flags)
static int static int
esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info) esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, -1); virCheckNonNullArgReturn(pool->privateData, -1);
@ -278,7 +274,7 @@ esxStoragePoolGetInfo(virStoragePoolPtr pool, virStoragePoolInfoPtr info)
static char * static char *
esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags) esxStoragePoolGetXMLDesc(virStoragePoolPtr pool, unsigned int flags)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, NULL); virCheckNonNullArgReturn(pool->privateData, NULL);
@ -325,7 +321,7 @@ esxStoragePoolSetAutostart(virStoragePoolPtr pool ATTRIBUTE_UNUSED,
static int static int
esxStoragePoolNumOfVolumes(virStoragePoolPtr pool) esxStoragePoolNumOfVolumes(virStoragePoolPtr pool)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, -1); virCheckNonNullArgReturn(pool->privateData, -1);
@ -343,7 +339,7 @@ static int
esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names, esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
int maxnames) int maxnames)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, -1); virCheckNonNullArgReturn(pool->privateData, -1);
@ -360,7 +356,7 @@ esxStoragePoolListVolumes(virStoragePoolPtr pool, char **const names,
static virStorageVolPtr static virStorageVolPtr
esxStorageVolLookupByName(virStoragePoolPtr pool, const char *name) esxStorageVolLookupByName(virStoragePoolPtr pool, const char *name)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, NULL); virCheckNonNullArgReturn(pool->privateData, NULL);
@ -377,7 +373,7 @@ esxStorageVolLookupByName(virStoragePoolPtr pool, const char *name)
static virStorageVolPtr static virStorageVolPtr
esxStorageVolLookupByPath(virConnectPtr conn, const char *path) esxStorageVolLookupByPath(virConnectPtr conn, const char *path)
{ {
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
if (esxVI_EnsureSession(priv->primary) < 0) { if (esxVI_EnsureSession(priv->primary) < 0) {
return NULL; return NULL;
@ -409,7 +405,7 @@ static virStorageVolPtr
esxStorageVolLookupByKey(virConnectPtr conn, const char *key) esxStorageVolLookupByKey(virConnectPtr conn, const char *key)
{ {
virStorageVolPtr volume; virStorageVolPtr volume;
esxPrivate *priv = conn->storagePrivateData; esxPrivate *priv = conn->privateData;
size_t i; size_t i;
if (esxVI_EnsureSession(priv->primary) < 0) { if (esxVI_EnsureSession(priv->primary) < 0) {
@ -437,7 +433,7 @@ static virStorageVolPtr
esxStorageVolCreateXML(virStoragePoolPtr pool, const char *xmldesc, esxStorageVolCreateXML(virStoragePoolPtr pool, const char *xmldesc,
unsigned int flags) unsigned int flags)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, NULL); virCheckNonNullArgReturn(pool->privateData, NULL);
@ -455,7 +451,7 @@ static virStorageVolPtr
esxStorageVolCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc, esxStorageVolCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
virStorageVolPtr sourceVolume, unsigned int flags) virStorageVolPtr sourceVolume, unsigned int flags)
{ {
esxPrivate *priv = pool->conn->storagePrivateData; esxPrivate *priv = pool->conn->privateData;
virStorageDriverPtr backend = pool->privateData; virStorageDriverPtr backend = pool->privateData;
virCheckNonNullArgReturn(pool->privateData, NULL); virCheckNonNullArgReturn(pool->privateData, NULL);
@ -472,7 +468,7 @@ esxStorageVolCreateXMLFrom(virStoragePoolPtr pool, const char *xmldesc,
static int static int
esxStorageVolDelete(virStorageVolPtr volume, unsigned int flags) esxStorageVolDelete(virStorageVolPtr volume, unsigned int flags)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStorageDriverPtr backend = volume->privateData; virStorageDriverPtr backend = volume->privateData;
virCheckNonNullArgReturn(volume->privateData, -1); virCheckNonNullArgReturn(volume->privateData, -1);
@ -489,7 +485,7 @@ esxStorageVolDelete(virStorageVolPtr volume, unsigned int flags)
static int static int
esxStorageVolWipe(virStorageVolPtr volume, unsigned int flags) esxStorageVolWipe(virStorageVolPtr volume, unsigned int flags)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStorageDriverPtr backend = volume->privateData; virStorageDriverPtr backend = volume->privateData;
virCheckNonNullArgReturn(volume->privateData, -1); virCheckNonNullArgReturn(volume->privateData, -1);
@ -506,7 +502,7 @@ esxStorageVolWipe(virStorageVolPtr volume, unsigned int flags)
static int static int
esxStorageVolGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info) esxStorageVolGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStorageDriverPtr backend = volume->privateData; virStorageDriverPtr backend = volume->privateData;
virCheckNonNullArgReturn(volume->privateData, -1); virCheckNonNullArgReturn(volume->privateData, -1);
@ -523,7 +519,7 @@ esxStorageVolGetInfo(virStorageVolPtr volume, virStorageVolInfoPtr info)
static char * static char *
esxStorageVolGetXMLDesc(virStorageVolPtr volume, unsigned int flags) esxStorageVolGetXMLDesc(virStorageVolPtr volume, unsigned int flags)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStorageDriverPtr backend = volume->privateData; virStorageDriverPtr backend = volume->privateData;
virCheckNonNullArgReturn(volume->privateData, NULL); virCheckNonNullArgReturn(volume->privateData, NULL);
@ -540,7 +536,7 @@ esxStorageVolGetXMLDesc(virStorageVolPtr volume, unsigned int flags)
static char * static char *
esxStorageVolGetPath(virStorageVolPtr volume) esxStorageVolGetPath(virStorageVolPtr volume)
{ {
esxPrivate *priv = volume->conn->storagePrivateData; esxPrivate *priv = volume->conn->privateData;
virStorageDriverPtr backend = volume->privateData; virStorageDriverPtr backend = volume->privateData;
virCheckNonNullArgReturn(volume->privateData, NULL); virCheckNonNullArgReturn(volume->privateData, NULL);