[libvirt] [PATCH 06/11] Remove abuse of networkPrivateData in phyp driver

Daniel P. Berrange berrange at redhat.com
Thu Oct 23 15:14:40 UTC 2014


For inexplicable reasons the phyp driver defined two separate
structs for holding its private data. One it keeps in privateData
and the other it keeps in networkPrivateData. It uses them both
from all API driver methods. Merge the two separate structs
into one to remove this horrible abuse.
---
 src/phyp/phyp_driver.c | 190 +++++++++++++++++--------------------------------
 1 file changed, 66 insertions(+), 124 deletions(-)

diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index caab499..8d9e2bf 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -68,13 +68,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
  * */
@@ -100,6 +93,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;
@@ -151,14 +147,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)
@@ -296,8 +292,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;
 
@@ -310,9 +306,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;
@@ -376,9 +371,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;
@@ -417,9 +411,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;
@@ -506,8 +499,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];
@@ -691,8 +684,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];
@@ -1134,7 +1127,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;
@@ -1158,12 +1150,10 @@ phypConnectOpen(virConnectPtr conn,
     if (VIR_ALLOC(phyp_driver) < 0)
         goto failure;
 
-    if (VIR_ALLOC(uuid_table) < 0)
-        goto failure;
+    phyp_driver->sock = -1;
 
-    if (VIR_ALLOC(connection_data) < 0)
+    if (VIR_ALLOC(uuid_table) < 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 */
@@ -1193,8 +1183,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;
@@ -1211,7 +1201,6 @@ phypConnectOpen(virConnectPtr conn,
         goto failure;
 
     conn->privateData = phyp_driver;
-    conn->networkPrivateData = connection_data;
 
     if ((phyp_driver->system_type = phypGetSystemType(conn)) == -1)
         goto failure;
@@ -1242,9 +1231,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;
 }
@@ -1252,9 +1239,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);
@@ -1265,8 +1251,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;
 }
 
@@ -1290,13 +1275,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;
@@ -1383,9 +1367,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;
@@ -1407,9 +1390,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;
@@ -1455,9 +1437,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;
@@ -1478,9 +1459,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;
@@ -1540,9 +1520,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;
@@ -1565,9 +1544,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;
@@ -1600,9 +1578,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;
@@ -1687,9 +1664,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;
@@ -1720,9 +1696,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;
@@ -1874,9 +1849,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;
@@ -1904,9 +1878,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;
@@ -1934,9 +1907,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;
@@ -1961,9 +1933,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;
@@ -2113,9 +2084,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;
@@ -2143,9 +2113,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;
@@ -2189,9 +2158,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;
@@ -2316,9 +2284,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;
@@ -2365,9 +2332,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;
@@ -2429,9 +2395,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;
@@ -2457,9 +2422,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;
@@ -2494,9 +2458,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;
@@ -2540,9 +2503,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;
@@ -2567,9 +2529,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;
@@ -2767,9 +2728,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;
@@ -2831,9 +2791,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;
@@ -2939,9 +2898,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;
@@ -3002,9 +2960,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;
@@ -3025,9 +2982,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;
@@ -3081,9 +3037,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;
@@ -3104,9 +3059,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;
@@ -3141,8 +3095,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;
@@ -3194,9 +3147,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;
@@ -3251,9 +3203,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;
@@ -3277,9 +3228,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];
@@ -3304,9 +3254,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;
 
@@ -3358,9 +3307,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;
@@ -3389,10 +3337,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;
@@ -3424,10 +3371,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;
@@ -3494,9 +3440,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;
@@ -3536,9 +3481,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;
@@ -3606,11 +3550,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;
@@ -3667,9 +3610,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;
-- 
2.1.0




More information about the libvir-list mailing list