diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c index b39b97cc91..7c8bc5c237 100644 --- a/src/phyp/phyp_driver.c +++ b/src/phyp/phyp_driver.c @@ -67,13 +67,6 @@ VIR_LOG_INIT("phyp.phyp_driver"); #define SSH_CONN_ERR (-2) /* error while trying to connect to remote host */ #define SSH_CMD_ERR (-3) /* error while trying to execute the remote cmd */ -typedef struct _ConnectionData ConnectionData; -typedef ConnectionData *ConnectionDataPtr; -struct _ConnectionData { - LIBSSH2_SESSION *session; - int sock; -}; - /* This is the lpar (domain) struct that relates * the ID with UUID generated by the API * */ @@ -99,6 +92,9 @@ struct _uuid_table { typedef struct _phyp_driver phyp_driver_t; typedef phyp_driver_t *phyp_driverPtr; struct _phyp_driver { + LIBSSH2_SESSION *session; + int sock; + uuid_tablePtr uuid_table; virCapsPtr caps; virDomainXMLOptionPtr xmlopt; @@ -152,14 +148,14 @@ static char * phypExec(LIBSSH2_SESSION *session, const char *cmd, int *exit_status, virConnectPtr conn) { + phyp_driverPtr phyp_driver = conn->privateData; LIBSSH2_CHANNEL *channel; - ConnectionData *connection_data = conn->networkPrivateData; virBuffer tex_ret = VIR_BUFFER_INITIALIZER; char *buffer = NULL; size_t buffer_size = 16384; int exitcode; int bytecount = 0; - int sock = connection_data->sock; + int sock = phyp_driver->sock; int rc = 0; if (VIR_ALLOC_N(buffer, buffer_size) < 0) @@ -297,8 +293,8 @@ phypExecInt(LIBSSH2_SESSION *session, virBufferPtr buf, virConnectPtr conn, static int phypGetSystemType(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; + phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; char *ret = NULL; int exit_status = 0; @@ -311,9 +307,8 @@ phypGetSystemType(virConnectPtr conn) static int phypGetVIOSPartitionID(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int id = -1; char *managed_system = phyp_driver->managed_system; @@ -377,9 +372,8 @@ phypCapsInit(void) static int phypConnectNumOfDomainsGeneric(virConnectPtr conn, unsigned int type) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int ndom = -1; char *managed_system = phyp_driver->managed_system; @@ -418,9 +412,8 @@ static int phypConnectListDomainsGeneric(virConnectPtr conn, int *ids, int nids, unsigned int type) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -507,8 +500,8 @@ phypUUIDTable_WriteFile(virConnectPtr conn) static int phypUUIDTable_Push(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; + phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; LIBSSH2_CHANNEL *channel = NULL; struct stat local_fileinfo; char buffer[1024]; @@ -692,8 +685,8 @@ phypUUIDTable_ReadFile(virConnectPtr conn) static int phypUUIDTable_Pull(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; + phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; LIBSSH2_CHANNEL *channel = NULL; struct stat fileinfo; char buffer[1024]; @@ -1135,7 +1128,6 @@ phypConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags) { LIBSSH2_SESSION *session = NULL; - ConnectionData *connection_data = NULL; int internal_socket; uuid_tablePtr uuid_table = NULL; phyp_driverPtr phyp_driver = NULL; @@ -1159,13 +1151,11 @@ phypConnectOpen(virConnectPtr conn, if (VIR_ALLOC(phyp_driver) < 0) goto failure; + phyp_driver->sock = -1; + if (VIR_ALLOC(uuid_table) < 0) goto failure; - if (VIR_ALLOC(connection_data) < 0) - goto failure; - connection_data->sock = -1; - if (conn->uri->path) { /* need to shift one byte in order to remove the first "/" of URI component */ if (VIR_STRDUP(managed_system, @@ -1194,8 +1184,8 @@ phypConnectOpen(virConnectPtr conn, goto failure; } - connection_data->session = session; - connection_data->sock = internal_socket; + phyp_driver->session = session; + phyp_driver->sock = internal_socket; uuid_table->nlpars = 0; uuid_table->lpars = NULL; @@ -1212,7 +1202,6 @@ phypConnectOpen(virConnectPtr conn, goto failure; conn->privateData = phyp_driver; - conn->networkPrivateData = connection_data; if ((phyp_driver->system_type = phypGetSystemType(conn)) == -1) goto failure; @@ -1243,9 +1232,7 @@ phypConnectOpen(virConnectPtr conn, libssh2_session_free(session); } - if (connection_data) - VIR_FORCE_CLOSE(connection_data->sock); - VIR_FREE(connection_data); + VIR_FORCE_CLOSE(phyp_driver->sock); return VIR_DRV_OPEN_ERROR; } @@ -1253,9 +1240,8 @@ phypConnectOpen(virConnectPtr conn, static int phypConnectClose(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; libssh2_session_disconnect(session, "Disconnecting..."); libssh2_session_free(session); @@ -1266,8 +1252,7 @@ phypConnectClose(virConnectPtr conn) VIR_FREE(phyp_driver->managed_system); VIR_FREE(phyp_driver); - VIR_FORCE_CLOSE(connection_data->sock); - VIR_FREE(connection_data); + VIR_FORCE_CLOSE(phyp_driver->sock); return 0; } @@ -1291,13 +1276,12 @@ phypConnectIsSecure(virConnectPtr conn ATTRIBUTE_UNUSED) static int phypConnectIsAlive(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; - + phyp_driverPtr phyp_driver = conn->privateData; /* XXX we should be able to do something better but this is simple, safe, * and good enough for now. In worst case, the function will return true * even though the connection is not alive. */ - if (connection_data && connection_data->session) + if (phyp_driver->session) return 1; else return 0; @@ -1384,9 +1368,8 @@ static unsigned long phypGetLparMem(virConnectPtr conn, const char *managed_system, int lpar_id, int type) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int memory = 0; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -1408,9 +1391,8 @@ static unsigned long phypGetLparCPUGeneric(virConnectPtr conn, const char *managed_system, int lpar_id, int type) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int vcpus = 0; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -1456,9 +1438,8 @@ static int phypGetRemoteSlot(virConnectPtr conn, const char *managed_system, const char *lpar_name) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int remote_slot = -1; virBuffer buf = VIR_BUFFER_INITIALIZER; @@ -1479,9 +1460,8 @@ static char * phypGetBackingDevice(virConnectPtr conn, const char *managed_system, char *lpar_name) { - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *ret = NULL; int remote_slot = 0; @@ -1541,9 +1521,8 @@ phypGetBackingDevice(virConnectPtr conn, const char *managed_system, static char * phypGetLparProfile(virConnectPtr conn, int lpar_id) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int exit_status = 0; @@ -1566,9 +1545,8 @@ phypGetLparProfile(virConnectPtr conn, int lpar_id) static int phypGetVIOSNextSlotNumber(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1601,9 +1579,8 @@ static int phypCreateServerSCSIAdapter(virConnectPtr conn) { int result = -1; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1688,9 +1665,8 @@ phypCreateServerSCSIAdapter(virConnectPtr conn) static char * phypGetVIOSFreeSCSIAdapter(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1721,9 +1697,8 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml) { int result = -1; virConnectPtr conn = domain->conn; - ConnectionData *connection_data = domain->conn->networkPrivateData; phyp_driverPtr phyp_driver = domain->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1875,9 +1850,8 @@ phypDomainAttachDevice(virDomainPtr domain, const char *xml) static char * phypStorageVolGetKey(virConnectPtr conn, const char *name) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1905,9 +1879,8 @@ phypStorageVolGetKey(virConnectPtr conn, const char *name) static char * phypGetStoragePoolDevice(virConnectPtr conn, char *name) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1935,9 +1908,8 @@ phypGetStoragePoolDevice(virConnectPtr conn, char *name) static unsigned long int phypGetStoragePoolSize(virConnectPtr conn, char *name) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -1962,9 +1934,8 @@ static char * phypBuildVolume(virConnectPtr conn, const char *lvname, const char *spname, unsigned int capacity) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int vios_id = phyp_driver->vios_id; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; @@ -2114,9 +2085,8 @@ static char * phypStorageVolGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp) { virConnectPtr conn = vol->conn; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2144,9 +2114,8 @@ phypStorageVolGetPhysicalVolumeByStoragePool(virStorageVolPtr vol, char *sp) static virStorageVolPtr phypStorageVolLookupByPath(virConnectPtr conn, const char *volname) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2190,9 +2159,8 @@ phypGetStoragePoolUUID(virConnectPtr conn, unsigned char *uuid, const char *name) { int result = -1; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2317,9 +2285,8 @@ static char * phypStorageVolGetPath(virStorageVolPtr vol) { virConnectPtr conn = vol->conn; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2366,9 +2333,8 @@ phypStoragePoolListVolumes(virStoragePoolPtr pool, char **const volumes, { bool success = false; virConnectPtr conn = pool->conn; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2430,9 +2396,8 @@ static int phypStoragePoolNumOfVolumes(virStoragePoolPtr pool) { virConnectPtr conn = pool->conn; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int nvolumes = -1; char *managed_system = phyp_driver->managed_system; @@ -2458,9 +2423,8 @@ phypStoragePoolDestroy(virStoragePoolPtr pool) { int result = -1; virConnectPtr conn = pool->conn; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int vios_id = phyp_driver->vios_id; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; @@ -2495,9 +2459,8 @@ static int phypBuildStoragePool(virConnectPtr conn, virStoragePoolDefPtr def) { int result = -1; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virStoragePoolSource source = def->source; int vios_id = phyp_driver->vios_id; int system_type = phyp_driver->system_type; @@ -2541,9 +2504,8 @@ phypBuildStoragePool(virConnectPtr conn, virStoragePoolDefPtr def) static int phypConnectNumOfStoragePools(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; int nsp = -1; char *managed_system = phyp_driver->managed_system; @@ -2568,9 +2530,8 @@ static int phypConnectListStoragePools(virConnectPtr conn, char **const pools, int npools) { bool success = false; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -2768,9 +2729,8 @@ phypInterfaceDestroy(virInterfacePtr iface, { virCheckFlags(0, -1); - ConnectionData *connection_data = iface->conn->networkPrivateData; phyp_driverPtr phyp_driver = iface->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virBuffer buf = VIR_BUFFER_INITIALIZER; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; @@ -2832,9 +2792,8 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, { virCheckFlags(0, NULL); - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virBuffer buf = VIR_BUFFER_INITIALIZER; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; @@ -2940,9 +2899,8 @@ phypInterfaceDefineXML(virConnectPtr conn, const char *xml, static virInterfacePtr phypInterfaceLookupByName(virConnectPtr conn, const char *name) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virBuffer buf = VIR_BUFFER_INITIALIZER; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; @@ -3003,9 +2961,8 @@ phypInterfaceLookupByName(virConnectPtr conn, const char *name) static int phypInterfaceIsActive(virInterfacePtr iface) { - ConnectionData *connection_data = iface->conn->networkPrivateData; phyp_driverPtr phyp_driver = iface->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virBuffer buf = VIR_BUFFER_INITIALIZER; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; @@ -3026,9 +2983,8 @@ phypInterfaceIsActive(virInterfacePtr iface) static int phypConnectListInterfaces(virConnectPtr conn, char **const names, int nnames) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int vios_id = phyp_driver->vios_id; @@ -3082,9 +3038,8 @@ phypConnectListInterfaces(virConnectPtr conn, char **const names, int nnames) static int phypConnectNumOfInterfaces(virConnectPtr conn) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; char *managed_system = phyp_driver->managed_system; int system_type = phyp_driver->system_type; int vios_id = phyp_driver->vios_id; @@ -3105,9 +3060,8 @@ phypConnectNumOfInterfaces(virConnectPtr conn) static int phypGetLparState(virConnectPtr conn, unsigned int lpar_id) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *ret = NULL; int exit_status = 0; @@ -3142,8 +3096,7 @@ static int phypDiskType(virConnectPtr conn, char *backing_device) { phyp_driverPtr phyp_driver = conn->privateData; - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *ret = NULL; int exit_status = 0; @@ -3195,9 +3148,8 @@ static int phypConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames) { bool success = false; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -3252,9 +3204,8 @@ phypConnectListDefinedDomains(virConnectPtr conn, char **const names, int nnames static virDomainPtr phypDomainLookupByName(virConnectPtr conn, const char *lpar_name) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virDomainPtr dom = NULL; int lpar_id = 0; char *managed_system = phyp_driver->managed_system; @@ -3278,9 +3229,8 @@ phypDomainLookupByName(virConnectPtr conn, const char *lpar_name) static virDomainPtr phypDomainLookupByID(virConnectPtr conn, int lpar_id) { - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virDomainPtr dom = NULL; char *managed_system = phyp_driver->managed_system; unsigned char lpar_uuid[VIR_UUID_BUFLEN]; @@ -3305,9 +3255,8 @@ phypDomainLookupByID(virConnectPtr conn, int lpar_id) static char * phypDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) { - ConnectionData *connection_data = dom->conn->networkPrivateData; phyp_driverPtr phyp_driver = dom->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; virDomainDef def; char *managed_system = phyp_driver->managed_system; @@ -3359,9 +3308,8 @@ static int phypDomainResume(virDomainPtr dom) { int result = -1; - ConnectionData *connection_data = dom->conn->networkPrivateData; phyp_driverPtr phyp_driver = dom->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -3390,10 +3338,9 @@ static int phypDomainReboot(virDomainPtr dom, unsigned int flags) { int result = -1; - ConnectionData *connection_data = dom->conn->networkPrivateData; virConnectPtr conn = dom->conn; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -3425,10 +3372,9 @@ static int phypDomainShutdown(virDomainPtr dom) { int result = -1; - ConnectionData *connection_data = dom->conn->networkPrivateData; virConnectPtr conn = dom->conn; - LIBSSH2_SESSION *session = connection_data->session; phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -3495,9 +3441,8 @@ phypDomainDestroyFlags(virDomainPtr dom, unsigned int flags) { int result = -1; - ConnectionData *connection_data = dom->conn->networkPrivateData; phyp_driverPtr phyp_driver = dom->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0; @@ -3537,9 +3482,8 @@ static int phypBuildLpar(virConnectPtr conn, virDomainDefPtr def) { int result = -1; - ConnectionData *connection_data = conn->networkPrivateData; phyp_driverPtr phyp_driver = conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; char *ret = NULL; @@ -3607,11 +3551,10 @@ phypDomainCreateXML(virConnectPtr conn, { virCheckFlags(0, NULL); - ConnectionData *connection_data = conn->networkPrivateData; - LIBSSH2_SESSION *session = connection_data->session; + phyp_driverPtr phyp_driver = conn->privateData; + LIBSSH2_SESSION *session = phyp_driver->session; virDomainDefPtr def = NULL; virDomainPtr dom = NULL; - phyp_driverPtr phyp_driver = conn->privateData; uuid_tablePtr uuid_table = phyp_driver->uuid_table; lparPtr *lpars = uuid_table->lpars; size_t i = 0; @@ -3668,9 +3611,8 @@ static int phypDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus, unsigned int flags) { - ConnectionData *connection_data = dom->conn->networkPrivateData; phyp_driverPtr phyp_driver = dom->conn->privateData; - LIBSSH2_SESSION *session = connection_data->session; + LIBSSH2_SESSION *session = phyp_driver->session; int system_type = phyp_driver->system_type; char *managed_system = phyp_driver->managed_system; int exit_status = 0;