]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: Stop passing around virConnectPtr for error reporting
authorMatthias Bolte <matthias.bolte@googlemail.com>
Fri, 15 Jan 2010 22:05:26 +0000 (23:05 +0100)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Tue, 26 Jan 2010 00:19:23 +0000 (01:19 +0100)
14 files changed:
src/esx/esx_driver.c
src/esx/esx_util.c
src/esx/esx_util.h
src/esx/esx_vi.c
src/esx/esx_vi.h
src/esx/esx_vi_methods.c
src/esx/esx_vi_methods.h
src/esx/esx_vi_types.c
src/esx/esx_vi_types.h
src/esx/esx_vmx.c
src/esx/esx_vmx.h
tests/esxutilstest.c
tests/vmx2xmltest.c
tests/xml2vmxtest.c

index a1cb04973bf40192bdb05a7b2e7ba0175a220206..fc254c632073631912e34a506e757d3382e50ed3 100644 (file)
@@ -46,8 +46,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_ERROR(conn, code, fmt...)                                         \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_ERROR(code, fmt...)                                               \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, fmt)
 
 static int esxDomainGetMaxVcpus(virDomainPtr domain);
@@ -55,9 +55,8 @@ static int esxDomainGetMaxVcpus(virDomainPtr domain);
 
 
 static esxVI_Boolean
-esxSupportsLongMode(virConnectPtr conn)
+esxSupportsLongMode(esxPrivate *priv)
 {
-    esxPrivate *priv = (esxPrivate *)conn->privateData;
     esxVI_String *propertyNameList = NULL;
     esxVI_ObjectContent *hostSystem = NULL;
     esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -70,21 +69,20 @@ esxSupportsLongMode(virConnectPtr conn)
         return priv->supportsLongMode;
     }
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "hardware.cpuFeature") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host,
-                                        priv->host->hostFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
                                         "HostSystem", propertyNameList,
                                         esxVI_Boolean_True, &hostSystem) < 0) {
         goto failure;
     }
 
     if (hostSystem == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve the HostSystem object");
         goto failure;
     }
@@ -93,7 +91,7 @@ esxSupportsLongMode(virConnectPtr conn)
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "hardware.cpuFeature")) {
             if (esxVI_HostCpuIdInfo_CastListFromAnyType
-                  (conn, dynamicProperty->val, &hostCpuIdInfoList) < 0) {
+                  (dynamicProperty->val, &hostCpuIdInfoList) < 0) {
                 goto failure;
             }
 
@@ -107,7 +105,7 @@ esxSupportsLongMode(virConnectPtr conn)
                     if (sscanf(hostCpuIdInfo->edx,
                                "%*c%*c%c%*c:"_SKIP12":"_SKIP12":%*c%*c%*c%c",
                                &edxLongModeBit, &edxFirstBit) != 2) {
-                        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                                   "HostSystem property 'hardware.cpuFeature[].edx' "
                                   "with value '%s' doesn't have expected format "
                                   "'----:----:----:----:----:----:----:----'",
@@ -123,7 +121,7 @@ esxSupportsLongMode(virConnectPtr conn)
                     } else if (edxLongModeBit == '0') {
                         priv->supportsLongMode = esxVI_Boolean_False;
                     } else {
-                        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                                   "Bit 29 (Long Mode) of HostSystem property "
                                   "'hardware.cpuFeature[].edx' with value '%s' "
                                   "has unexpected value '%c', expecting '0' "
@@ -157,9 +155,9 @@ esxSupportsLongMode(virConnectPtr conn)
 
 
 static virCapsPtr
-esxCapsInit(virConnectPtr conn)
+esxCapsInit(esxPrivate *priv)
 {
-    esxVI_Boolean supportsLongMode = esxSupportsLongMode(conn);
+    esxVI_Boolean supportsLongMode = esxSupportsLongMode(priv);
     virCapsPtr caps = NULL;
     virCapsGuestPtr guest = NULL;
 
@@ -174,7 +172,7 @@ esxCapsInit(virConnectPtr conn)
     }
 
     if (caps == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         return NULL;
     }
 
@@ -294,7 +292,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
 
     /* Allocate per-connection private data */
     if (VIR_ALLOC(priv) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -304,7 +302,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
     priv->autoAnswer = esxVI_Boolean_False;
     priv->usedCpuTimeCounterId = -1;
 
-    if (esxUtil_ParseQuery(conn, &priv->transport, &vCenter, &noVerify,
+    if (esxUtil_ParseQuery(conn->uri, &priv->transport, &vCenter, &noVerify,
                            &autoAnswer) < 0) {
         goto failure;
     }
@@ -336,14 +334,14 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
     }
 
     /* Login to host */
-    if (esxUtil_ResolveHostname(conn, conn->uri->server, hostIpAddress,
+    if (esxUtil_ResolveHostname(conn->uri->server, hostIpAddress,
                                 NI_MAXHOST) < 0) {
         goto failure;
     }
 
     if (virAsprintf(&url, "%s://%s:%d/sdk", priv->transport,
                     conn->uri->server, conn->uri->port) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -351,56 +349,56 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
         username = strdup(conn->uri->user);
 
         if (username == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     } else {
         username = esxUtil_RequestUsername(auth, "root", conn->uri->server);
 
         if (username == NULL) {
-            ESX_ERROR(conn, VIR_ERR_AUTH_FAILED, "Username request failed");
+            ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
             goto failure;
         }
     }
 
-    if (esxVI_Context_Alloc(conn, &priv->host) < 0) {
+    if (esxVI_Context_Alloc(&priv->host) < 0) {
         goto failure;
     }
 
     password = esxUtil_RequestPassword(auth, username, conn->uri->server);
 
     if (password == NULL) {
-        ESX_ERROR(conn, VIR_ERR_AUTH_FAILED, "Password request failed");
+        ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
         goto failure;
     }
 
-    if (esxVI_Context_Connect(conn, priv->host, url, hostIpAddress,
-                              username, password, noVerify) < 0) {
+    if (esxVI_Context_Connect(priv->host, url, hostIpAddress, username,
+                              password, noVerify) < 0) {
         goto failure;
     }
 
     if (STRCASEEQ(conn->uri->scheme, "esx")) {
         if (priv->host->productVersion != esxVI_ProductVersion_ESX35 &&
             priv->host->productVersion != esxVI_ProductVersion_ESX40) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "%s is neither an ESX 3.5 host nor an ESX 4.0 host",
                       conn->uri->server);
             goto failure;
         }
     } else { /* GSX */
         if (priv->host->productVersion != esxVI_ProductVersion_GSX20) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "%s isn't a GSX 2.0 host", conn->uri->server);
             goto failure;
         }
     }
 
     /* Query the host for maintenance mode and vCenter IP address */
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "runtime.inMaintenanceMode\0"
                                            "summary.managementServerIp\0") < 0 ||
-        esxVI_LookupHostSystemByIp(conn, priv->host, hostIpAddress,
-                                   propertyNameList, &hostSystem) < 0) {
+        esxVI_LookupHostSystemByIp(priv->host, hostIpAddress, propertyNameList,
+                                   &hostSystem) < 0) {
         goto failure;
     }
 
@@ -408,7 +406,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
     for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "runtime.inMaintenanceMode")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Boolean) < 0) {
                 goto failure;
             }
@@ -429,7 +427,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
 
         /* If a vCenter is specified resolve the hostname */
         if (STRNEQ(vCenter, "*") &&
-            esxUtil_ResolveHostname(conn, vCenter, vCenterIpAddress,
+            esxUtil_ResolveHostname(vCenter, vCenterIpAddress,
                                     NI_MAXHOST) < 0) {
             goto failure;
         }
@@ -438,7 +436,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
         for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
              dynamicProperty = dynamicProperty->_next) {
             if (STREQ(dynamicProperty->name, "summary.managementServerIp")) {
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_String) < 0) {
                     goto failure;
                 }
@@ -450,20 +448,20 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
                     vCenter = strdup(dynamicProperty->val->string);
 
                     if (vCenter == NULL) {
-                        virReportOOMError(conn);
+                        virReportOOMError(NULL);
                         goto failure;
                     }
 
                     if (virStrcpyStatic(vCenterIpAddress,
                                         dynamicProperty->val->string) == NULL) {
-                        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                                   "vCenter IP address %s too big for "
                                   "destination", dynamicProperty->val->string);
                         goto failure;
                     }
                 } else if (STRNEQ(vCenterIpAddress,
                            dynamicProperty->val->string)) {
-                    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                               "This host is managed by a vCenter with IP "
                               "address %s, but a mismachting vCenter '%s' "
                               "(%s) has been specified",
@@ -477,49 +475,45 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
         }
 
         if (STREQ(vCenter, "*")) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "This host is not managed by a vCenter");
             goto failure;
         }
 
         if (virAsprintf(&url, "%s://%s/sdk", priv->transport,
                         vCenter) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
 
-        if (esxVI_Context_Alloc(conn, &priv->vCenter) < 0) {
+        if (esxVI_Context_Alloc(&priv->vCenter) < 0) {
             goto failure;
         }
 
         username = esxUtil_RequestUsername(auth, "administrator", vCenter);
 
         if (username == NULL) {
-            ESX_ERROR(conn, VIR_ERR_AUTH_FAILED,
-                      "Username request failed");
+            ESX_ERROR(VIR_ERR_AUTH_FAILED, "Username request failed");
             goto failure;
         }
 
         password = esxUtil_RequestPassword(auth, username, vCenter);
 
         if (password == NULL) {
-            ESX_ERROR(conn, VIR_ERR_AUTH_FAILED,
-                      "Password request failed");
+            ESX_ERROR(VIR_ERR_AUTH_FAILED, "Password request failed");
             goto failure;
         }
 
-        if (esxVI_Context_Connect(conn, priv->vCenter, url,
-                                  vCenterIpAddress, username, password,
-                                  noVerify) < 0) {
+        if (esxVI_Context_Connect(priv->vCenter, url, vCenterIpAddress,
+                                  username, password, noVerify) < 0) {
             goto failure;
         }
 
         if (priv->vCenter->productVersion != esxVI_ProductVersion_VPX25 &&
             priv->vCenter->productVersion != esxVI_ProductVersion_VPX40) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "%s is neither a vCenter 2.5 server nor a vCenter "
-                      "4.0 server",
-                      conn->uri->server);
+                      "4.0 server", conn->uri->server);
             goto failure;
         }
     }
@@ -527,7 +521,7 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, int flags ATTRIBUTE_UNUSED)
     conn->privateData = priv;
 
     /* Setup capabilities */
-    priv->caps = esxCapsInit(conn);
+    priv->caps = esxCapsInit(priv);
 
     if (priv->caps == NULL) {
         goto failure;
@@ -566,15 +560,15 @@ esxClose(virConnectPtr conn)
 {
     esxPrivate *priv = (esxPrivate *)conn->privateData;
 
-    esxVI_EnsureSession(conn, priv->host);
+    esxVI_EnsureSession(priv->host);
 
-    esxVI_Logout(conn, priv->host);
+    esxVI_Logout(priv->host);
     esxVI_Context_Free(&priv->host);
 
     if (priv->vCenter != NULL) {
-        esxVI_EnsureSession(conn, priv->vCenter);
+        esxVI_EnsureSession(priv->vCenter);
 
-        esxVI_Logout(conn, priv->vCenter);
+        esxVI_Logout(priv->vCenter);
         esxVI_Context_Free(&priv->vCenter);
     }
 
@@ -591,9 +585,8 @@ esxClose(virConnectPtr conn)
 
 
 static esxVI_Boolean
-esxSupportsVMotion(virConnectPtr conn)
+esxSupportsVMotion(esxPrivate *priv)
 {
-    esxPrivate *priv = (esxPrivate *)conn->privateData;
     esxVI_String *propertyNameList = NULL;
     esxVI_ObjectContent *hostSystem = NULL;
     esxVI_DynamicProperty *dynamicProperty = NULL;
@@ -602,21 +595,20 @@ esxSupportsVMotion(virConnectPtr conn)
         return priv->supportsVMotion;
     }
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "capability.vmotionSupported") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host,
-                                        priv->host->hostFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
                                         "HostSystem", propertyNameList,
                                         esxVI_Boolean_True, &hostSystem) < 0) {
         goto failure;
     }
 
     if (hostSystem == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve the HostSystem object");
         goto failure;
     }
@@ -624,7 +616,7 @@ esxSupportsVMotion(virConnectPtr conn)
     for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "capability.vmotionSupported")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Boolean) < 0) {
                 goto failure;
             }
@@ -658,7 +650,7 @@ esxSupportsFeature(virConnectPtr conn, int feature)
 
     switch (feature) {
       case VIR_DRV_FEATURE_MIGRATION_V1:
-        supportsVMotion = esxSupportsVMotion(conn);
+        supportsVMotion = esxSupportsVMotion(priv);
 
         if (supportsVMotion == esxVI_Boolean_Undefined) {
             return -1;
@@ -712,7 +704,7 @@ esxGetVersion(virConnectPtr conn, unsigned long *version)
     return 0;
 
   failure:
-    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
               "Expecting version to match 'major.minor.release', but got '%s'",
               priv->host->service->about->version);
 
@@ -732,23 +724,22 @@ esxGetHostname(virConnectPtr conn)
     const char *domainName = NULL;
     char *complete = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
     if (esxVI_String_AppendValueListToList
-          (conn, &propertyNameList,
+          (&propertyNameList,
            "config.network.dnsConfig.hostName\0"
            "config.network.dnsConfig.domainName\0") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host,
-                                        priv->host->hostFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
                                         "HostSystem", propertyNameList,
                                         esxVI_Boolean_True, &hostSystem) < 0) {
         goto failure;
     }
 
     if (hostSystem == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve the HostSystem object");
         goto failure;
     }
@@ -757,7 +748,7 @@ esxGetHostname(virConnectPtr conn)
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name,
                   "config.network.dnsConfig.hostName")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_String) < 0) {
                 goto failure;
             }
@@ -765,7 +756,7 @@ esxGetHostname(virConnectPtr conn)
             hostName = dynamicProperty->val->string;
         } else if (STREQ(dynamicProperty->name,
                          "config.network.dnsConfig.domainName")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_String) < 0) {
                 goto failure;
             }
@@ -777,7 +768,7 @@ esxGetHostname(virConnectPtr conn)
     }
 
     if (hostName == NULL || strlen(hostName) < 1) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Missing or empty 'hostName' property");
         goto failure;
     }
@@ -786,12 +777,12 @@ esxGetHostname(virConnectPtr conn)
         complete = strdup(hostName);
 
         if (complete == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     } else {
         if (virAsprintf(&complete, "%s.%s", hostName, domainName) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
@@ -828,11 +819,11 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
 
     memset(nodeinfo, 0, sizeof(virNodeInfo));
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "hardware.cpuInfo.hz\0"
                                            "hardware.cpuInfo.numCpuCores\0"
                                            "hardware.cpuInfo.numCpuPackages\0"
@@ -840,15 +831,14 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
                                            "hardware.memorySize\0"
                                            "hardware.numaInfo.numNodes\0"
                                            "summary.hardware.cpuModel\0") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host,
-                                        priv->host->hostFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
                                         "HostSystem", propertyNameList,
                                         esxVI_Boolean_True, &hostSystem) < 0) {
         goto failure;
     }
 
     if (hostSystem == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve the HostSystem object");
         goto failure;
     }
@@ -856,7 +846,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
     for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "hardware.cpuInfo.hz")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Long) < 0) {
                 goto failure;
             }
@@ -864,7 +854,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             cpuInfo_hz = dynamicProperty->val->int64;
         } else if (STREQ(dynamicProperty->name,
                          "hardware.cpuInfo.numCpuCores")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Short) < 0) {
                 goto failure;
             }
@@ -872,7 +862,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             cpuInfo_numCpuCores = dynamicProperty->val->int16;
         } else if (STREQ(dynamicProperty->name,
                          "hardware.cpuInfo.numCpuPackages")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Short) < 0) {
                 goto failure;
             }
@@ -880,14 +870,14 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             cpuInfo_numCpuPackages = dynamicProperty->val->int16;
         } else if (STREQ(dynamicProperty->name,
                          "hardware.cpuInfo.numCpuThreads")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Short) < 0) {
                 goto failure;
             }
 
             cpuInfo_numCpuThreads = dynamicProperty->val->int16;
         } else if (STREQ(dynamicProperty->name, "hardware.memorySize")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Long) < 0) {
                 goto failure;
             }
@@ -895,7 +885,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             memorySize = dynamicProperty->val->int64;
         } else if (STREQ(dynamicProperty->name,
                          "hardware.numaInfo.numNodes")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Int) < 0) {
                 goto failure;
             }
@@ -903,7 +893,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             numaInfo_numNodes = dynamicProperty->val->int32;
         } else if (STREQ(dynamicProperty->name,
                          "summary.hardware.cpuModel")) {
-            if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_String) < 0) {
                 goto failure;
             }
@@ -929,7 +919,7 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
             if (virStrncpy(nodeinfo->model, dynamicProperty->val->string,
                            sizeof(nodeinfo->model) - 1,
                            sizeof(nodeinfo->model)) == NULL) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "CPU Model %s too long for destination",
                           dynamicProperty->val->string);
                 goto failure;
@@ -972,7 +962,7 @@ esxGetCapabilities(virConnectPtr conn)
     char *xml = virCapabilitiesFormatXML(priv->caps);
 
     if (xml == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         return NULL;
     }
 
@@ -999,13 +989,13 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
         return 0;
     }
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
                                         "VirtualMachine", propertyNameList,
                                         esxVI_Boolean_True,
                                         &virtualMachineList) < 0) {
@@ -1014,7 +1004,7 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
 
     for (virtualMachine = virtualMachineList; virtualMachine != NULL;
          virtualMachine = virtualMachine->_next) {
-        if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+        if (esxVI_GetVirtualMachinePowerState(virtualMachine,
                                               &powerState) < 0) {
             goto failure;
         }
@@ -1026,7 +1016,7 @@ esxListDomains(virConnectPtr conn, int *ids, int maxids)
         if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
                                                 &ids[count]) < 0 ||
             ids[count] <= 0) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Failed to parse positive integer from '%s'",
                       virtualMachine->obj->value);
             goto failure;
@@ -1058,12 +1048,12 @@ esxNumberOfDomains(virConnectPtr conn)
 {
     esxPrivate *priv = (esxPrivate *)conn->privateData;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         return -1;
     }
 
     return esxVI_LookupNumberOfDomainsByPowerState
-             (conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
+             (priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
               esxVI_Boolean_False);
 }
 
@@ -1082,16 +1072,16 @@ esxDomainLookupByID(virConnectPtr conn, int id)
     unsigned char uuid_candidate[VIR_UUID_BUFLEN];
     virDomainPtr domain = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "configStatus\0"
                                            "name\0"
                                            "runtime.powerState\0"
                                            "config.uuid\0") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
                                         "VirtualMachine", propertyNameList,
                                         esxVI_Boolean_True,
                                         &virtualMachineList) < 0) {
@@ -1100,7 +1090,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
 
     for (virtualMachine = virtualMachineList; virtualMachine != NULL;
          virtualMachine = virtualMachine->_next) {
-        if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+        if (esxVI_GetVirtualMachinePowerState(virtualMachine,
                                               &powerState) < 0) {
             goto failure;
         }
@@ -1112,7 +1102,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
 
         VIR_FREE(name_candidate);
 
-        if (esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
+        if (esxVI_GetVirtualMachineIdentity(virtualMachine,
                                             &id_candidate, &name_candidate,
                                             uuid_candidate) < 0) {
             goto failure;
@@ -1134,7 +1124,7 @@ esxDomainLookupByID(virConnectPtr conn, int id)
     }
 
     if (domain == NULL) {
-        ESX_ERROR(conn, VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
+        ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with ID %d", id);
     }
 
   cleanup:
@@ -1163,20 +1153,18 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
     char *name = NULL;
     virDomainPtr domain = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "name\0"
                                            "runtime.powerState\0") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(conn, priv->host, uuid,
-                                         propertyNameList, &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, uuid, propertyNameList,
+                                         &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
-                                        &id, &name, NULL) < 0 ||
-        esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachineIdentity(virtualMachine, &id, &name, NULL) < 0 ||
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
@@ -1221,16 +1209,16 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
     unsigned char uuid_candidate[VIR_UUID_BUFLEN];
     virDomainPtr domain = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "configStatus\0"
                                            "name\0"
                                            "runtime.powerState\0"
                                            "config.uuid\0") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
                                         "VirtualMachine", propertyNameList,
                                         esxVI_Boolean_True,
                                         &virtualMachineList) < 0) {
@@ -1241,7 +1229,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
          virtualMachine = virtualMachine->_next) {
         VIR_FREE(name_candidate);
 
-        if (esxVI_GetVirtualMachineIdentity(conn, virtualMachine,
+        if (esxVI_GetVirtualMachineIdentity(virtualMachine,
                                             &id_candidate, &name_candidate,
                                             uuid_candidate) < 0) {
             goto failure;
@@ -1251,7 +1239,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
             continue;
         }
 
-        if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+        if (esxVI_GetVirtualMachinePowerState(virtualMachine,
                                               &powerState) < 0) {
             goto failure;
         }
@@ -1273,7 +1261,7 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
     }
 
     if (domain == NULL) {
-        ESX_ERROR(conn, VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
+        ESX_ERROR(VIR_ERR_NO_DOMAIN, "No domain with name '%s'", name);
     }
 
   cleanup:
@@ -1302,37 +1290,32 @@ esxDomainSuspend(virDomainPtr domain)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
         esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, propertyNameList,
-           &virtualMachine, priv->autoAnswer) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+          (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+           priv->autoAnswer) < 0 ||
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not powered on");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
         goto failure;
     }
 
-    if (esxVI_SuspendVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                             &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_SuspendVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
-                  "Could not suspend domain");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not suspend domain");
         goto failure;
     }
 
@@ -1362,37 +1345,32 @@ esxDomainResume(virDomainPtr domain)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
         esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, propertyNameList,
-           &virtualMachine, priv->autoAnswer) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+          (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+           priv->autoAnswer) < 0 ||
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_Suspended) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not suspended");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not suspended");
         goto failure;
     }
 
-    if (esxVI_PowerOnVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                             &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
-                  "Could not resume domain");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not resume domain");
         goto failure;
     }
 
@@ -1420,29 +1398,25 @@ esxDomainShutdown(virDomainPtr domain)
     esxVI_String *propertyNameList = NULL;
     esxVI_VirtualMachinePowerState powerState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not powered on");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
         goto failure;
     }
 
-    if (esxVI_ShutdownGuest(domain->conn, priv->host,
-                            virtualMachine->obj) < 0) {
+    if (esxVI_ShutdownGuest(priv->host, virtualMachine->obj) < 0) {
         goto failure;
     }
 
@@ -1469,28 +1443,25 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags ATTRIBUTE_UNUSED)
     esxVI_String *propertyNameList = NULL;
     esxVI_VirtualMachinePowerState powerState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not powered on");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
         goto failure;
     }
 
-    if (esxVI_RebootGuest(domain->conn, priv->host, virtualMachine->obj) < 0) {
+    if (esxVI_RebootGuest(priv->host, virtualMachine->obj) < 0) {
         goto failure;
     }
 
@@ -1526,36 +1497,32 @@ esxDomainDestroy(virDomainPtr domain)
         ctx = priv->host;
     }
 
-    if (esxVI_EnsureSession(domain->conn, ctx) < 0) {
+    if (esxVI_EnsureSession(ctx) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
         esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, ctx, domain->uuid, propertyNameList, &virtualMachine,
+          (ctx, domain->uuid, propertyNameList, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not powered on");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered on");
         goto failure;
     }
 
-    if (esxVI_PowerOffVM_Task(domain->conn, ctx, virtualMachine->obj,
-                              &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, ctx, task, domain->uuid,
-                                    priv->autoAnswer, &taskInfoState) < 0) {
+    if (esxVI_PowerOffVM_Task(ctx, virtualMachine->obj, &task) < 0 ||
+        esxVI_WaitForTaskCompletion(ctx, task, domain->uuid, priv->autoAnswer,
+                                    &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
-                  "Could not destroy domain");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not destroy domain");
         goto failure;
     }
 
@@ -1575,12 +1542,12 @@ esxDomainDestroy(virDomainPtr domain)
 
 
 static char *
-esxDomainGetOSType(virDomainPtr domain)
+esxDomainGetOSType(virDomainPtr domain ATTRIBUTE_UNUSED)
 {
     char *osType = strdup("hvm");
 
     if (osType == NULL) {
-        virReportOOMError(domain->conn);
+        virReportOOMError(NULL);
         return NULL;
     }
 
@@ -1598,15 +1565,14 @@ esxDomainGetMaxMemory(virDomainPtr domain)
     esxVI_DynamicProperty *dynamicProperty = NULL;
     unsigned long memoryMB = 0;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "config.hardware.memoryMB") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0) {
         goto failure;
     }
@@ -1614,14 +1580,13 @@ esxDomainGetMaxMemory(virDomainPtr domain)
     for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "config.hardware.memoryMB")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Int) < 0) {
                 goto failure;
             }
 
             if (dynamicProperty->val->int32 < 0) {
-                ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
-                          "Got invalid memory size %d",
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Got invalid memory size %d",
                           dynamicProperty->val->int32);
             } else {
                 memoryMB = dynamicProperty->val->int32;
@@ -1657,31 +1622,30 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
     if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+          (priv->host, domain->uuid, NULL, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
-        esxVI_Long_Alloc(domain->conn, &spec->memoryMB) < 0) {
+        esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+        esxVI_Long_Alloc(&spec->memoryMB) < 0) {
         goto failure;
     }
 
     spec->memoryMB->value =
       memory / 1024; /* Scale from kilobytes to megabytes */
 
-    if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                              spec, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+                              &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not set max-memory to %lu kilobytes", memory);
         goto failure;
     }
@@ -1711,33 +1675,31 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
     if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+          (priv->host, domain->uuid, NULL, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
-        esxVI_ResourceAllocationInfo_Alloc(domain->conn,
-                                           &spec->memoryAllocation) < 0 ||
-        esxVI_Long_Alloc(domain->conn, &spec->memoryAllocation->limit) < 0) {
+        esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+        esxVI_ResourceAllocationInfo_Alloc(&spec->memoryAllocation) < 0 ||
+        esxVI_Long_Alloc(&spec->memoryAllocation->limit) < 0) {
         goto failure;
     }
 
     spec->memoryAllocation->limit->value =
       memory / 1024; /* Scale from kilobytes to megabytes */
 
-    if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                              spec, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+                              &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not set memory to %lu kilobytes", memory);
         goto failure;
     }
@@ -1779,18 +1741,17 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
     esxVI_PerfMetricIntSeries *perfMetricIntSeries = NULL;
     esxVI_Long *value = NULL;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "runtime.powerState\0"
                                            "config.hardware.memoryMB\0"
                                            "config.hardware.numCPU\0"
                                            "config.memoryAllocation.limit\0") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0) {
         goto failure;
     }
@@ -1805,7 +1766,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "runtime.powerState")) {
             if (esxVI_VirtualMachinePowerState_CastFromAnyType
-                  (domain->conn, dynamicProperty->val, &powerState) < 0) {
+                  (dynamicProperty->val, &powerState) < 0) {
                 goto failure;
             }
 
@@ -1827,14 +1788,14 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
                 break;
             }
         } else if (STREQ(dynamicProperty->name, "config.hardware.memoryMB")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Int) < 0) {
                 goto failure;
             }
 
             info->maxMem = dynamicProperty->val->int32 * 1024; /* Scale from megabyte to kilobyte */
         } else if (STREQ(dynamicProperty->name, "config.hardware.numCPU")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Int) < 0) {
                 goto failure;
             }
@@ -1842,7 +1803,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
             info->nrVirtCpu = dynamicProperty->val->int32;
         } else if (STREQ(dynamicProperty->name,
                          "config.memoryAllocation.limit")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Long) < 0) {
                 goto failure;
             }
@@ -1862,18 +1823,17 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
 
     /* Verify the cached 'used CPU time' performance counter ID */
     if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId >= 0) {
-        if (esxVI_Int_Alloc(domain->conn, &counterId) < 0) {
+        if (esxVI_Int_Alloc(&counterId) < 0) {
             goto failure;
         }
 
         counterId->value = priv->usedCpuTimeCounterId;
 
-        if (esxVI_Int_AppendToList(domain->conn, &counterIdList,
-                                   counterId) < 0) {
+        if (esxVI_Int_AppendToList(&counterIdList, counterId) < 0) {
             goto failure;
         }
 
-        if (esxVI_QueryPerfCounter(domain->conn, priv->host, counterIdList,
+        if (esxVI_QueryPerfCounter(priv->host, counterIdList,
                                    &perfCounterInfo) < 0) {
             goto failure;
         }
@@ -1896,9 +1856,9 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
      * counter ID and cache it, if it's not already cached.
      */
     if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId < 0) {
-        if (esxVI_QueryAvailablePerfMetric(domain->conn, priv->host,
-                                           virtualMachine->obj, NULL, NULL,
-                                           NULL, &perfMetricIdList) < 0) {
+        if (esxVI_QueryAvailablePerfMetric(priv->host, virtualMachine->obj,
+                                           NULL, NULL, NULL,
+                                           &perfMetricIdList) < 0) {
             goto failure;
         }
 
@@ -1909,15 +1869,13 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
 
             counterId = NULL;
 
-            if (esxVI_Int_DeepCopy(domain->conn, &counterId,
-                                   perfMetricId->counterId) < 0 ||
-                esxVI_Int_AppendToList(domain->conn, &counterIdList,
-                                       counterId) < 0) {
+            if (esxVI_Int_DeepCopy(&counterId, perfMetricId->counterId) < 0 ||
+                esxVI_Int_AppendToList(&counterIdList, counterId) < 0) {
                 goto failure;
             }
         }
 
-        if (esxVI_QueryPerfCounter(domain->conn, priv->host, counterIdList,
+        if (esxVI_QueryPerfCounter(priv->host, counterIdList,
                                    &perfCounterInfoList) < 0) {
             goto failure;
         }
@@ -1953,11 +1911,10 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
     if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId >= 0) {
         VIR_DEBUG("usedCpuTimeCounterId %d BEGIN", priv->usedCpuTimeCounterId);
 
-        if (esxVI_PerfQuerySpec_Alloc(domain->conn, &querySpec) < 0 ||
-            esxVI_Int_Alloc(domain->conn, &querySpec->maxSample) < 0 ||
-            esxVI_PerfMetricId_Alloc(domain->conn, &querySpec->metricId) < 0 ||
-            esxVI_Int_Alloc(domain->conn,
-                            &querySpec->metricId->counterId) < 0) {
+        if (esxVI_PerfQuerySpec_Alloc(&querySpec) < 0 ||
+            esxVI_Int_Alloc(&querySpec->maxSample) < 0 ||
+            esxVI_PerfMetricId_Alloc(&querySpec->metricId) < 0 ||
+            esxVI_Int_Alloc(&querySpec->metricId->counterId) < 0) {
             goto failure;
         }
 
@@ -1967,9 +1924,7 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
         querySpec->metricId->instance = (char *)"";
         querySpec->format = (char *)"normal";
 
-
-        if (esxVI_QueryPerf(domain->conn, priv->host, querySpec,
-                            &perfEntityMetricList) < 0) {
+        if (esxVI_QueryPerf(priv->host, querySpec, &perfEntityMetricList) < 0) {
             querySpec->entity = NULL;
             querySpec->metricId->instance = NULL;
             querySpec->format = NULL;
@@ -2031,12 +1986,12 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
     esxVI_TaskInfoState taskInfoState;
 
     if (nvcpus < 1) {
-        ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
-                  "Requested number of virtual CPUs must al least be 1");
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
+                  "Requested number of virtual CPUs must at least be 1");
         goto failure;
     }
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
@@ -2047,7 +2002,7 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
     }
 
     if (nvcpus > maxVcpus) {
-        ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Requested number of virtual CPUs is greater than max "
                   "allowable number of virtual CPUs for the domain: %d > %d",
                   nvcpus, maxVcpus);
@@ -2055,25 +2010,24 @@ esxDomainSetVcpus(virDomainPtr domain, unsigned int nvcpus)
     }
 
     if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+          (priv->host, domain->uuid, NULL, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
-        esxVI_Int_Alloc(domain->conn, &spec->numCPUs) < 0) {
+        esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+        esxVI_Int_Alloc(&spec->numCPUs) < 0) {
         goto failure;
     }
 
     spec->numCPUs->value = nvcpus;
 
-    if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                              spec, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+                              &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not set number of virtual CPUs to %d", nvcpus);
         goto failure;
     }
@@ -2105,21 +2059,20 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
         return priv->maxVcpus;
     }
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "capability.maxSupportedVcpus") < 0 ||
-        esxVI_LookupObjectContentByType(domain->conn, priv->host,
-                                        priv->host->hostFolder, "HostSystem",
-                                        propertyNameList, esxVI_Boolean_True,
-                                        &hostSystem) < 0) {
+        esxVI_LookupObjectContentByType(priv->host, priv->host->hostFolder,
+                                        "HostSystem", propertyNameList,
+                                        esxVI_Boolean_True, &hostSystem) < 0) {
         goto failure;
     }
 
     if (hostSystem == NULL) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve the HostSystem object");
         goto failure;
     }
@@ -2127,7 +2080,7 @@ esxDomainGetMaxVcpus(virDomainPtr domain)
     for (dynamicProperty = hostSystem->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "capability.maxSupportedVcpus")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Int) < 0) {
                 goto failure;
             }
@@ -2170,15 +2123,14 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
     virDomainDefPtr def = NULL;
     char *xml = NULL;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "config.files.vmPathName") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0) {
         goto failure;
     }
@@ -2186,7 +2138,7 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
     for (dynamicProperty = virtualMachine->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "config.files.vmPathName")) {
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_String) < 0) {
                 goto failure;
             }
@@ -2196,9 +2148,8 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
         }
     }
 
-    if (esxUtil_ParseDatastoreRelatedPath(domain->conn, vmPathName,
-                                          &datastoreName, &directoryName,
-                                          &fileName) < 0) {
+    if (esxUtil_ParseDatastoreRelatedPath(vmPathName, &datastoreName,
+                                          &directoryName, &fileName) < 0) {
         goto failure;
     }
 
@@ -2217,18 +2168,18 @@ esxDomainDumpXML(virDomainPtr domain, int flags)
     virBufferURIEncodeString(&buffer, datastoreName);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(domain->conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     url = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_DownloadFile(domain->conn, priv->host, url, &vmx) < 0) {
+    if (esxVI_Context_DownloadFile(priv->host, url, &vmx) < 0) {
         goto failure;
     }
 
-    def = esxVMX_ParseConfig(domain->conn, priv->host, vmx, datastoreName,
-                             directoryName, priv->host->apiVersion);
+    def = esxVMX_ParseConfig(priv->host, vmx, datastoreName, directoryName,
+                             priv->host->apiVersion);
 
     if (def != NULL) {
         xml = virDomainDefFormat(domain->conn, def, flags);
@@ -2265,12 +2216,12 @@ esxDomainXMLFromNative(virConnectPtr conn, const char *nativeFormat,
     char *xml = NULL;
 
     if (STRNEQ(nativeFormat, "vmware-vmx")) {
-        ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Unsupported config format '%s'", nativeFormat);
         return NULL;
     }
 
-    def = esxVMX_ParseConfig(conn, priv->host, nativeConfig, "?", "?",
+    def = esxVMX_ParseConfig(priv->host, nativeConfig, "?", "?",
                              priv->host->apiVersion);
 
     if (def != NULL) {
@@ -2294,7 +2245,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
     char *vmx = NULL;
 
     if (STRNEQ(nativeFormat, "vmware-vmx")) {
-        ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Unsupported config format '%s'", nativeFormat);
         return NULL;
     }
@@ -2305,7 +2256,7 @@ esxDomainXMLToNative(virConnectPtr conn, const char *nativeFormat,
         return NULL;
     }
 
-    vmx = esxVMX_FormatConfig(conn, priv->host, def, priv->host->apiVersion);
+    vmx = esxVMX_FormatConfig(priv->host, def, priv->host->apiVersion);
 
     virDomainDefFree(def);
 
@@ -2334,14 +2285,14 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
         return 0;
     }
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "name\0"
                                            "runtime.powerState\0") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host, priv->host->vmFolder,
+        esxVI_LookupObjectContentByType(priv->host, priv->host->vmFolder,
                                         "VirtualMachine", propertyNameList,
                                         esxVI_Boolean_True,
                                         &virtualMachineList) < 0) {
@@ -2350,7 +2301,7 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
 
     for (virtualMachine = virtualMachineList; virtualMachine != NULL;
          virtualMachine = virtualMachine->_next) {
-        if (esxVI_GetVirtualMachinePowerState(conn, virtualMachine,
+        if (esxVI_GetVirtualMachinePowerState(virtualMachine,
                                               &powerState) < 0) {
             goto failure;
         }
@@ -2363,7 +2314,7 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
              dynamicProperty != NULL;
              dynamicProperty = dynamicProperty->_next) {
             if (STREQ(dynamicProperty->name, "name")) {
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_String) < 0) {
                     goto failure;
                 }
@@ -2371,7 +2322,7 @@ esxListDefinedDomains(virConnectPtr conn, char **const names, int maxnames)
                 names[count] = strdup(dynamicProperty->val->string);
 
                 if (names[count] == NULL) {
-                    virReportOOMError(conn);
+                    virReportOOMError(NULL);
                     goto failure;
                 }
 
@@ -2409,12 +2360,12 @@ esxNumberOfDefinedDomains(virConnectPtr conn)
 {
     esxPrivate *priv = (esxPrivate *)conn->privateData;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         return -1;
     }
 
     return esxVI_LookupNumberOfDomainsByPowerState
-             (conn, priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
+             (priv->host, esxVI_VirtualMachinePowerState_PoweredOn,
               esxVI_Boolean_True);
 }
 
@@ -2431,37 +2382,33 @@ esxDomainCreate(virDomainPtr domain)
     esxVI_ManagedObjectReference *task = NULL;
     esxVI_TaskInfoState taskInfoState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
         esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, propertyNameList,
-           &virtualMachine, priv->autoAnswer) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
+          (priv->host, domain->uuid, propertyNameList, &virtualMachine,
+           priv->autoAnswer) < 0 ||
+        esxVI_GetVirtualMachinePowerState(virtualMachine,
                                           &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
-                  "Domain is not powered off");
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID, "Domain is not powered off");
         goto failure;
     }
 
-    if (esxVI_PowerOnVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                             &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_PowerOnVM_Task(priv->host, virtualMachine->obj, &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
-                  "Could not start domain");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not start domain");
         goto failure;
     }
 
@@ -2502,7 +2449,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     esxVI_TaskInfoState taskInfoState;
     virDomainPtr domain = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
@@ -2515,7 +2462,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     }
 
     /* Check if an existing domain should be edited */
-    if (esxVI_LookupVirtualMachineByUuid(conn, priv->host, def->uuid, NULL,
+    if (esxVI_LookupVirtualMachineByUuid(priv->host, def->uuid, NULL,
                                          &virtualMachine,
                                          esxVI_Occurrence_OptionalItem) < 0) {
         goto failure;
@@ -2523,14 +2470,14 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
 
     if (virtualMachine != NULL) {
         /* FIXME */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Domain already exists, editing existing domains is not "
                   "supported yet");
         goto failure;
     }
 
     /* Build VMX from domain XML */
-    vmx = esxVMX_FormatConfig(conn, priv->host, def, priv->host->apiVersion);
+    vmx = esxVMX_FormatConfig(priv->host, def, priv->host->apiVersion);
 
     if (vmx == NULL) {
         goto failure;
@@ -2544,7 +2491,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
      * datastore isn't perfect but should work in the majority of cases.
      */
     if (def->ndisks < 1) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Domain XML doesn't contain any disks, cannot deduce "
                   "datastore and path for VMX file");
         goto failure;
@@ -2559,26 +2506,26 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     }
 
     if (disk == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Domain XML doesn't contain any file-based harddisks, "
                   "cannot deduce datastore and path for VMX file");
         goto failure;
     }
 
     if (disk->src == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "First file-based harddisk has no source, cannot deduce "
                   "datastore and path for VMX file");
         goto failure;
     }
 
-    if (esxUtil_ParseDatastoreRelatedPath(conn, disk->src, &datastoreName,
+    if (esxUtil_ParseDatastoreRelatedPath(disk->src, &datastoreName,
                                           &directoryName, &fileName) < 0) {
         goto failure;
     }
 
     if (! virFileHasSuffix(fileName, ".vmdk")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting source '%s' of first file-based harddisk to be a "
                   "VMDK image", disk->src);
         goto failure;
@@ -2599,7 +2546,7 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     virBufferURIEncodeString(&buffer, datastoreName);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -2608,25 +2555,25 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     if (directoryName != NULL) {
         if (virAsprintf(&datastoreRelatedPath, "[%s] %s/%s.vmx", datastoreName,
                         directoryName, def->name) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     } else {
         if (virAsprintf(&datastoreRelatedPath, "[%s] %s.vmx", datastoreName,
                         def->name) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
 
     /* Get resource pool */
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList, "parent") < 0 ||
-        esxVI_LookupHostSystemByIp(conn, priv->host, priv->host->ipAddress,
+    if (esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+        esxVI_LookupHostSystemByIp(priv->host, priv->host->ipAddress,
                                    propertyNameList, &hostSystem) < 0) {
         goto failure;
     }
 
-    if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+    if (esxVI_LookupResourcePoolByHostSystem(priv->host, hostSystem,
                                              &resourcePool) < 0) {
         goto failure;
     }
@@ -2635,22 +2582,21 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml ATTRIBUTE_UNUSED)
     /* FIXME */
 
     /* Upload VMX file */
-    if (esxVI_Context_UploadFile(conn, priv->host, url, vmx) < 0) {
+    if (esxVI_Context_UploadFile(priv->host, url, vmx) < 0) {
         goto failure;
     }
 
     /* Register the domain */
-    if (esxVI_RegisterVM_Task(conn, priv->host, priv->host->vmFolder,
+    if (esxVI_RegisterVM_Task(priv->host, priv->host->vmFolder,
                               datastoreRelatedPath, NULL, esxVI_Boolean_False,
                               resourcePool, hostSystem->obj, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(conn, priv->host, task,
-                                    def->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+        esxVI_WaitForTaskCompletion(priv->host, task, def->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Could not define domain");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not define domain");
         goto failure;
     }
 
@@ -2704,28 +2650,27 @@ esxDomainUndefine(virDomainPtr domain)
         ctx = priv->host;
     }
 
-    if (esxVI_EnsureSession(domain->conn, ctx) < 0) {
+    if (esxVI_EnsureSession(ctx) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, ctx, domain->uuid,
-                                         propertyNameList, &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(ctx, domain->uuid, propertyNameList,
+                                         &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
     if (powerState != esxVI_VirtualMachinePowerState_Suspended &&
         powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
-        ESX_ERROR(domain->conn, VIR_ERR_OPERATION_INVALID,
+        ESX_ERROR(VIR_ERR_OPERATION_INVALID,
                   "Domain is not suspended or powered off");
         goto failure;
     }
 
-    if (esxVI_UnregisterVM(domain->conn, ctx, virtualMachine->obj) < 0) {
+    if (esxVI_UnregisterVM(ctx, virtualMachine->obj) < 0) {
         goto failure;
     }
 
@@ -2774,12 +2719,12 @@ esxDomainUndefine(virDomainPtr domain)
  *   SharesLevel 'low', 'normal' and 'high'.
  */
 static char *
-esxDomainGetSchedulerType(virDomainPtr domain, int *nparams)
+esxDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, int *nparams)
 {
     char *type = strdup("allocation");
 
     if (type == NULL) {
-        virReportOOMError(domain->conn);
+        virReportOOMError(NULL);
         return NULL;
     }
 
@@ -2804,22 +2749,21 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
     int i = 0;
 
     if (*nparams < 3) {
-        ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Parameter array must have space for 3 items");
         goto failure;
     }
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueListToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "config.cpuAllocation.reservation\0"
                                            "config.cpuAllocation.limit\0"
                                            "config.cpuAllocation.shares\0") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0) {
         goto failure;
     }
@@ -2834,7 +2778,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
 
             params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG;
 
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Long) < 0) {
                 goto failure;
             }
@@ -2850,7 +2794,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
 
             params[i].type = VIR_DOMAIN_SCHED_FIELD_LLONG;
 
-            if (esxVI_AnyType_ExpectType(domain->conn, dynamicProperty->val,
+            if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                          esxVI_Type_Long) < 0) {
                 goto failure;
             }
@@ -2866,8 +2810,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
 
             params[i].type = VIR_DOMAIN_SCHED_FIELD_INT;
 
-            if (esxVI_SharesInfo_CastFromAnyType(domain->conn,
-                                                 dynamicProperty->val,
+            if (esxVI_SharesInfo_CastFromAnyType(dynamicProperty->val,
                                                  &sharesInfo) < 0) {
                 goto failure;
             }
@@ -2890,7 +2833,7 @@ esxDomainGetSchedulerParameters(virDomainPtr domain,
                 break;
 
               default:
-                ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Shares level has unknown value %d",
                           (int)sharesInfo->level);
                 goto failure;
@@ -2934,29 +2877,27 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
     esxVI_TaskInfoState taskInfoState;
     int i;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
     if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->host, domain->uuid, NULL, &virtualMachine,
+          (priv->host, domain->uuid, NULL, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_VirtualMachineConfigSpec_Alloc(domain->conn, &spec) < 0 ||
-        esxVI_ResourceAllocationInfo_Alloc(domain->conn,
-                                           &spec->cpuAllocation) < 0) {
+        esxVI_VirtualMachineConfigSpec_Alloc(&spec) < 0 ||
+        esxVI_ResourceAllocationInfo_Alloc(&spec->cpuAllocation) < 0) {
         goto failure;
     }
 
     for (i = 0; i < nparams; ++i) {
         if (STREQ (params[i].field, "reservation") &&
             params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
-            if (esxVI_Long_Alloc(domain->conn,
-                                 &spec->cpuAllocation->reservation) < 0) {
+            if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0) {
                 goto failure;
             }
 
             if (params[i].value.l < 0) {
-                ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+                ESX_ERROR(VIR_ERR_INVALID_ARG,
                           "Could not set reservation to %lld MHz, expecting "
                           "positive value", params[i].value.l);
                 goto failure;
@@ -2965,13 +2906,12 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
             spec->cpuAllocation->reservation->value = params[i].value.l;
         } else if (STREQ (params[i].field, "limit") &&
                    params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
-            if (esxVI_Long_Alloc(domain->conn,
-                                 &spec->cpuAllocation->limit) < 0) {
+            if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
                 goto failure;
             }
 
             if (params[i].value.l < -1) {
-                ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+                ESX_ERROR(VIR_ERR_INVALID_ARG,
                           "Could not set limit to %lld MHz, expecting "
                           "positive value or -1 (unlimited)",
                           params[i].value.l);
@@ -2981,8 +2921,8 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
             spec->cpuAllocation->limit->value = params[i].value.l;
         } else if (STREQ (params[i].field, "shares") &&
                    params[i].type == VIR_DOMAIN_SCHED_FIELD_INT) {
-            if (esxVI_SharesInfo_Alloc(domain->conn, &sharesInfo) < 0 ||
-                esxVI_Int_Alloc(domain->conn, &sharesInfo->shares) < 0) {
+            if (esxVI_SharesInfo_Alloc(&sharesInfo) < 0 ||
+                esxVI_Int_Alloc(&sharesInfo->shares) < 0) {
                 goto failure;
             }
 
@@ -3011,7 +2951,7 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
                     break;
 
                   default:
-                    ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+                    ESX_ERROR(VIR_ERR_INVALID_ARG,
                               "Could not set shares to %d, expecting positive "
                               "value or -1 (low), -2 (normal) or -3 (high)",
                               params[i].value.i);
@@ -3019,22 +2959,21 @@ esxDomainSetSchedulerParameters(virDomainPtr domain,
                 }
             }
         } else {
-            ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
-                      "Unknown field '%s'", params[i].field);
+            ESX_ERROR(VIR_ERR_INVALID_ARG, "Unknown field '%s'",
+                      params[i].field);
             goto failure;
         }
     }
 
-    if (esxVI_ReconfigVM_Task(domain->conn, priv->host, virtualMachine->obj,
-                              spec, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->host, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_ReconfigVM_Task(priv->host, virtualMachine->obj, spec,
+                              &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->host, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not change scheduler parameters");
         goto failure;
     }
@@ -3067,13 +3006,13 @@ esxDomainMigratePrepare(virConnectPtr dconn,
     char *transport = NULL;
 
     if (uri_in == NULL) {
-        if (esxUtil_ParseQuery(dconn, &transport, NULL, NULL, NULL) < 0) {
+        if (esxUtil_ParseQuery(dconn->uri, &transport, NULL, NULL, NULL) < 0) {
             return -1;
         }
 
         if (virAsprintf(uri_out, "%s://%s:%d/sdk", transport,
                         dconn->uri->server, dconn->uri->port) < 0) {
-            virReportOOMError(dconn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
@@ -3113,18 +3052,18 @@ esxDomainMigratePerform(virDomainPtr domain,
     esxVI_TaskInfoState taskInfoState;
 
     if (priv->vCenter == NULL) {
-        ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Migration not possible without a vCenter");
         goto failure;
     }
 
     if (dname != NULL) {
-        ESX_ERROR(domain->conn, VIR_ERR_INVALID_ARG,
+        ESX_ERROR(VIR_ERR_INVALID_ARG,
                   "Renaming domains on migration not supported");
         goto failure;
     }
 
-    if (esxVI_EnsureSession(domain->conn, priv->vCenter) < 0) {
+    if (esxVI_EnsureSession(priv->vCenter) < 0) {
         goto failure;
     }
 
@@ -3132,34 +3071,32 @@ esxDomainMigratePerform(virDomainPtr domain,
     xmlUri = xmlParseURI(uri);
 
     if (xmlUri == NULL) {
-        virReportOOMError(domain->conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
-    if (esxUtil_ResolveHostname(domain->conn, xmlUri->server, hostIpAddress,
+    if (esxUtil_ResolveHostname(xmlUri->server, hostIpAddress,
                                 NI_MAXHOST) < 0) {
         goto failure;
     }
 
     /* Lookup VirtualMachine, HostSystem and ResourcePool */
     if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-          (domain->conn, priv->vCenter, domain->uuid, NULL, &virtualMachine,
+          (priv->vCenter, domain->uuid, NULL, &virtualMachine,
            priv->autoAnswer) < 0 ||
-        esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
-                                       "parent") < 0 ||
-        esxVI_LookupHostSystemByIp(domain->conn, priv->vCenter, hostIpAddress,
+        esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+        esxVI_LookupHostSystemByIp(priv->vCenter, hostIpAddress,
                                    propertyNameList, &hostSystem) < 0) {
         goto failure;
     }
 
-    if (esxVI_LookupResourcePoolByHostSystem(domain->conn, priv->vCenter,
-                                             hostSystem, &resourcePool) < 0) {
+    if (esxVI_LookupResourcePoolByHostSystem(priv->vCenter, hostSystem,
+                                             &resourcePool) < 0) {
         goto failure;
     }
 
     /* Validate the purposed migration */
-    if (esxVI_ValidateMigration(domain->conn, priv->vCenter,
-                                virtualMachine->obj,
+    if (esxVI_ValidateMigration(priv->vCenter, virtualMachine->obj,
                                 esxVI_VirtualMachinePowerState_Undefined,
                                 NULL, resourcePool, hostSystem->obj,
                                 &eventList) < 0) {
@@ -3172,11 +3109,11 @@ esxDomainMigratePerform(virDomainPtr domain,
          *        to the first event for now.
          */
         if (eventList->fullFormattedMessage != NULL) {
-            ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Could not migrate domain, validation reported a "
                       "problem: %s", eventList->fullFormattedMessage);
         } else {
-            ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Could not migrate domain, validation reported a "
                       "problem");
         }
@@ -3185,16 +3122,15 @@ esxDomainMigratePerform(virDomainPtr domain,
     }
 
     /* Perform the purposed migration */
-    if (esxVI_MigrateVM_Task(domain->conn, priv->vCenter, virtualMachine->obj,
-                             resourcePool, hostSystem->obj, &task) < 0 ||
-        esxVI_WaitForTaskCompletion(domain->conn, priv->vCenter, task,
-                                    domain->uuid, priv->autoAnswer,
-                                    &taskInfoState) < 0) {
+    if (esxVI_MigrateVM_Task(priv->vCenter, virtualMachine->obj, resourcePool,
+                             hostSystem->obj, &task) < 0 ||
+        esxVI_WaitForTaskCompletion(priv->vCenter, task, domain->uuid,
+                                    priv->autoAnswer, &taskInfoState) < 0) {
         goto failure;
     }
 
     if (taskInfoState != esxVI_TaskInfoState_Success) {
-        ESX_ERROR(domain->conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not migrate domain, migration task finished with "
                   "an error");
         goto failure;
@@ -3243,18 +3179,18 @@ esxNodeGetFreeMemory(virConnectPtr conn)
     esxVI_DynamicProperty *dynamicProperty = NULL;
     esxVI_ResourcePoolResourceUsage *resourcePoolResourceUsage = NULL;
 
-    if (esxVI_EnsureSession(conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
     /* Lookup host system with its resource pool */
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList, "parent") < 0 ||
-        esxVI_LookupHostSystemByIp(conn, priv->host, priv->host->ipAddress,
+    if (esxVI_String_AppendValueToList(&propertyNameList, "parent") < 0 ||
+        esxVI_LookupHostSystemByIp(priv->host, priv->host->ipAddress,
                                    propertyNameList, &hostSystem) < 0) {
         goto failure;
     }
 
-    if (esxVI_LookupResourcePoolByHostSystem(conn, priv->host, hostSystem,
+    if (esxVI_LookupResourcePoolByHostSystem(priv->host, hostSystem,
                                              &managedObjectReference) < 0) {
         goto failure;
     }
@@ -3262,10 +3198,9 @@ esxNodeGetFreeMemory(virConnectPtr conn)
     esxVI_String_Free(&propertyNameList);
 
     /* Get memory usage of resource pool */
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.memory") < 0 ||
-        esxVI_LookupObjectContentByType(conn, priv->host,
-                                        managedObjectReference,
+        esxVI_LookupObjectContentByType(priv->host, managedObjectReference,
                                         "ResourcePool", propertyNameList,
                                         esxVI_Boolean_False,
                                         &resourcePool) < 0) {
@@ -3276,8 +3211,7 @@ esxNodeGetFreeMemory(virConnectPtr conn)
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "runtime.memory")) {
             if (esxVI_ResourcePoolResourceUsage_CastFromAnyType
-                  (conn, dynamicProperty->val,
-                   &resourcePoolResourceUsage) < 0) {
+                  (dynamicProperty->val, &resourcePoolResourceUsage) < 0) {
                 goto failure;
             }
 
@@ -3288,7 +3222,7 @@ esxNodeGetFreeMemory(virConnectPtr conn)
     }
 
     if (resourcePoolResourceUsage == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not retrieve memory usage of resource pool");
         goto failure;
     }
@@ -3349,18 +3283,16 @@ esxDomainIsActive(virDomainPtr domain)
     esxVI_String *propertyNameList = NULL;
     esxVI_VirtualMachinePowerState powerState;
 
-    if (esxVI_EnsureSession(domain->conn, priv->host) < 0) {
+    if (esxVI_EnsureSession(priv->host) < 0) {
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(domain->conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(domain->conn, priv->host,
-                                         domain->uuid, propertyNameList,
-                                         &virtualMachine,
+        esxVI_LookupVirtualMachineByUuid(priv->host, domain->uuid,
+                                         propertyNameList, &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachinePowerState(domain->conn, virtualMachine,
-                                          &powerState) < 0) {
+        esxVI_GetVirtualMachinePowerState(virtualMachine, &powerState) < 0) {
         goto failure;
     }
 
index 2e24386561f6f9f6ba1df21055739082855dd745..6dcacd5b1c4600ecf48786163b3c5954bddfde9a 100644 (file)
@@ -37,9 +37,9 @@
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_ERROR(conn, code, fmt...)                                         \
-    virReportErrorHelper (conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,   \
-                          __LINE__, fmt)
+#define ESX_ERROR(code, fmt...)                                              \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,   \
+                         __LINE__, fmt)
 
 /* AI_ADDRCONFIG is missing on some systems. */
 #ifndef AI_ADDRCONFIG
@@ -132,7 +132,7 @@ esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
 
 
 int
-esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
+esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
                    int *noVerify, int *autoAnswer)
 {
     int result = 0;
@@ -157,9 +157,9 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
     }
 
 #ifdef HAVE_XMLURI_QUERY_RAW
-    queryParamSet = qparam_query_parse(conn->uri->query_raw);
+    queryParamSet = qparam_query_parse(uri->query_raw);
 #else
-    queryParamSet = qparam_query_parse(conn->uri->query);
+    queryParamSet = qparam_query_parse(uri->query);
 #endif
 
     if (queryParamSet == NULL) {
@@ -177,12 +177,12 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
             *transport = strdup(queryParam->value);
 
             if (*transport == NULL) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
 
             if (STRNEQ(*transport, "http") && STRNEQ(*transport, "https")) {
-                ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+                ESX_ERROR(VIR_ERR_INVALID_ARG,
                           "Query parameter 'transport' has unexpected value "
                           "'%s' (should be http|https)", *transport);
                 goto failure;
@@ -195,7 +195,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
             *vCenter = strdup(queryParam->value);
 
             if (*vCenter == NULL) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
         } else if (STRCASEEQ(queryParam->name, "no_verify")) {
@@ -205,7 +205,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
 
             if (virStrToLong_i(queryParam->value, NULL, 10, noVerify) < 0 ||
                 (*noVerify != 0 && *noVerify != 1)) {
-                ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+                ESX_ERROR(VIR_ERR_INVALID_ARG,
                           "Query parameter 'no_verify' has unexpected value "
                           "'%s' (should be 0 or 1)", queryParam->value);
                 goto failure;
@@ -217,7 +217,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
 
             if (virStrToLong_i(queryParam->value, NULL, 10, autoAnswer) < 0 ||
                 (*autoAnswer != 0 && *autoAnswer != 1)) {
-                ESX_ERROR(conn, VIR_ERR_INVALID_ARG,
+                ESX_ERROR(VIR_ERR_INVALID_ARG,
                           "Query parameter 'auto_answer' has unexpected value "
                           "'%s' (should be 0 or 1)", queryParam->value);
                 goto failure;
@@ -232,7 +232,7 @@ esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
         *transport = strdup("https");
 
         if (*transport == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
@@ -284,8 +284,7 @@ esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id)
 
 
 int
-esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
-                                  const char *datastoreRelatedPath,
+esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
                                   char **datastoreName,
                                   char **directoryName, char **fileName)
 {
@@ -296,7 +295,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
     if (datastoreName == NULL || *datastoreName != NULL ||
         directoryName == NULL || *directoryName != NULL ||
         fileName == NULL || *fileName != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -316,7 +315,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
      */
     if (sscanf(datastoreRelatedPath, "[%a[^]%]] %a[^\n]", datastoreName,
                &directoryAndFileName) != 2) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Datastore related path '%s' doesn't have expected format "
                   "'[<datastore>] <path>'", datastoreRelatedPath);
         goto failure;
@@ -332,7 +331,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
         directoryAndFileName = NULL;
 
         if (*separator == '\0') {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Datastore related path '%s' doesn't reference a file",
                       datastoreRelatedPath);
             goto failure;
@@ -341,7 +340,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
         *fileName = strdup(separator);
 
         if (*fileName == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     } else {
@@ -367,7 +366,7 @@ esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
 
 
 int
-esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
+esxUtil_ResolveHostname(const char *hostname,
                         char *ipAddress, size_t ipAddress_length)
 {
     struct addrinfo hints;
@@ -384,14 +383,14 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
     errcode = getaddrinfo(hostname, NULL, &hints, &result);
 
     if (errcode != 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "IP address lookup for host '%s' failed: %s", hostname,
                   gai_strerror(errcode));
         return -1;
     }
 
     if (result == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "No IP address for host '%s' found: %s", hostname,
                   gai_strerror(errcode));
         return -1;
@@ -401,7 +400,7 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
                           ipAddress_length, NULL, 0, NI_NUMERICHOST);
 
     if (errcode != 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Formating IP address for host '%s' failed: %s", hostname,
                   gai_strerror(errcode));
         freeaddrinfo(result);
@@ -416,8 +415,8 @@ esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
 
 
 int
-esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
-                        char **string, int optional)
+esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
+                        int optional)
 {
     virConfValuePtr value;
 
@@ -429,13 +428,13 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
             return 0;
         }
 
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Missing essential config entry '%s'", name);
         return -1;
     }
 
     if (value->type != VIR_CONF_STRING) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Config entry '%s' must be a string", name);
         return -1;
     }
@@ -445,7 +444,7 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
             return 0;
         }
 
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Missing essential config entry '%s'", name);
         return -1;
     }
@@ -453,7 +452,7 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
     *string = strdup(value->str);
 
     if (*string == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         return -1;
     }
 
@@ -463,8 +462,8 @@ esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf, const char *name,
 
 
 int
-esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
-                      unsigned char *uuid, int optional)
+esxUtil_GetConfigUUID(virConfPtr conf, const char *name, unsigned char *uuid,
+                      int optional)
 {
     virConfValuePtr value;
 
@@ -474,14 +473,14 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
         if (optional) {
             return 0;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Missing essential config entry '%s'", name);
             return -1;
         }
     }
 
     if (value->type != VIR_CONF_STRING) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Config entry '%s' must be a string", name);
         return -1;
     }
@@ -490,14 +489,14 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
         if (optional) {
             return 0;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Missing essential config entry '%s'", name);
             return -1;
         }
     }
 
     if (virUUIDParse(value->str, uuid) < 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not parse UUID from string '%s'", value->str);
         return -1;
     }
@@ -508,8 +507,8 @@ esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
 
 
 int
-esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
-                      long long *number, long long default_, int optional)
+esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
+                      long long default_, int optional)
 {
     virConfValuePtr value;
 
@@ -520,7 +519,7 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
         if (optional) {
             return 0;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Missing essential config entry '%s'", name);
             return -1;
         }
@@ -531,7 +530,7 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
             if (optional) {
                 return 0;
             } else {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Missing essential config entry '%s'", name);
                 return -1;
             }
@@ -540,13 +539,13 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
         if (STREQ(value->str, "unlimited")) {
             *number = -1;
         } else if (virStrToLong_ll(value->str, NULL, 10, number) < 0) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Config entry '%s' must represent an integer value",
                       name);
             return -1;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Config entry '%s' must be a string", name);
         return -1;
     }
@@ -557,9 +556,8 @@ esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
 
 
 int
-esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
-                         const char *name, int *boolean_, int default_,
-                         int optional)
+esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
+                         int default_, int optional)
 {
     virConfValuePtr value;
 
@@ -570,7 +568,7 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
         if (optional) {
             return 0;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Missing essential config entry '%s'", name);
             return -1;
         }
@@ -581,7 +579,7 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
             if (optional) {
                 return 0;
             } else {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Missing essential config entry '%s'", name);
                 return -1;
             }
@@ -592,13 +590,13 @@ esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
         } else if (STRCASEEQ(value->str, "false")) {
             *boolean_ = 0;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Config entry '%s' must represent a boolean value "
                       "(true|false)", name);
             return -1;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Config entry '%s' must be a string", name);
         return -1;
     }
index 3987f3e6a73b85059284853428b72f4704e34434..6c6cbb0f350b8720c85eaa236c1e89aa44fa442e 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef __ESX_UTIL_H__
 #define __ESX_UTIL_H__
 
-#include <libxml/tree.h>
+#include <libxml/uri.h>
 
 #include "internal.h"
 #include "conf.h"
@@ -35,30 +35,28 @@ char *esxUtil_RequestUsername(virConnectAuthPtr auth,
 char *esxUtil_RequestPassword(virConnectAuthPtr auth, const char *username,
                               const char *hostname);
 
-int esxUtil_ParseQuery(virConnectPtr conn, char **transport, char **vCenter,
+int esxUtil_ParseQuery(xmlURIPtr uri, char **transport, char **vCenter,
                        int *noVerify, int *autoAnswer);
 
 int esxUtil_ParseVirtualMachineIDString(const char *id_string, int *id);
 
-int esxUtil_ParseDatastoreRelatedPath(virConnectPtr conn,
-                                      const char *datastoreRelatedPath,
+int esxUtil_ParseDatastoreRelatedPath(const char *datastoreRelatedPath,
                                       char **datastoreName,
                                       char **directoryName, char **fileName);
 
-int esxUtil_ResolveHostname(virConnectPtr conn, const char *hostname,
+int esxUtil_ResolveHostname(const char *hostname,
                             char *ipAddress, size_t ipAddress_length);
 
-int esxUtil_GetConfigString(virConnectPtr conn, virConfPtr conf,
-                            const char *name, char **string, int optional);
+int esxUtil_GetConfigString(virConfPtr conf, const char *name, char **string,
+                            int optional);
 
-int esxUtil_GetConfigUUID(virConnectPtr conn, virConfPtr conf, const char *name,
+int esxUtil_GetConfigUUID(virConfPtr conf, const char *name,
                           unsigned char *uuid, int optional);
 
-int esxUtil_GetConfigLong(virConnectPtr conn, virConfPtr conf, const char *name,
-                          long long *number, long long default_, int optional);
+int esxUtil_GetConfigLong(virConfPtr conf, const char *name, long long *number,
+                          long long default_, int optional);
 
-int esxUtil_GetConfigBoolean(virConnectPtr conn, virConfPtr conf,
-                             const char *name, int *boolean_, int default_,
-                             int optional);
+int esxUtil_GetConfigBoolean(virConfPtr conf, const char *name, int *boolean_,
+                             int default_, int optional);
 
 #endif /* __ESX_UTIL_H__ */
index 9cade3dc45c5e10eda8c4ef147aead5220d6f2f3..0fe953593ccf965c7b08b44c52013ea9d0bab601 100644 (file)
@@ -38,8 +38,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_VI_ERROR(conn, code, fmt...)                                      \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_VI_ERROR(code, fmt...)                                            \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, fmt)
 
 #define ESX_VI__SOAP__REQUEST_HEADER                                          \
@@ -77,9 +77,9 @@
 
 #define ESX_VI__TEMPLATE__ALLOC(_type)                                        \
     int                                                                       \
-    esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr)         \
+    esxVI_##_type##_Alloc(esxVI_##_type **ptrptr)                             \
     {                                                                         \
-        return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type));     \
+        return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type));           \
     }
 
 #define ESX_VI__TEMPLATE__FREE(_type, _body)                                  \
@@ -239,7 +239,7 @@ esxVI_CURL_Debug(CURL *curl ATTRIBUTE_UNUSED, curl_infotype type,
 #endif
 
 static int
-esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
+esxVI_CURL_Perform(esxVI_Context *ctx, const char *url)
 {
     CURLcode errorCode;
     long responseCode = 0;
@@ -250,7 +250,7 @@ esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
     errorCode = curl_easy_perform(ctx->curl_handle);
 
     if (errorCode != CURLE_OK) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "curl_easy_perform() returned an error: %s (%d)",
                      curl_easy_strerror(errorCode), errorCode);
         return -1;
@@ -260,7 +260,7 @@ esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
                                   &responseCode);
 
     if (errorCode != CURLE_OK) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned an "
                      "error: %s (%d)", curl_easy_strerror(errorCode),
                      errorCode);
@@ -268,7 +268,7 @@ esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
     }
 
     if (responseCode < 0) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "curl_easy_getinfo(CURLINFO_RESPONSE_CODE) returned a "
                      "negative response code");
         return -1;
@@ -280,17 +280,17 @@ esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
                                       &redirectUrl);
 
         if (errorCode != CURLE_OK) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "curl_easy_getinfo(CURLINFO_REDIRECT_URL) returned "
                          "an error: %s (%d)", curl_easy_strerror(errorCode),
                          errorCode);
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "The server redirects from '%s' to '%s'", url,
                          redirectUrl);
         }
 #else
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "The server redirects from '%s'", url);
 #endif
 
@@ -301,7 +301,7 @@ esxVI_CURL_Perform(virConnectPtr conn, esxVI_Context *ctx, const char *url)
 }
 
 int
-esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
+esxVI_Context_Connect(esxVI_Context *ctx, const char *url,
                       const char *ipAddress, const char *username,
                       const char *password, int noVerify)
 {
@@ -313,20 +313,19 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
     if (ctx == NULL || url == NULL || ipAddress == NULL || username == NULL ||
         password == NULL || ctx->url != NULL || ctx->service != NULL ||
         ctx->curl_handle != NULL || ctx->curl_headers != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
-    if (esxVI_String_DeepCopyValue(conn, &ctx->url, url) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &ctx->ipAddress, ipAddress) < 0) {
+    if (esxVI_String_DeepCopyValue(&ctx->url, url) < 0 ||
+        esxVI_String_DeepCopyValue(&ctx->ipAddress, ipAddress) < 0) {
         goto failure;
     }
 
     ctx->curl_handle = curl_easy_init();
 
     if (ctx->curl_handle == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                     "Could not initialize CURL");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL");
         goto failure;
     }
 
@@ -345,8 +344,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
                                           "Expect: nothing");
 
     if (ctx->curl_headers == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                     "Could not build CURL header list");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not build CURL header list");
         goto failure;
     }
 
@@ -368,8 +366,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
 #endif
 
     if (virMutexInit(&ctx->curl_lock) < 0) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                     "Could not initialize CURL mutex");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not initialize CURL mutex");
         goto failure;
     }
 
@@ -377,11 +374,11 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
     ctx->password = strdup(password);
 
     if (ctx->username == NULL || ctx->password == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
-    if (esxVI_RetrieveServiceContent(conn, ctx, &ctx->service) < 0) {
+    if (esxVI_RetrieveServiceContent(ctx, &ctx->service) < 0) {
         goto failure;
     }
 
@@ -392,7 +389,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
         } else if (STRPREFIX(ctx->service->about->apiVersion, "4.0")) {
             ctx->apiVersion = esxVI_APIVersion_40;
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Expecting VI API major/minor version '2.5' or '4.0' "
                          "but found '%s'", ctx->service->about->apiVersion);
             goto failure;
@@ -402,7 +399,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
             if (STRPREFIX(ctx->service->about->version, "2.0")) {
                 ctx->productVersion = esxVI_ProductVersion_GSX20;
             } else {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Expecting GSX major/minor version '2.0' but "
                              "found '%s'", ctx->service->about->version);
                 goto failure;
@@ -414,7 +411,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
             } else if (STRPREFIX(ctx->service->about->version, "4.0")) {
                 ctx->productVersion = esxVI_ProductVersion_ESX40;
             } else {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Expecting ESX major/minor version '3.5' or "
                              "'4.0' but found '%s'",
                              ctx->service->about->version);
@@ -426,39 +423,39 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
             } else if (STRPREFIX(ctx->service->about->version, "4.0")) {
                 ctx->productVersion = esxVI_ProductVersion_VPX40;
             } else {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Expecting VPX major/minor version '2.5' or '4.0' "
                              "but found '%s'", ctx->service->about->version);
                 goto failure;
             }
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Expecting product 'gsx' or 'esx' or 'embeddedEsx' "
                          "or 'vpx' but found '%s'",
                          ctx->service->about->productLineId);
             goto failure;
         }
     } else {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting VI API type 'HostAgent' or 'VirtualCenter' "
                      "but found '%s'", ctx->service->about->apiType);
         goto failure;
     }
 
-    if (esxVI_Login(conn, ctx, username, password, &ctx->session) < 0) {
+    if (esxVI_Login(ctx, username, password, &ctx->session) < 0) {
         goto failure;
     }
 
-    esxVI_BuildFullTraversalSpecList(conn, &ctx->fullTraversalSpecList);
+    esxVI_BuildFullTraversalSpecList(&ctx->fullTraversalSpecList);
 
-    if (esxVI_String_AppendValueListToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueListToList(&propertyNameList,
                                            "vmFolder\0"
                                            "hostFolder\0") < 0) {
         goto failure;
     }
 
     /* Get pointer to Datacenter for later use */
-    if (esxVI_LookupObjectContentByType(conn, ctx, ctx->service->rootFolder,
+    if (esxVI_LookupObjectContentByType(ctx, ctx->service->rootFolder,
                                         "Datacenter", propertyNameList,
                                         esxVI_Boolean_True,
                                         &datacenterList) < 0) {
@@ -466,7 +463,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
     }
 
     if (datacenterList == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Could not retrieve the 'datacenter' object from the VI "
                      "host/center");
         goto failure;
@@ -480,12 +477,12 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "vmFolder")) {
             if (esxVI_ManagedObjectReference_CastFromAnyType
-                  (conn, dynamicProperty->val, &ctx->vmFolder, "Folder")) {
+                  (dynamicProperty->val, &ctx->vmFolder, "Folder")) {
                 goto failure;
             }
         } else if (STREQ(dynamicProperty->name, "hostFolder")) {
             if (esxVI_ManagedObjectReference_CastFromAnyType
-                  (conn, dynamicProperty->val, &ctx->hostFolder, "Folder")) {
+                  (dynamicProperty->val, &ctx->hostFolder, "Folder")) {
                 goto failure;
             }
         } else {
@@ -494,7 +491,7 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
     }
 
     if (ctx->vmFolder == NULL || ctx->hostFolder == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "The 'datacenter' object is missing the "
                      "'vmFolder'/'hostFolder' property");
         goto failure;
@@ -513,14 +510,13 @@ esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx, const char *url,
 }
 
 int
-esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
-                           const char *url, char **content)
+esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url, char **content)
 {
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
     int responseCode = 0;
 
     if (content == NULL || *content != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
@@ -531,21 +527,21 @@ esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
     curl_easy_setopt(ctx->curl_handle, CURLOPT_UPLOAD, 0);
     curl_easy_setopt(ctx->curl_handle, CURLOPT_HTTPGET, 1);
 
-    responseCode = esxVI_CURL_Perform(conn, ctx, url);
+    responseCode = esxVI_CURL_Perform(ctx, url);
 
     virMutexUnlock(&ctx->curl_lock);
 
     if (responseCode < 0) {
         goto failure;
     } else if (responseCode != 200) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "HTTP response code %d for download from '%s'",
                      responseCode, url);
         goto failure;
     }
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -560,13 +556,13 @@ esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
 }
 
 int
-esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
-                         const char *url, const char *content)
+esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
+                         const char *content)
 {
     int responseCode = 0;
 
     if (content == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -577,14 +573,14 @@ esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
     curl_easy_setopt(ctx->curl_handle, CURLOPT_UPLOAD, 1);
     curl_easy_setopt(ctx->curl_handle, CURLOPT_INFILESIZE, strlen(content));
 
-    responseCode = esxVI_CURL_Perform(conn, ctx, url);
+    responseCode = esxVI_CURL_Perform(ctx, url);
 
     virMutexUnlock(&ctx->curl_lock);
 
     if (responseCode < 0) {
         return -1;
     } else if (responseCode != 200 && responseCode != 201) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "HTTP response code %d for upload to '%s'",
                      responseCode, url);
         return -1;
@@ -594,9 +590,9 @@ esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
 }
 
 int
-esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
-                      const char *methodName, const char *request,
-                      esxVI_Response **response, esxVI_Occurrence occurrence)
+esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
+                      const char *request, esxVI_Response **response,
+                      esxVI_Occurrence occurrence)
 {
     int result = 0;
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -606,11 +602,11 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
     xmlNodePtr responseNode = NULL;
 
     if (request == NULL || response == NULL || *response != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
-    if (esxVI_Response_Alloc(conn, response) < 0) {
+    if (esxVI_Response_Alloc(response) < 0) {
         goto failure;
     }
 
@@ -622,7 +618,7 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
     curl_easy_setopt(ctx->curl_handle, CURLOPT_POSTFIELDS, request);
     curl_easy_setopt(ctx->curl_handle, CURLOPT_POSTFIELDSIZE, strlen(request));
 
-    (*response)->responseCode = esxVI_CURL_Perform(conn, ctx, ctx->url);
+    (*response)->responseCode = esxVI_CURL_Perform(ctx, ctx->url);
 
     virMutexUnlock(&ctx->curl_lock);
 
@@ -631,7 +627,7 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
     }
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -642,14 +638,14 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
                                            NULL, XML_PARSE_NONET);
 
         if ((*response)->document == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Response for call to '%s' could not be parsed",
                          methodName);
             goto failure;
         }
 
         if (xmlDocGetRootElement((*response)->document) == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Response for call to '%s' is an empty XML document",
                          methodName);
             goto failure;
@@ -658,7 +654,7 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
         xpathContext = xmlXPathNewContext((*response)->document);
 
         if (xpathContext == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Could not create XPath context");
             goto failure;
         }
@@ -669,26 +665,26 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
 
         if ((*response)->responseCode == 500) {
             (*response)->node =
-              virXPathNode(conn, "/soapenv:Envelope/soapenv:Body/soapenv:Fault",
+              virXPathNode(NULL, "/soapenv:Envelope/soapenv:Body/soapenv:Fault",
                            xpathContext);
 
             if ((*response)->node == NULL) {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "HTTP response code %d for call to '%s'. "
                              "Fault is unknown, XPath evaluation failed",
                              (*response)->responseCode, methodName);
                 goto failure;
             }
 
-            if (esxVI_Fault_Deserialize(conn, (*response)->node, &fault) < 0) {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            if (esxVI_Fault_Deserialize((*response)->node, &fault) < 0) {
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "HTTP response code %d for call to '%s'. "
                              "Fault is unknown, deserialization failed",
                              (*response)->responseCode, methodName);
                 goto failure;
             }
 
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "HTTP response code %d for call to '%s'. "
                          "Fault: %s - %s", (*response)->responseCode,
                          methodName, fault->faultcode, fault->faultstring);
@@ -703,27 +699,27 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
             if (virAsprintf(&xpathExpression,
                             "/soapenv:Envelope/soapenv:Body/vim:%sResponse",
                             methodName) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
 
-            responseNode = virXPathNode(conn, xpathExpression, xpathContext);
+            responseNode = virXPathNode(NULL, xpathExpression, xpathContext);
 
             if (responseNode == NULL) {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "XPath evaluation of response for call to '%s' "
                              "failed", methodName);
                 goto failure;
             }
 
             xpathContext->node = responseNode;
-            (*response)->node = virXPathNode(conn, "./vim:returnval",
+            (*response)->node = virXPathNode(NULL, "./vim:returnval",
                                              xpathContext);
 
             switch (occurrence) {
               case esxVI_Occurrence_RequiredItem:
                 if ((*response)->node == NULL) {
-                    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                                  "Call to '%s' returned an empty result, "
                                  "expecting a non-empty result", methodName);
                     goto failure;
@@ -734,7 +730,7 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
               case esxVI_Occurrence_OptionalItem:
                 if ((*response)->node != NULL &&
                     (*response)->node->next != NULL) {
-                    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                                  "Call to '%s' returned a list, expecting "
                                  "exactly one item", methodName);
                     goto failure;
@@ -748,7 +744,7 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
 
               case esxVI_Occurrence_None:
                 if ((*response)->node != NULL) {
-                    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                                  "Call to '%s' returned something, expecting "
                                  "an empty result", methodName);
                     goto failure;
@@ -757,13 +753,13 @@ esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
                 break;
 
               default:
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Invalid argument (occurrence)");
                 goto failure;
             }
         }
     } else {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "HTTP response code %d for call to '%s'",
                      (*response)->responseCode, methodName);
         goto failure;
@@ -811,21 +807,20 @@ ESX_VI__TEMPLATE__FREE(Response,
  */
 
 int
-esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
-                                  const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
                                   esxVI_AnyType *anyType, int *value)
 {
     int i;
 
     if (anyType == NULL || value == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     *value = 0; /* undefined */
 
     if (STRNEQ(anyType->other, enumeration->type)) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting type '%s' but found '%s'", enumeration->type,
                      anyType->other);
         return -1;
@@ -838,7 +833,7 @@ esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
         }
     }
 
-    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                  "Unknown value '%s' for %s", anyType->value,
                  enumeration->type);
 
@@ -846,8 +841,7 @@ esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
 }
 
 int
-esxVI_Enumeration_Serialize(virConnectPtr conn,
-                            const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
                             int value, const char *element,
                             virBufferPtr output, esxVI_Boolean required)
 {
@@ -855,12 +849,12 @@ esxVI_Enumeration_Serialize(virConnectPtr conn,
     const char *name = NULL;
 
     if (element == NULL || output == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (value == 0) { /* undefined */
-        return esxVI_CheckSerializationNecessity(conn, element, required);
+        return esxVI_CheckSerializationNecessity(element, required);
     }
 
     for (i = 0; enumeration->values[i].name != NULL; ++i) {
@@ -871,7 +865,7 @@ esxVI_Enumeration_Serialize(virConnectPtr conn,
     }
 
     if (name == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -885,8 +879,7 @@ esxVI_Enumeration_Serialize(virConnectPtr conn,
 }
 
 int
-esxVI_Enumeration_Deserialize(virConnectPtr conn,
-                              const esxVI_Enumeration *enumeration,
+esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
                               xmlNodePtr node, int *value)
 {
     int i;
@@ -894,13 +887,13 @@ esxVI_Enumeration_Deserialize(virConnectPtr conn,
     char *name = NULL;
 
     if (value == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
     *value = 0; /* undefined */
 
-    if (esxVI_String_DeserializeValue(conn, node, &name) < 0) {
+    if (esxVI_String_DeserializeValue(node, &name) < 0) {
         goto failure;
     }
 
@@ -911,7 +904,7 @@ esxVI_Enumeration_Deserialize(virConnectPtr conn,
         }
     }
 
-    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
+    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Unknown value '%s' for %s",
                  name, enumeration->type);
 
   cleanup:
@@ -932,12 +925,12 @@ esxVI_Enumeration_Deserialize(virConnectPtr conn,
  */
 
 int
-esxVI_List_Append(virConnectPtr conn, esxVI_List **list, esxVI_List *item)
+esxVI_List_Append(esxVI_List **list, esxVI_List *item)
 {
     esxVI_List *next = NULL;
 
     if (list == NULL || item == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -958,8 +951,7 @@ esxVI_List_Append(virConnectPtr conn, esxVI_List **list, esxVI_List *item)
 }
 
 int
-esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
-                    esxVI_List *srcList,
+esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
                     esxVI_List_DeepCopyFunc deepCopyFunc,
                     esxVI_List_FreeFunc freeFunc)
 {
@@ -967,13 +959,13 @@ esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
     esxVI_List *src = NULL;
 
     if (destList == NULL || *destList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
     for (src = srcList; src != NULL; src = src->_next) {
-        if (deepCopyFunc(conn, &dest, src) < 0 ||
-            esxVI_List_Append(conn, destList, dest) < 0) {
+        if (deepCopyFunc(&dest, src) < 0 ||
+            esxVI_List_Append(destList, dest) < 0) {
             goto failure;
         }
 
@@ -990,8 +982,7 @@ esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
 }
 
 int
-esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
-                           esxVI_List **list,
+esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
                            esxVI_List_CastFromAnyTypeFunc castFromAnyTypeFunc,
                            esxVI_List_FreeFunc freeFunc)
 {
@@ -1002,7 +993,7 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
 
     if (list == NULL || *list != NULL ||
         castFromAnyTypeFunc == NULL || freeFunc == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1011,7 +1002,7 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
     }
 
     if (! STRPREFIX(anyType->other, "ArrayOf")) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting type to begin with 'ArrayOf' but found '%s'",
                      anyType->other);
         return -1;
@@ -1020,16 +1011,16 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
     for (childNode = anyType->_node->children; childNode != NULL;
          childNode = childNode->next) {
         if (childNode->type != XML_ELEMENT_NODE) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Wrong XML element type %d", childNode->type);
             goto failure;
         }
 
         esxVI_AnyType_Free(&childAnyType);
 
-        if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0 ||
-            castFromAnyTypeFunc(conn, childAnyType, &item) < 0 ||
-            esxVI_List_Append(conn, list, item) < 0) {
+        if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0 ||
+            castFromAnyTypeFunc(childAnyType, &item) < 0 ||
+            esxVI_List_Append(list, item) < 0) {
             goto failure;
         }
 
@@ -1051,24 +1042,23 @@ esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
 }
 
 int
-esxVI_List_Serialize(virConnectPtr conn, esxVI_List *list, const char *element,
+esxVI_List_Serialize(esxVI_List *list, const char *element,
                      virBufferPtr output, esxVI_Boolean required,
                      esxVI_List_SerializeFunc serializeFunc)
 {
     esxVI_List *item = NULL;
 
     if (element == NULL || output == NULL || serializeFunc == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (list == NULL) {
-        return esxVI_CheckSerializationNecessity(conn, element, required);
+        return esxVI_CheckSerializationNecessity(element, required);
     }
 
     for (item = list; item != NULL; item = item->_next) {
-        if (serializeFunc(conn, item, element, output,
-                          esxVI_Boolean_True) < 0) {
+        if (serializeFunc(item, element, output, esxVI_Boolean_True) < 0) {
             return -1;
         }
     }
@@ -1077,7 +1067,7 @@ esxVI_List_Serialize(virConnectPtr conn, esxVI_List *list, const char *element,
 }
 
 int
-esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
+esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
                        esxVI_List_DeserializeFunc deserializeFunc,
                        esxVI_List_FreeFunc freeFunc)
 {
@@ -1085,7 +1075,7 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
 
     if (list == NULL || *list != NULL ||
         deserializeFunc == NULL || freeFunc == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1095,13 +1085,13 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
 
     for (; node != NULL; node = node->next) {
         if (node->type != XML_ELEMENT_NODE) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Wrong XML element type %d", node->type);
             goto failure;
         }
 
-        if (deserializeFunc(conn, node, &item) < 0 ||
-            esxVI_List_Append(conn, list, item) < 0) {
+        if (deserializeFunc(node, &item) < 0 ||
+            esxVI_List_Append(list, item) < 0) {
             goto failure;
         }
 
@@ -1128,15 +1118,15 @@ esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node, esxVI_List **list,
  */
 
 int
-esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size)
+esxVI_Alloc(void **ptrptr, size_t size)
 {
     if (ptrptr == NULL || *ptrptr != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (virAllocN(ptrptr, size, 1) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         return -1;
     }
 
@@ -1146,16 +1136,16 @@ esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size)
 
 
 int
-esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
+esxVI_CheckSerializationNecessity(const char *element,
                                   esxVI_Boolean required)
 {
     if (element == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (required == esxVI_Boolean_True) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Required property missing while trying to serialize "
                      "'%s'", element);
         return -1;
@@ -1167,8 +1157,7 @@ esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
 
 
 int
-esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
-                                 esxVI_SelectionSpec **fullTraversalSpecList,
+esxVI_BuildFullTraversalSpecItem(esxVI_SelectionSpec **fullTraversalSpecList,
                                  const char *name, const char *type,
                                  const char *path, const char *selectSetNames)
 {
@@ -1177,15 +1166,14 @@ esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
     const char *currentSelectSetName = NULL;
 
     if (fullTraversalSpecList == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_TraversalSpec_Alloc(conn, &traversalSpec) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &traversalSpec->_base->name,
-                                   name) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &traversalSpec->type, type) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &traversalSpec->path, path) < 0) {
+    if (esxVI_TraversalSpec_Alloc(&traversalSpec) < 0 ||
+        esxVI_String_DeepCopyValue(&traversalSpec->_base->name, name) < 0 ||
+        esxVI_String_DeepCopyValue(&traversalSpec->type, type) < 0 ||
+        esxVI_String_DeepCopyValue(&traversalSpec->path, path) < 0) {
         goto failure;
     }
 
@@ -1197,11 +1185,10 @@ esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
         while (currentSelectSetName != NULL && *currentSelectSetName != '\0') {
             selectionSpec = NULL;
 
-            if (esxVI_SelectionSpec_Alloc(conn, &selectionSpec) < 0 ||
-                esxVI_String_DeepCopyValue(conn, &selectionSpec->name,
+            if (esxVI_SelectionSpec_Alloc(&selectionSpec) < 0 ||
+                esxVI_String_DeepCopyValue(&selectionSpec->name,
                                            currentSelectSetName) < 0 ||
-                esxVI_SelectionSpec_AppendToList(conn,
-                                                 &traversalSpec->selectSet,
+                esxVI_SelectionSpec_AppendToList(&traversalSpec->selectSet,
                                                  selectionSpec) < 0) {
                 goto failure;
             }
@@ -1210,7 +1197,7 @@ esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
         }
     }
 
-    if (esxVI_SelectionSpec_AppendToList(conn, fullTraversalSpecList,
+    if (esxVI_SelectionSpec_AppendToList(fullTraversalSpecList,
                                          traversalSpec->_base) < 0) {
         goto failure;
     }
@@ -1226,15 +1213,14 @@ esxVI_BuildFullTraversalSpecItem(virConnectPtr conn,
 
 
 int
-esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
-                                 esxVI_SelectionSpec **fullTraversalSpecList)
+esxVI_BuildFullTraversalSpecList(esxVI_SelectionSpec **fullTraversalSpecList)
 {
     if (fullTraversalSpecList == NULL || *fullTraversalSpecList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "visitFolders",
                                          "Folder", "childEntity",
                                          "visitFolders\0"
@@ -1249,7 +1235,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Traversal through datastore branch */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "datacenterToDatastore",
                                          "Datacenter", "datastore",
                                          NULL) < 0) {
@@ -1257,7 +1243,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Traversal through vmFolder branch */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "datacenterToVmFolder",
                                          "Datacenter", "vmFolder",
                                          "visitFolders\0") < 0) {
@@ -1265,7 +1251,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Traversal through hostFolder branch  */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "datacenterToHostFolder",
                                          "Datacenter", "hostFolder",
                                          "visitFolders\0") < 0) {
@@ -1273,7 +1259,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Traversal through host branch  */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "computeResourceToHost",
                                          "ComputeResource", "host",
                                          NULL) < 0) {
@@ -1281,7 +1267,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Traversal through resourcePool branch */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "computeResourceToResourcePool",
                                          "ComputeResource", "resourcePool",
                                          "resourcePoolToResourcePool\0"
@@ -1290,7 +1276,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Recurse through all resource pools */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "resourcePoolToResourcePool",
                                          "ResourcePool", "resourcePool",
                                          "resourcePoolToResourcePool\0"
@@ -1299,7 +1285,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Recurse through all hosts */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "hostSystemToVm",
                                          "HostSystem", "vm",
                                          "visitFolders\0") < 0) {
@@ -1307,7 +1293,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
     }
 
     /* Recurse through all resource pools */
-    if (esxVI_BuildFullTraversalSpecItem(conn, fullTraversalSpecList,
+    if (esxVI_BuildFullTraversalSpecItem(fullTraversalSpecList,
                                          "resourcePoolToVm",
                                          "ResourcePool", "vm", NULL) < 0) {
         goto failure;
@@ -1333,7 +1319,7 @@ esxVI_BuildFullTraversalSpecList(virConnectPtr conn,
 #define ESX_VI_USE_SESSION_IS_ACTIVE 0
 
 int
-esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
+esxVI_EnsureSession(esxVI_Context *ctx)
 {
     int result = 0;
 #if ESX_VI_USE_SESSION_IS_ACTIVE
@@ -1346,29 +1332,28 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
 #endif
 
     if (ctx->session == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
 #if ESX_VI_USE_SESSION_IS_ACTIVE
-    if (esxVI_SessionIsActive(conn, ctx, ctx->session->key,
-                              ctx->session->userName, &active) < 0) {
+    if (esxVI_SessionIsActive(ctx, ctx->session->key, ctx->session->userName,
+                              &active) < 0) {
         return -1;
     }
 
     if (active != esxVI_Boolean_True) {
         esxVI_UserSession_Free(&ctx->session);
 
-        if (esxVI_Login(conn, ctx, ctx->username, ctx->password,
+        if (esxVI_Login(ctx, ctx->username, ctx->password,
                         &ctx->session) < 0) {
             return -1;
         }
     }
 #else
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "currentSession") < 0 ||
-        esxVI_LookupObjectContentByType(conn, ctx,
-                                        ctx->service->sessionManager,
+        esxVI_LookupObjectContentByType(ctx, ctx->service->sessionManager,
                                         "SessionManager", propertyNameList,
                                         esxVI_Boolean_False,
                                         &sessionManager) < 0) {
@@ -1378,7 +1363,7 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
     for (dynamicProperty = sessionManager->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "currentSession")) {
-            if (esxVI_UserSession_CastFromAnyType(conn, dynamicProperty->val,
+            if (esxVI_UserSession_CastFromAnyType(dynamicProperty->val,
                                                   &currentSession) < 0) {
                 goto failure;
             }
@@ -1392,12 +1377,11 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
     if (currentSession == NULL) {
         esxVI_UserSession_Free(&ctx->session);
 
-        if (esxVI_Login(conn, ctx, ctx->username, ctx->password,
-                        &ctx->session) < 0) {
+        if (esxVI_Login(ctx, ctx->username, ctx->password, &ctx->session) < 0) {
             goto failure;
         }
     } else if (STRNEQ(ctx->session->key, currentSession->key)) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Key of the current session differs from the key at "
                      "last login");
         goto failure;
@@ -1426,7 +1410,7 @@ esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx)
 
 
 int
-esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_LookupObjectContentByType(esxVI_Context *ctx,
                                 esxVI_ManagedObjectReference *root,
                                 const char *type,
                                 esxVI_String *propertyNameList,
@@ -1439,11 +1423,11 @@ esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_PropertyFilterSpec *propertyFilterSpec = NULL;
 
     if (ctx->fullTraversalSpecList == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
-    if (esxVI_ObjectSpec_Alloc(conn, &objectSpec) < 0) {
+    if (esxVI_ObjectSpec_Alloc(&objectSpec) < 0) {
         goto failure;
     }
 
@@ -1454,22 +1438,22 @@ esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
         objectSpec->selectSet = ctx->fullTraversalSpecList;
     }
 
-    if (esxVI_PropertySpec_Alloc(conn, &propertySpec) < 0) {
+    if (esxVI_PropertySpec_Alloc(&propertySpec) < 0) {
         goto failure;
     }
 
     propertySpec->type = (char *)type;
     propertySpec->pathSet = propertyNameList;
 
-    if (esxVI_PropertyFilterSpec_Alloc(conn, &propertyFilterSpec) < 0 ||
-        esxVI_PropertySpec_AppendToList(conn, &propertyFilterSpec->propSet,
+    if (esxVI_PropertyFilterSpec_Alloc(&propertyFilterSpec) < 0 ||
+        esxVI_PropertySpec_AppendToList(&propertyFilterSpec->propSet,
                                         propertySpec) < 0 ||
-        esxVI_ObjectSpec_AppendToList(conn, &propertyFilterSpec->objectSet,
+        esxVI_ObjectSpec_AppendToList(&propertyFilterSpec->objectSet,
                                       objectSpec) < 0) {
         goto failure;
     }
 
-    result = esxVI_RetrieveProperties(conn, ctx, propertyFilterSpec,
+    result = esxVI_RetrieveProperties(ctx, propertyFilterSpec,
                                       objectContentList);
 
   cleanup:
@@ -1500,8 +1484,7 @@ esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_GetManagedEntityStatus(virConnectPtr conn,
-                             esxVI_ObjectContent *objectContent,
+esxVI_GetManagedEntityStatus(esxVI_ObjectContent *objectContent,
                              const char *propertyName,
                              esxVI_ManagedEntityStatus *managedEntityStatus)
 {
@@ -1511,11 +1494,11 @@ esxVI_GetManagedEntityStatus(virConnectPtr conn,
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, propertyName)) {
             return esxVI_ManagedEntityStatus_CastFromAnyType
-                     (conn, dynamicProperty->val, managedEntityStatus);
+                     (dynamicProperty->val, managedEntityStatus);
         }
     }
 
-    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                  "Missing '%s' property while looking for ManagedEntityStatus",
                  propertyName);
 
@@ -1525,8 +1508,7 @@ esxVI_GetManagedEntityStatus(virConnectPtr conn,
 
 
 int
-esxVI_GetVirtualMachinePowerState(virConnectPtr conn,
-                                  esxVI_ObjectContent *virtualMachine,
+esxVI_GetVirtualMachinePowerState(esxVI_ObjectContent *virtualMachine,
                                   esxVI_VirtualMachinePowerState *powerState)
 {
     esxVI_DynamicProperty *dynamicProperty;
@@ -1535,11 +1517,11 @@ esxVI_GetVirtualMachinePowerState(virConnectPtr conn,
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "runtime.powerState")) {
             return esxVI_VirtualMachinePowerState_CastFromAnyType
-                     (conn, dynamicProperty->val, powerState);
+                     (dynamicProperty->val, powerState);
         }
     }
 
-    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                  "Missing 'runtime.powerState' property");
 
     return -1;
@@ -1549,13 +1531,13 @@ esxVI_GetVirtualMachinePowerState(virConnectPtr conn,
 
 int
 esxVI_GetVirtualMachineQuestionInfo
-  (virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
+  (esxVI_ObjectContent *virtualMachine,
    esxVI_VirtualMachineQuestionInfo **questionInfo)
 {
     esxVI_DynamicProperty *dynamicProperty;
 
     if (questionInfo == NULL || *questionInfo != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1563,7 +1545,7 @@ esxVI_GetVirtualMachineQuestionInfo
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "runtime.question")) {
             if (esxVI_VirtualMachineQuestionInfo_CastFromAnyType
-                  (conn, dynamicProperty->val, questionInfo) < 0) {
+                  (dynamicProperty->val, questionInfo) < 0) {
                 return -1;
             }
         }
@@ -1575,7 +1557,7 @@ esxVI_GetVirtualMachineQuestionInfo
 
 
 int
-esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_LookupNumberOfDomainsByPowerState(esxVI_Context *ctx,
                                         esxVI_VirtualMachinePowerState powerState,
                                         esxVI_Boolean inverse)
 {
@@ -1586,11 +1568,10 @@ esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_VirtualMachinePowerState powerState_;
     int numberOfDomains = 0;
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.powerState") < 0 ||
-        esxVI_LookupObjectContentByType(conn, ctx, ctx->vmFolder,
-                                        "VirtualMachine", propertyNameList,
-                                        esxVI_Boolean_True,
+        esxVI_LookupObjectContentByType(ctx, ctx->vmFolder, "VirtualMachine",
+                                        propertyNameList, esxVI_Boolean_True,
                                         &virtualMachineList) < 0) {
         goto failure;
     }
@@ -1602,7 +1583,7 @@ esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
              dynamicProperty = dynamicProperty->_next) {
             if (STREQ(dynamicProperty->name, "runtime.powerState")) {
                 if (esxVI_VirtualMachinePowerState_CastFromAnyType
-                      (conn, dynamicProperty->val, &powerState_) < 0) {
+                      (dynamicProperty->val, &powerState_) < 0) {
                     goto failure;
                 }
 
@@ -1633,8 +1614,7 @@ esxVI_LookupNumberOfDomainsByPowerState(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
-                                esxVI_ObjectContent *virtualMachine,
+esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
                                 int *id, char **name, unsigned char *uuid)
 {
     const char *uuid_string = NULL;
@@ -1642,7 +1622,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
     esxVI_ManagedEntityStatus configStatus = esxVI_ManagedEntityStatus_Undefined;
 
     if (STRNEQ(virtualMachine->obj->type, "VirtualMachine")) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "ObjectContent does not reference a virtual machine");
         return -1;
     }
@@ -1650,7 +1630,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
     if (id != NULL) {
         if (esxUtil_ParseVirtualMachineIDString
               (virtualMachine->obj->value, id) < 0 || *id <= 0) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Could not parse positive integer from '%s'",
                          virtualMachine->obj->value);
             goto failure;
@@ -1659,7 +1639,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
 
     if (name != NULL) {
         if (*name != NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
             goto failure;
         }
 
@@ -1667,7 +1647,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
              dynamicProperty != NULL;
              dynamicProperty = dynamicProperty->_next) {
             if (STREQ(dynamicProperty->name, "name")) {
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_String) < 0) {
                     goto failure;
                 }
@@ -1675,7 +1655,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
                 *name = strdup(dynamicProperty->val->string);
 
                 if (*name == NULL) {
-                    virReportOOMError(conn);
+                    virReportOOMError(NULL);
                     goto failure;
                 }
 
@@ -1684,14 +1664,14 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
         }
 
         if (*name == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Could not get name of virtual machine");
             goto failure;
         }
     }
 
     if (uuid != NULL) {
-        if (esxVI_GetManagedEntityStatus(conn, virtualMachine, "configStatus",
+        if (esxVI_GetManagedEntityStatus(virtualMachine, "configStatus",
                                          &configStatus) < 0) {
             goto failure;
         }
@@ -1701,7 +1681,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
                  dynamicProperty != NULL;
                  dynamicProperty = dynamicProperty->_next) {
                 if (STREQ(dynamicProperty->name, "config.uuid")) {
-                    if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                    if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                                  esxVI_Type_String) < 0) {
                         goto failure;
                     }
@@ -1712,13 +1692,13 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
             }
 
             if (uuid_string == NULL) {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Could not get UUID of virtual machine");
                 goto failure;
             }
 
             if (virUUIDParse(uuid_string, uuid) < 0) {
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                              "Could not parse UUID from string '%s'",
                              uuid_string);
                 goto failure;
@@ -1745,7 +1725,7 @@ esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
 
 int
 esxVI_LookupResourcePoolByHostSystem
-  (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+  (esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
    esxVI_ManagedObjectReference **resourcePool)
 {
     int result = 0;
@@ -1755,7 +1735,7 @@ esxVI_LookupResourcePoolByHostSystem
     esxVI_ObjectContent *computeResource = NULL;
 
     if (resourcePool == NULL || *resourcePool != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1763,7 +1743,7 @@ esxVI_LookupResourcePoolByHostSystem
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "parent")) {
             if (esxVI_ManagedObjectReference_CastFromAnyType
-                  (conn, dynamicProperty->val, &managedObjectReference,
+                  (dynamicProperty->val, &managedObjectReference,
                    "ComputeResource") < 0) {
                 goto failure;
             }
@@ -1775,14 +1755,13 @@ esxVI_LookupResourcePoolByHostSystem
     }
 
     if (managedObjectReference == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Could not retrieve compute resource of host system");
         goto failure;
     }
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
-                                       "resourcePool") < 0 ||
-        esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+    if (esxVI_String_AppendValueToList(&propertyNameList, "resourcePool") < 0 ||
+        esxVI_LookupObjectContentByType(ctx, managedObjectReference,
                                         "ComputeResource", propertyNameList,
                                         esxVI_Boolean_False,
                                         &computeResource) < 0) {
@@ -1790,7 +1769,7 @@ esxVI_LookupResourcePoolByHostSystem
     }
 
     if (computeResource == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Could not retrieve compute resource of host system");
         goto failure;
     }
@@ -1799,8 +1778,7 @@ esxVI_LookupResourcePoolByHostSystem
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "resourcePool")) {
             if (esxVI_ManagedObjectReference_CastFromAnyType
-                  (conn, dynamicProperty->val, resourcePool,
-                   "ResourcePool") < 0) {
+                  (dynamicProperty->val, resourcePool, "ResourcePool") < 0) {
                 goto failure;
             }
 
@@ -1811,7 +1789,7 @@ esxVI_LookupResourcePoolByHostSystem
     }
 
     if ((*resourcePool) == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Could not retrieve resource pool of compute resource");
         goto failure;
     }
@@ -1832,8 +1810,7 @@ esxVI_LookupResourcePoolByHostSystem
 
 
 int
-esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
-                           const char *ipAddress,
+esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
                            esxVI_String *propertyNameList,
                            esxVI_ObjectContent **hostSystem)
 {
@@ -1841,16 +1818,16 @@ esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_ManagedObjectReference *managedObjectReference = NULL;
 
     if (hostSystem == NULL || *hostSystem != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_FindByIp(conn, ctx, ctx->datacenter, ipAddress,
-                       esxVI_Boolean_False, &managedObjectReference) < 0) {
+    if (esxVI_FindByIp(ctx, ctx->datacenter, ipAddress, esxVI_Boolean_False,
+                       &managedObjectReference) < 0) {
         goto failure;
     }
 
-    if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+    if (esxVI_LookupObjectContentByType(ctx, managedObjectReference,
                                         "HostSystem", propertyNameList,
                                         esxVI_Boolean_False, hostSystem) < 0) {
         goto failure;
@@ -1870,8 +1847,7 @@ esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
-                                 const unsigned char *uuid,
+esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx, const unsigned char *uuid,
                                  esxVI_String *propertyNameList,
                                  esxVI_ObjectContent **virtualMachine,
                                  esxVI_Occurrence occurrence)
@@ -1881,11 +1857,11 @@ esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
     char uuid_string[VIR_UUID_STRING_BUFLEN] = "";
 
     if (virtualMachine == NULL || *virtualMachine != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_FindByUuid(conn, ctx, ctx->datacenter, uuid, esxVI_Boolean_True,
+    if (esxVI_FindByUuid(ctx, ctx->datacenter, uuid, esxVI_Boolean_True,
                          &managedObjectReference) < 0) {
         goto failure;
     }
@@ -1896,13 +1872,13 @@ esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
         } else {
             virUUIDFormat(uuid, uuid_string);
 
-            ESX_VI_ERROR(conn, VIR_ERR_NO_DOMAIN,
+            ESX_VI_ERROR(VIR_ERR_NO_DOMAIN,
                          "Could not find domain with UUID '%s'", uuid_string);
             goto failure;
         }
     }
 
-    if (esxVI_LookupObjectContentByType(conn, ctx, managedObjectReference,
+    if (esxVI_LookupObjectContentByType(ctx, managedObjectReference,
                                         "VirtualMachine", propertyNameList,
                                         esxVI_Boolean_False,
                                         virtualMachine) < 0) {
@@ -1924,7 +1900,7 @@ esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
 
 int
 esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-  (virConnectPtr conn, esxVI_Context *ctx, const unsigned char *uuid,
+  (esxVI_Context *ctx, const unsigned char *uuid,
    esxVI_String *propertyNameList, esxVI_ObjectContent **virtualMachine,
    esxVI_Boolean autoAnswer)
 {
@@ -1933,30 +1909,29 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
     esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
     esxVI_TaskInfo *pendingTaskInfoList = NULL;
 
-    if (esxVI_String_DeepCopyList(conn, &completePropertyNameList,
+    if (esxVI_String_DeepCopyList(&completePropertyNameList,
                                   propertyNameList) < 0 ||
-        esxVI_String_AppendValueListToList(conn, &completePropertyNameList,
+        esxVI_String_AppendValueListToList(&completePropertyNameList,
                                            "runtime.question\0"
                                            "recentTask\0") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(conn, ctx, uuid,
-                                         completePropertyNameList,
+        esxVI_LookupVirtualMachineByUuid(ctx, uuid, completePropertyNameList,
                                          virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachineQuestionInfo(conn, *virtualMachine,
+        esxVI_GetVirtualMachineQuestionInfo(*virtualMachine,
                                             &questionInfo) < 0 ||
         esxVI_LookupPendingTaskInfoListByVirtualMachine
-           (conn, ctx, *virtualMachine, &pendingTaskInfoList) < 0) {
+           (ctx, *virtualMachine, &pendingTaskInfoList) < 0) {
         goto failure;
     }
 
     if (questionInfo != NULL &&
-        esxVI_HandleVirtualMachineQuestion(conn, ctx, (*virtualMachine)->obj,
+        esxVI_HandleVirtualMachineQuestion(ctx, (*virtualMachine)->obj,
                                            questionInfo, autoAnswer) < 0) {
         goto failure;
     }
 
     if (pendingTaskInfoList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_OPERATION_INVALID,
+        ESX_VI_ERROR(VIR_ERR_OPERATION_INVALID,
                      "Other tasks are pending for this domain");
         goto failure;
     }
@@ -1977,8 +1952,8 @@ esxVI_LookupVirtualMachineByUuidAndPrepareForTask
 
 
 int
-esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
-                            const char *name, esxVI_String *propertyNameList,
+esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
+                            esxVI_String *propertyNameList,
                             esxVI_ObjectContent **datastore,
                             esxVI_Occurrence occurrence)
 {
@@ -1992,22 +1967,22 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
     int numInaccessibleDatastores = 0;
 
     if (datastore == NULL || *datastore != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     /* Get all datastores */
-    if (esxVI_String_DeepCopyList(conn, &completePropertyNameList,
+    if (esxVI_String_DeepCopyList(&completePropertyNameList,
                                   propertyNameList) < 0 ||
-        esxVI_String_AppendValueListToList(conn, &completePropertyNameList,
+        esxVI_String_AppendValueListToList(&completePropertyNameList,
                                            "summary.accessible\0"
                                            "summary.name\0"
                                            "summary.url\0") < 0) {
         goto failure;
     }
 
-    if (esxVI_LookupObjectContentByType(conn, ctx, ctx->datacenter,
-                                        "Datastore", completePropertyNameList,
+    if (esxVI_LookupObjectContentByType(ctx, ctx->datacenter, "Datastore",
+                                        completePropertyNameList,
                                         esxVI_Boolean_True,
                                         &datastoreList) < 0) {
         goto failure;
@@ -2017,8 +1992,7 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
         if (occurrence == esxVI_Occurrence_OptionalItem) {
             goto cleanup;
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                         "No datastores available");
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "No datastores available");
             goto failure;
         }
     }
@@ -2031,7 +2005,7 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
         for (dynamicProperty = candidate->propSet; dynamicProperty != NULL;
              dynamicProperty = dynamicProperty->_next) {
             if (STREQ(dynamicProperty->name, "summary.accessible")) {
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_Boolean) < 0) {
                     goto failure;
                 }
@@ -2042,7 +2016,7 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
         }
 
         if (accessible == esxVI_Boolean_Undefined) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Got incomplete response while querying for the "
                          "datastore 'summary.accessible' property");
             goto failure;
@@ -2057,13 +2031,13 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
             if (STREQ(dynamicProperty->name, "summary.accessible")) {
                 /* Ignore it */
             } else if (STREQ(dynamicProperty->name, "summary.name")) {
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_String) < 0) {
                     goto failure;
                 }
 
                 if (STREQ(dynamicProperty->val->string, name)) {
-                    if (esxVI_ObjectContent_DeepCopy(conn, datastore,
+                    if (esxVI_ObjectContent_DeepCopy(datastore,
                                                      candidate) < 0) {
                         goto failure;
                     }
@@ -2080,14 +2054,14 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
                     continue;
                 }
 
-                if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                              esxVI_Type_String) < 0) {
                     goto failure;
                 }
 
                 if (! STRPREFIX(dynamicProperty->val->string,
                                 "/vmfs/volumes/")) {
-                    ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                                  "Datastore URL '%s' has unexpected prefix, "
                                  "expecting '/vmfs/volumes/' prefix",
                                  dynamicProperty->val->string);
@@ -2095,7 +2069,7 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
                 }
 
                 if (STREQ(dynamicProperty->val->string + offset, name)) {
-                    if (esxVI_ObjectContent_DeepCopy(conn, datastore,
+                    if (esxVI_ObjectContent_DeepCopy(datastore,
                                                      candidate) < 0) {
                         goto failure;
                     }
@@ -2111,11 +2085,11 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
 
     if (occurrence != esxVI_Occurrence_OptionalItem) {
         if (numInaccessibleDatastores > 0) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Could not find datastore '%s', maybe it's "
                          "inaccessible", name);
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Could not find datastore '%s'", name);
         }
 
@@ -2136,7 +2110,7 @@ esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
 
 
 
-int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
                                esxVI_ManagedObjectReference *task,
                                esxVI_TaskInfo **taskInfo)
 {
@@ -2146,13 +2120,13 @@ int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_DynamicProperty *dynamicProperty = NULL;
 
     if (taskInfo == NULL || *taskInfo != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList, "info") < 0 ||
-        esxVI_LookupObjectContentByType(conn, ctx, task, "Task",
-                                        propertyNameList, esxVI_Boolean_False,
+    if (esxVI_String_AppendValueToList(&propertyNameList, "info") < 0 ||
+        esxVI_LookupObjectContentByType(ctx, task, "Task", propertyNameList,
+                                        esxVI_Boolean_False,
                                         &objectContent) < 0) {
         goto failure;
     }
@@ -2160,7 +2134,7 @@ int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
     for (dynamicProperty = objectContent->propSet; dynamicProperty != NULL;
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "info")) {
-            if (esxVI_TaskInfo_CastFromAnyType(conn, dynamicProperty->val,
+            if (esxVI_TaskInfo_CastFromAnyType(dynamicProperty->val,
                                                taskInfo) < 0) {
                 goto failure;
             }
@@ -2187,7 +2161,7 @@ int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
 
 int
 esxVI_LookupPendingTaskInfoListByVirtualMachine
-  (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
+  (esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
    esxVI_TaskInfo **pendingTaskInfoList)
 {
     int result = 0;
@@ -2198,7 +2172,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
     esxVI_TaskInfo *taskInfo = NULL;
 
     if (pendingTaskInfoList == NULL || *pendingTaskInfoList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -2207,7 +2181,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
          dynamicProperty = dynamicProperty->_next) {
         if (STREQ(dynamicProperty->name, "recentTask")) {
             if (esxVI_ManagedObjectReference_CastListFromAnyType
-                  (conn, dynamicProperty->val, &recentTaskList, "Task") < 0) {
+                  (dynamicProperty->val, &recentTaskList, "Task") < 0) {
                 goto failure;
             }
 
@@ -2218,13 +2192,13 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
     /* Lookup task info for each task */
     for (recentTask = recentTaskList; recentTask != NULL;
          recentTask = recentTask->_next) {
-        if (esxVI_LookupTaskInfoByTask(conn, ctx, recentTask, &taskInfo) < 0) {
+        if (esxVI_LookupTaskInfoByTask(ctx, recentTask, &taskInfo) < 0) {
             goto failure;
         }
 
         if (taskInfo->state == esxVI_TaskInfoState_Queued ||
             taskInfo->state == esxVI_TaskInfoState_Running) {
-            if (esxVI_TaskInfo_AppendToList(conn, pendingTaskInfoList,
+            if (esxVI_TaskInfo_AppendToList(pendingTaskInfoList,
                                             taskInfo) < 0) {
                 goto failure;
             }
@@ -2253,8 +2227,7 @@ esxVI_LookupPendingTaskInfoListByVirtualMachine
 
 
 int
-esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
-                                            esxVI_Context *ctx,
+esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
                                             const unsigned char *uuid,
                                             esxVI_Boolean autoAnswer)
 {
@@ -2263,18 +2236,18 @@ esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
     esxVI_String *propertyNameList = NULL;
     esxVI_VirtualMachineQuestionInfo *questionInfo = NULL;
 
-    if (esxVI_String_AppendValueToList(conn, &propertyNameList,
+    if (esxVI_String_AppendValueToList(&propertyNameList,
                                        "runtime.question") < 0 ||
-        esxVI_LookupVirtualMachineByUuid(conn, ctx, uuid, propertyNameList,
+        esxVI_LookupVirtualMachineByUuid(ctx, uuid, propertyNameList,
                                          &virtualMachine,
                                          esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_GetVirtualMachineQuestionInfo(conn, virtualMachine,
+        esxVI_GetVirtualMachineQuestionInfo(virtualMachine,
                                             &questionInfo) < 0) {
         goto failure;
     }
 
     if (questionInfo != NULL &&
-        esxVI_HandleVirtualMachineQuestion(conn, ctx, virtualMachine->obj,
+        esxVI_HandleVirtualMachineQuestion(ctx, virtualMachine->obj,
                                            questionInfo, autoAnswer) < 0) {
         goto failure;
     }
@@ -2295,8 +2268,8 @@ esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
 
 
 int
-esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
-                              const char *name, const char *request,
+esxVI_StartVirtualMachineTask(esxVI_Context *ctx, const char *name,
+                              const char *request,
                               esxVI_ManagedObjectReference **task)
 {
     int result = 0;
@@ -2304,13 +2277,13 @@ esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (virAsprintf(&methodName, "%s_Task", name) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
-    if (esxVI_Context_Execute(conn, ctx, methodName, request, &response,
+    if (esxVI_Context_Execute(ctx, methodName, request, &response,
                               esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_ManagedObjectReference_Deserialize(conn, response->node, task,
+        esxVI_ManagedObjectReference_Deserialize(response->node, task,
                                                  "Task") < 0) {
         goto failure;
     }
@@ -2331,7 +2304,7 @@ esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
 
 int
 esxVI_StartSimpleVirtualMachineTask
-  (virConnectPtr conn, esxVI_Context *ctx, const char *name,
+  (esxVI_Context *ctx, const char *name,
    esxVI_ManagedObjectReference *virtualMachine,
    esxVI_ManagedObjectReference **task)
 {
@@ -2344,8 +2317,7 @@ esxVI_StartSimpleVirtualMachineTask
     virBufferAdd(&buffer, name, -1);
     virBufferAddLit(&buffer, "_Task xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -2356,13 +2328,13 @@ esxVI_StartSimpleVirtualMachineTask
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_StartVirtualMachineTask(conn, ctx, name, request, task) < 0) {
+    if (esxVI_StartVirtualMachineTask(ctx, name, request, task) < 0) {
         goto failure;
     }
 
@@ -2382,8 +2354,7 @@ esxVI_StartSimpleVirtualMachineTask
 
 
 int
-esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
-                                 const char *name,
+esxVI_SimpleVirtualMachineMethod(esxVI_Context *ctx, const char *name,
                                  esxVI_ManagedObjectReference *virtualMachine)
 {
     int result = 0;
@@ -2392,7 +2363,7 @@ esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -2401,8 +2372,7 @@ esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAdd(&buffer, name, -1);
     virBufferAddLit(&buffer, " xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -2413,13 +2383,13 @@ esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, name, request, &response,
+    if (esxVI_Context_Execute(ctx, name, request, &response,
                               esxVI_Occurrence_None) < 0) {
         goto failure;
     }
@@ -2442,8 +2412,7 @@ esxVI_SimpleVirtualMachineMethod(virConnectPtr conn, esxVI_Context *ctx,
 
 int
 esxVI_HandleVirtualMachineQuestion
-  (virConnectPtr conn, esxVI_Context *ctx,
-   esxVI_ManagedObjectReference *virtualMachine,
+  (esxVI_Context *ctx, esxVI_ManagedObjectReference *virtualMachine,
    esxVI_VirtualMachineQuestionInfo *questionInfo,
    esxVI_Boolean autoAnswer)
 {
@@ -2474,7 +2443,7 @@ esxVI_HandleVirtualMachineQuestion
         }
 
         if (virBufferError(&buffer)) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
 
@@ -2483,13 +2452,13 @@ esxVI_HandleVirtualMachineQuestion
 
     if (autoAnswer == esxVI_Boolean_True) {
         if (possibleAnswers == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Pending question blocks virtual machine execution, "
                          "question is '%s', no possible answers",
                          questionInfo->text);
             goto failure;
         } else if (answerChoice == NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Pending question blocks virtual machine execution, "
                          "question is '%s', possible answers are %s, but no "
                          "default answer is specified", questionInfo->text,
@@ -2502,18 +2471,18 @@ esxVI_HandleVirtualMachineQuestion
                  "with default answer '%s'", questionInfo->text,
                  possibleAnswers, answerChoice->label);
 
-        if (esxVI_AnswerVM(conn, ctx, virtualMachine, questionInfo->id,
+        if (esxVI_AnswerVM(ctx, virtualMachine, questionInfo->id,
                            answerChoice->key) < 0) {
             goto failure;
         }
     } else {
         if (possibleAnswers != NULL) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Pending question blocks virtual machine execution, "
                          "question is '%s', possible answers are %s",
                          questionInfo->text, possibleAnswers);
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Pending question blocks virtual machine execution, "
                          "question is '%s', no possible answers",
                          questionInfo->text);
@@ -2540,7 +2509,7 @@ esxVI_HandleVirtualMachineQuestion
 
 
 int
-esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
                             esxVI_ManagedObjectReference *task,
                             const unsigned char *virtualMachineUuid,
                             esxVI_Boolean autoAnswer,
@@ -2563,31 +2532,31 @@ esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
     version = strdup("");
 
     if (version == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
-    if (esxVI_ObjectSpec_Alloc(conn, &objectSpec) < 0) {
+    if (esxVI_ObjectSpec_Alloc(&objectSpec) < 0) {
         goto failure;
     }
 
     objectSpec->obj = task;
     objectSpec->skip = esxVI_Boolean_False;
 
-    if (esxVI_PropertySpec_Alloc(conn, &propertySpec) < 0) {
+    if (esxVI_PropertySpec_Alloc(&propertySpec) < 0) {
         goto failure;
     }
 
     propertySpec->type = task->type;
 
-    if (esxVI_String_AppendValueToList(conn, &propertySpec->pathSet,
+    if (esxVI_String_AppendValueToList(&propertySpec->pathSet,
                                        "info.state") < 0 ||
-        esxVI_PropertyFilterSpec_Alloc(conn, &propertyFilterSpec) < 0 ||
-        esxVI_PropertySpec_AppendToList(conn, &propertyFilterSpec->propSet,
+        esxVI_PropertyFilterSpec_Alloc(&propertyFilterSpec) < 0 ||
+        esxVI_PropertySpec_AppendToList(&propertyFilterSpec->propSet,
                                         propertySpec) < 0 ||
-        esxVI_ObjectSpec_AppendToList(conn, &propertyFilterSpec->objectSet,
+        esxVI_ObjectSpec_AppendToList(&propertyFilterSpec->objectSet,
                                       objectSpec) < 0 ||
-        esxVI_CreateFilter(conn, ctx, propertyFilterSpec, esxVI_Boolean_True,
+        esxVI_CreateFilter(ctx, propertyFilterSpec, esxVI_Boolean_True,
                            &propertyFilter) < 0) {
         goto failure;
     }
@@ -2598,18 +2567,18 @@ esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
 
         if (virtualMachineUuid != NULL) {
             if (esxVI_LookupAndHandleVirtualMachineQuestion
-                  (conn, ctx, virtualMachineUuid, autoAnswer) < 0) {
+                  (ctx, virtualMachineUuid, autoAnswer) < 0) {
                 /*
                  * FIXME: Disable error reporting here, so possible errors from
                  *        esxVI_LookupTaskInfoByTask() and esxVI_CancelTask()
                  *        don't overwrite the actual error
                  */
-                if (esxVI_LookupTaskInfoByTask(conn, ctx, task, &taskInfo)) {
+                if (esxVI_LookupTaskInfoByTask(ctx, task, &taskInfo)) {
                     goto failure;
                 }
 
                 if (taskInfo->cancelable == esxVI_Boolean_True) {
-                    if (esxVI_CancelTask(conn, ctx, task) < 0) {
+                    if (esxVI_CancelTask(ctx, task) < 0) {
                         VIR_ERROR0("Cancelable task is blocked by an "
                                    "unanswered question but cancelation "
                                    "failed");
@@ -2625,7 +2594,7 @@ esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
             }
         }
 
-        if (esxVI_WaitForUpdates(conn, ctx, version, &updateSet) < 0) {
+        if (esxVI_WaitForUpdates(ctx, version, &updateSet) < 0) {
             goto failure;
         }
 
@@ -2633,7 +2602,7 @@ esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
         version = strdup(updateSet->version);
 
         if (version == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
 
@@ -2665,18 +2634,16 @@ esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
             continue;
         }
 
-        if (esxVI_TaskInfoState_CastFromAnyType(conn, propertyValue,
-                                                &state) < 0) {
+        if (esxVI_TaskInfoState_CastFromAnyType(propertyValue, &state) < 0) {
             goto failure;
         }
     }
 
-    if (esxVI_DestroyPropertyFilter(conn, ctx, propertyFilter) < 0) {
+    if (esxVI_DestroyPropertyFilter(ctx, propertyFilter) < 0) {
         VIR_DEBUG0("DestroyPropertyFilter failed");
     }
 
-    if (esxVI_TaskInfoState_CastFromAnyType(conn, propertyValue,
-                                            finalState) < 0) {
+    if (esxVI_TaskInfoState_CastFromAnyType(propertyValue, finalState) < 0) {
         goto failure;
     }
 
index f76689c68d38b064857c3884bb1a8e982a282c03..608dcbda812d511da28a10bbc85b50b41b4ec8ee 100644 (file)
@@ -90,19 +90,18 @@ struct _esxVI_Context {
     esxVI_SelectionSpec *fullTraversalSpecList;
 };
 
-int esxVI_Context_Alloc(virConnectPtr conn, esxVI_Context **ctx);
+int esxVI_Context_Alloc(esxVI_Context **ctx);
 void esxVI_Context_Free(esxVI_Context **ctx);
-int esxVI_Context_Connect(virConnectPtr conn, esxVI_Context *ctx,
-                          const char *ipAddress, const char *url,
-                          const char *username, const char *password,
-                          int noVerify);
-int esxVI_Context_DownloadFile(virConnectPtr conn, esxVI_Context *ctx,
-                               const char *url, char **content);
-int esxVI_Context_UploadFile(virConnectPtr conn, esxVI_Context *ctx,
-                             const char *url, const char *content);
-int esxVI_Context_Execute(virConnectPtr conn, esxVI_Context *ctx,
-                          const char *methodName, const char *request,
-                          esxVI_Response **response, esxVI_Occurrence occurrence);
+int esxVI_Context_Connect(esxVI_Context *ctx, const char *ipAddress,
+                          const char *url, const char *username,
+                          const char *password, int noVerify);
+int esxVI_Context_DownloadFile(esxVI_Context *ctx, const char *url,
+                               char **content);
+int esxVI_Context_UploadFile(esxVI_Context *ctx, const char *url,
+                             const char *content);
+int esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
+                          const char *request, esxVI_Response **response,
+                          esxVI_Occurrence occurrence);
 
 
 
@@ -117,7 +116,7 @@ struct _esxVI_Response {
     xmlNodePtr node;                                  /* optional, list */
 };
 
-int esxVI_Response_Alloc(virConnectPtr conn, esxVI_Response **response);
+int esxVI_Response_Alloc(esxVI_Response **response);
 void esxVI_Response_Free(esxVI_Response **response);
 
 
@@ -136,15 +135,12 @@ struct _esxVI_Enumeration {
     esxVI_EnumerationValue values[10];
 };
 
-int esxVI_Enumeration_CastFromAnyType(virConnectPtr conn,
-                                      const esxVI_Enumeration *enumeration,
+int esxVI_Enumeration_CastFromAnyType(const esxVI_Enumeration *enumeration,
                                       esxVI_AnyType *anyType, int *value);
-int esxVI_Enumeration_Serialize(virConnectPtr conn,
-                                const esxVI_Enumeration *enumeration,
+int esxVI_Enumeration_Serialize(const esxVI_Enumeration *enumeration,
                                 int value, const char *element,
                                 virBufferPtr output, esxVI_Boolean required);
-int esxVI_Enumeration_Deserialize(virConnectPtr conn,
-                                  const esxVI_Enumeration *enumeration,
+int esxVI_Enumeration_Deserialize(const esxVI_Enumeration *enumeration,
                                   xmlNodePtr node, int *value);
 
 
@@ -158,33 +154,25 @@ struct _esxVI_List {
 };
 
 typedef int (*esxVI_List_FreeFunc) (esxVI_List **item);
-typedef int (*esxVI_List_DeepCopyFunc) (virConnectPtr conn, esxVI_List **dest,
-                                        esxVI_List *src);
-typedef int (*esxVI_List_CastFromAnyTypeFunc) (virConnectPtr conn,
-                                               esxVI_AnyType *anyType,
+typedef int (*esxVI_List_DeepCopyFunc) (esxVI_List **dest, esxVI_List *src);
+typedef int (*esxVI_List_CastFromAnyTypeFunc) (esxVI_AnyType *anyType,
                                                esxVI_List **item);
-typedef int (*esxVI_List_SerializeFunc) (virConnectPtr conn, esxVI_List *item,
-                                         const char *element,
+typedef int (*esxVI_List_SerializeFunc) (esxVI_List *item, const char *element,
                                          virBufferPtr output,
                                          esxVI_Boolean required);
-typedef int (*esxVI_List_DeserializeFunc) (virConnectPtr conn, xmlNodePtr node,
-                                           esxVI_List **item);
+typedef int (*esxVI_List_DeserializeFunc) (xmlNodePtr node, esxVI_List **item);
 
-int esxVI_List_Append(virConnectPtr conn, esxVI_List **list, esxVI_List *item);
-int esxVI_List_DeepCopy(virConnectPtr conn, esxVI_List **destList,
-                        esxVI_List *srcList,
+int esxVI_List_Append(esxVI_List **list, esxVI_List *item);
+int esxVI_List_DeepCopy(esxVI_List **destList, esxVI_List *srcList,
                         esxVI_List_DeepCopyFunc deepCopyFunc,
                         esxVI_List_FreeFunc freeFunc);
-int esxVI_List_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
-                               esxVI_List **list,
+int esxVI_List_CastFromAnyType(esxVI_AnyType *anyType, esxVI_List **list,
                                esxVI_List_CastFromAnyTypeFunc castFromAnyTypeFunc,
                                esxVI_List_FreeFunc freeFunc);
-int esxVI_List_Serialize(virConnectPtr conn, esxVI_List *list,
-                         const char *element, virBufferPtr output,
-                         esxVI_Boolean required,
+int esxVI_List_Serialize(esxVI_List *list, const char *element,
+                         virBufferPtr output, esxVI_Boolean required,
                          esxVI_List_SerializeFunc serializeFunc);
-int esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                           esxVI_List **list,
+int esxVI_List_Deserialize(xmlNodePtr node, esxVI_List **list,
                            esxVI_List_DeserializeFunc deserializeFunc,
                            esxVI_List_FreeFunc freeFunc);
 
@@ -198,22 +186,21 @@ int esxVI_List_Deserialize(virConnectPtr conn, xmlNodePtr node,
  *  - 'get' functions get information from a local object
  */
 
-int esxVI_Alloc(virConnectPtr conn, void **ptrptr, size_t size);
+int esxVI_Alloc(void **ptrptr, size_t size);
 
-int esxVI_CheckSerializationNecessity(virConnectPtr conn, const char *element,
+int esxVI_CheckSerializationNecessity(const char *element,
                                       esxVI_Boolean required);
 
 int esxVI_BuildFullTraversalSpecItem
-      (virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList,
-       const char *name, const char *type, const char *path,
-       const char *selectSetNames);
+      (esxVI_SelectionSpec **fullTraversalSpecList, const char *name,
+       const char *type, const char *path, const char *selectSetNames);
 
 int esxVI_BuildFullTraversalSpecList
-      (virConnectPtr conn, esxVI_SelectionSpec **fullTraversalSpecList);
+      (esxVI_SelectionSpec **fullTraversalSpecList);
 
-int esxVI_EnsureSession(virConnectPtr conn, esxVI_Context *ctx);
+int esxVI_EnsureSession(esxVI_Context *ctx);
 
-int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_LookupObjectContentByType(esxVI_Context *ctx,
                                     esxVI_ManagedObjectReference *root,
                                     const char *type,
                                     esxVI_String *propertyNameList,
@@ -221,86 +208,80 @@ int esxVI_LookupObjectContentByType(virConnectPtr conn, esxVI_Context *ctx,
                                     esxVI_ObjectContent **objectContentList);
 
 int esxVI_GetManagedEntityStatus
-      (virConnectPtr conn, esxVI_ObjectContent *objectContent,
-       const char *propertyName,
+      (esxVI_ObjectContent *objectContent, const char *propertyName,
        esxVI_ManagedEntityStatus *managedEntityStatus);
 
 int esxVI_GetVirtualMachinePowerState
-      (virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
+      (esxVI_ObjectContent *virtualMachine,
        esxVI_VirtualMachinePowerState *powerState);
 
 int esxVI_GetVirtualMachineQuestionInfo
-      (virConnectPtr conn, esxVI_ObjectContent *virtualMachine,
+      (esxVI_ObjectContent *virtualMachine,
        esxVI_VirtualMachineQuestionInfo **questionInfo);
 
 int esxVI_LookupNumberOfDomainsByPowerState
-      (virConnectPtr conn, esxVI_Context *ctx,
-       esxVI_VirtualMachinePowerState powerState, esxVI_Boolean inverse);
+      (esxVI_Context *ctx, esxVI_VirtualMachinePowerState powerState,
+       esxVI_Boolean inverse);
 
-int esxVI_GetVirtualMachineIdentity(virConnectPtr conn,
-                                    esxVI_ObjectContent *virtualMachine,
+int esxVI_GetVirtualMachineIdentity(esxVI_ObjectContent *virtualMachine,
                                     int *id, char **name, unsigned char *uuid);
 
 int esxVI_LookupResourcePoolByHostSystem
-      (virConnectPtr conn, esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
+      (esxVI_Context *ctx, esxVI_ObjectContent *hostSystem,
        esxVI_ManagedObjectReference **resourcePool);
 
-int esxVI_LookupHostSystemByIp(virConnectPtr conn, esxVI_Context *ctx,
-                               const char *ipAddress,
+int esxVI_LookupHostSystemByIp(esxVI_Context *ctx, const char *ipAddress,
                                esxVI_String *propertyNameList,
                                esxVI_ObjectContent **hostSystem);
 
-int esxVI_LookupVirtualMachineByUuid(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_LookupVirtualMachineByUuid(esxVI_Context *ctx,
                                      const unsigned char *uuid,
                                      esxVI_String *propertyNameList,
                                      esxVI_ObjectContent **virtualMachine,
                                      esxVI_Occurrence occurrence);
 
 int esxVI_LookupVirtualMachineByUuidAndPrepareForTask
-      (virConnectPtr conn, esxVI_Context *ctx, const unsigned char *uuid,
+      (esxVI_Context *ctx, const unsigned char *uuid,
        esxVI_String *propertyNameList, esxVI_ObjectContent **virtualMachine,
        esxVI_Boolean autoAnswer);
 
-int esxVI_LookupDatastoreByName(virConnectPtr conn, esxVI_Context *ctx,
-                                const char *name,
+int esxVI_LookupDatastoreByName(esxVI_Context *ctx, const char *name,
                                 esxVI_String *propertyNameList,
                                 esxVI_ObjectContent **datastore,
                                 esxVI_Occurrence occurrence);
 
-int esxVI_LookupTaskInfoByTask(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_LookupTaskInfoByTask(esxVI_Context *ctx,
                                esxVI_ManagedObjectReference *task,
                                esxVI_TaskInfo **taskInfo);
 
 int esxVI_LookupPendingTaskInfoListByVirtualMachine
-      (virConnectPtr conn, esxVI_Context *ctx,
-       esxVI_ObjectContent *virtualMachine,
+      (esxVI_Context *ctx, esxVI_ObjectContent *virtualMachine,
        esxVI_TaskInfo **pendingTaskInfoList);
 
-int esxVI_LookupAndHandleVirtualMachineQuestion(virConnectPtr conn,
-                                                esxVI_Context *ctx,
+int esxVI_LookupAndHandleVirtualMachineQuestion(esxVI_Context *ctx,
                                                 const unsigned char *uuid,
                                                 esxVI_Boolean autoAnswer);
 
-int esxVI_StartVirtualMachineTask(virConnectPtr conn, esxVI_Context *ctx,
-                                  const char *name, const char *request,
+int esxVI_StartVirtualMachineTask(esxVI_Context *ctx, const char *name,
+                                  const char *request,
                                   esxVI_ManagedObjectReference **task);
 
 int esxVI_StartSimpleVirtualMachineTask
-      (virConnectPtr conn, esxVI_Context *ctx, const char *name,
+      (esxVI_Context *ctx, const char *name,
        esxVI_ManagedObjectReference *virtualMachine,
        esxVI_ManagedObjectReference **task);
 
 int esxVI_SimpleVirtualMachineMethod
-      (virConnectPtr conn, esxVI_Context *ctx, const char *name,
+      (esxVI_Context *ctx, const char *name,
        esxVI_ManagedObjectReference *virtualMachine);
 
 int esxVI_HandleVirtualMachineQuestion
-      (virConnectPtr conn, esxVI_Context *ctx,
+      (esxVI_Context *ctx,
        esxVI_ManagedObjectReference *virtualMachine,
        esxVI_VirtualMachineQuestionInfo *questionInfo,
        esxVI_Boolean autoAnswer);
 
-int esxVI_WaitForTaskCompletion(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_WaitForTaskCompletion(esxVI_Context *ctx,
                                 esxVI_ManagedObjectReference *task,
                                 const unsigned char *virtualMachineUuid,
                                 esxVI_Boolean autoAnswer,
index 7925f260e9f5e67deee15523da930ca1a4ebfdf1..9a1d002112c71c92623e5d3982ae571b1912cafa 100644 (file)
@@ -32,8 +32,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_VI_ERROR(conn, code, fmt...)                                      \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__,  __FUNCTION__,   \
+#define ESX_VI_ERROR(code, fmt...)                                            \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__,  __FUNCTION__,   \
                          __LINE__, fmt)
 
 #define ESX_VI__SOAP__REQUEST_HEADER                                          \
@@ -56,7 +56,7 @@
  */
 
 int
-esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RetrieveServiceContent(esxVI_Context *ctx,
                              esxVI_ServiceContent **serviceContent)
 {
     int result = 0;
@@ -72,14 +72,13 @@ esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (serviceContent == NULL || *serviceContent != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_Context_Execute(conn, ctx, "RetrieveServiceContent", request,
+    if (esxVI_Context_Execute(ctx, "RetrieveServiceContent", request,
                               &response, esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_ServiceContent_Deserialize(conn, response->node,
-                                         serviceContent) < 0) {
+        esxVI_ServiceContent_Deserialize(response->node, serviceContent) < 0) {
         goto failure;
     }
 
@@ -97,8 +96,7 @@ esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
-            const char *userName, const char *password,
+esxVI_Login(esxVI_Context *ctx, const char *userName, const char *password,
             esxVI_UserSession **userSession)
 {
     int result = 0;
@@ -107,25 +105,24 @@ esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (userSession == NULL || *userSession != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<Login xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->sessionManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, userName, "userName", &buffer,
+        esxVI_String_SerializeValue(userName, "userName", &buffer,
                                     esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, password, "password", &buffer,
+        esxVI_String_SerializeValue(password, "password", &buffer,
                                     esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -134,15 +131,15 @@ esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "Login", request, &response,
+    if (esxVI_Context_Execute(ctx, "Login", request, &response,
                               esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_UserSession_Deserialize(conn, response->node, userSession) < 0) {
+        esxVI_UserSession_Deserialize(response->node, userSession) < 0) {
         goto failure;
     }
 
@@ -163,7 +160,7 @@ esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx)
+esxVI_Logout(esxVI_Context *ctx)
 {
     int result = 0;
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -171,15 +168,14 @@ esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx)
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<Logout xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->sessionManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
@@ -189,13 +185,13 @@ esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx)
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "Logout", request, &response,
+    if (esxVI_Context_Execute(ctx, "Logout", request, &response,
                               esxVI_Occurrence_None) < 0) {
         goto failure;
     }
@@ -217,9 +213,8 @@ esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx)
 
 
 int
-esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
-                      const char *sessionID, const char *userName,
-                      esxVI_Boolean *active)
+esxVI_SessionIsActive(esxVI_Context *ctx, const char *sessionID,
+                      const char *userName, esxVI_Boolean *active)
 {
     int result = 0;
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -227,25 +222,24 @@ esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (active == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<SessionIsActive xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->sessionManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->sessionManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, sessionID, "sessionID", &buffer,
+        esxVI_String_SerializeValue(sessionID, "sessionID", &buffer,
                                     esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, userName, "userName", &buffer,
+        esxVI_String_SerializeValue(userName, "userName", &buffer,
                                     esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -254,15 +248,15 @@ esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "SessionIsActive", request,
-                              &response, esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_Boolean_Deserialize(conn, response->node, active) < 0) {
+    if (esxVI_Context_Execute(ctx, "SessionIsActive", request, &response,
+                              esxVI_Occurrence_RequiredItem) < 0 ||
+        esxVI_Boolean_Deserialize(response->node, active) < 0) {
         goto failure;
     }
 
@@ -283,7 +277,7 @@ esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RetrieveProperties(esxVI_Context *ctx,
                          esxVI_PropertyFilterSpec *propertyFilterSpecList,
                          esxVI_ObjectContent **objectContentList)
 {
@@ -293,23 +287,22 @@ esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (objectContentList == NULL || *objectContentList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<RetrieveProperties xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->propertyCollector,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_PropertyFilterSpec_SerializeList(conn, propertyFilterSpecList,
+        esxVI_PropertyFilterSpec_SerializeList(propertyFilterSpecList,
                                                "specSet", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
@@ -319,15 +312,15 @@ esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "RetrieveProperties", request,
-                              &response, esxVI_Occurrence_List) < 0 ||
-        esxVI_ObjectContent_DeserializeList(conn, response->node,
+    if (esxVI_Context_Execute(ctx, "RetrieveProperties", request, &response,
+                              esxVI_Occurrence_List) < 0 ||
+        esxVI_ObjectContent_DeserializeList(response->node,
                                             objectContentList) < 0) {
         goto failure;
     }
@@ -349,40 +342,40 @@ esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_PowerOnVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_PowerOnVM_Task(esxVI_Context *ctx,
                      esxVI_ManagedObjectReference *virtualMachine,
                      esxVI_ManagedObjectReference **task)
 {
-    return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "PowerOnVM",
+    return esxVI_StartSimpleVirtualMachineTask(ctx, "PowerOnVM",
                                                virtualMachine, task);
 }
 
 
 
 int
-esxVI_PowerOffVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_PowerOffVM_Task(esxVI_Context *ctx,
                       esxVI_ManagedObjectReference *virtualMachine,
                       esxVI_ManagedObjectReference **task)
 {
-    return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "PowerOffVM",
+    return esxVI_StartSimpleVirtualMachineTask(ctx, "PowerOffVM",
                                                virtualMachine, task);
 }
 
 
 
 int
-esxVI_SuspendVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_SuspendVM_Task(esxVI_Context *ctx,
                      esxVI_ManagedObjectReference *virtualMachine,
                      esxVI_ManagedObjectReference **task)
 {
-    return esxVI_StartSimpleVirtualMachineTask(conn, ctx, "SuspendVM",
+    return esxVI_StartSimpleVirtualMachineTask(ctx, "SuspendVM",
                                                virtualMachine, task);
 }
 
 
 
 int
-esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_MigrateVM_Task(esxVI_Context *ctx,
                      esxVI_ManagedObjectReference *virtualMachine,
                      esxVI_ManagedObjectReference *resourcePool,
                      esxVI_ManagedObjectReference *hostSystem,
@@ -393,25 +386,22 @@ esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     char *request = NULL;
 
     if (task == NULL || *task != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<MigrateVM_Task xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
                                                esxVI_Boolean_True) < 0 ||
         esxVI_VirtualMachineMovePriority_Serialize
-          (conn, esxVI_VirtualMachineMovePriority_DefaultPriority,
-           "priority", &buffer, esxVI_Boolean_True) < 0) {
+          (esxVI_VirtualMachineMovePriority_DefaultPriority, "priority",
+           &buffer, esxVI_Boolean_True) < 0) {
         goto failure;
     }
 
@@ -419,14 +409,13 @@ esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_StartVirtualMachineTask(conn, ctx, "MigrateVM", request,
-                                      task) < 0) {
+    if (esxVI_StartVirtualMachineTask(ctx, "MigrateVM", request, task) < 0) {
         goto failure;
     }
 
@@ -446,7 +435,7 @@ esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ReconfigVM_Task(esxVI_Context *ctx,
                       esxVI_ManagedObjectReference *virtualMachine,
                       esxVI_VirtualMachineConfigSpec *spec,
                       esxVI_ManagedObjectReference **task)
@@ -456,17 +445,16 @@ esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     char *request = NULL;
 
     if (task == NULL || *task != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<ReconfigVM_Task xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_VirtualMachineConfigSpec_Serialize(conn, spec, "spec", &buffer,
+        esxVI_VirtualMachineConfigSpec_Serialize(spec, "spec", &buffer,
                                                  esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -475,14 +463,13 @@ esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_StartVirtualMachineTask(conn, ctx, "ReconfigVM", request,
-                                      task) < 0) {
+    if (esxVI_StartVirtualMachineTask(ctx, "ReconfigVM", request, task) < 0) {
         goto failure;
     }
 
@@ -502,7 +489,7 @@ esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RegisterVM_Task(esxVI_Context *ctx,
                       esxVI_ManagedObjectReference *folder,
                       const char *path, const char *name,
                       esxVI_Boolean asTemplate,
@@ -515,26 +502,24 @@ esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     char *request = NULL;
 
     if (task == NULL || *task != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<RegisterVM_Task xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, folder, "_this", &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(folder, "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, path, "path", &buffer,
+        esxVI_String_SerializeValue(path, "path", &buffer,
                                     esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, name, "name", &buffer,
+        esxVI_String_SerializeValue(name, "name", &buffer,
                                     esxVI_Boolean_False) < 0 ||
-        esxVI_Boolean_Serialize(conn, asTemplate, "asTemplate", &buffer,
+        esxVI_Boolean_Serialize(asTemplate, "asTemplate", &buffer,
                                 esxVI_Boolean_False) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
                                                esxVI_Boolean_False) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
                                                esxVI_Boolean_False) < 0) {
         goto failure;
     }
@@ -543,14 +528,13 @@ esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_StartVirtualMachineTask(conn, ctx, "RegisterVM", request,
-                                      task) < 0) {
+    if (esxVI_StartVirtualMachineTask(ctx, "RegisterVM", request, task) < 0) {
         goto failure;
     }
 
@@ -570,8 +554,7 @@ esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
-                 esxVI_ManagedObjectReference *task)
+esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task)
 {
     int result = 0;
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -579,14 +562,14 @@ esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<CancelTask xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, task, "_this", &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(task, "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -595,13 +578,13 @@ esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "CancelTask", request, &response,
+    if (esxVI_Context_Execute(ctx, "CancelTask", request, &response,
                               esxVI_Occurrence_None) < 0) {
         goto failure;
     }
@@ -625,7 +608,7 @@ esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_UnregisterVM(esxVI_Context *ctx,
                    esxVI_ManagedObjectReference *virtualMachine)
 {
     int result = 0;
@@ -636,8 +619,7 @@ esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<UnregisterVM xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -646,13 +628,13 @@ esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "UnregisterVM", request, &response,
+    if (esxVI_Context_Execute(ctx, "UnregisterVM", request, &response,
                               esxVI_Occurrence_None) < 0) {
         goto failure;
     }
@@ -674,7 +656,7 @@ esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_AnswerVM(esxVI_Context *ctx,
                esxVI_ManagedObjectReference *virtualMachine,
                const char *questionId, const char *answerChoice)
 {
@@ -686,13 +668,12 @@ esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<AnswerVM xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, virtualMachine, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(virtualMachine, "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, questionId, "questionId",
-                                    &buffer, esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, answerChoice, "answerChoice",
-                                    &buffer, esxVI_Boolean_True) < 0) {
+        esxVI_String_SerializeValue(questionId, "questionId", &buffer,
+                                    esxVI_Boolean_True) < 0 ||
+        esxVI_String_SerializeValue(answerChoice, "answerChoice", &buffer,
+                                    esxVI_Boolean_True) < 0) {
         goto failure;
     }
 
@@ -700,13 +681,13 @@ esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, request, NULL, &response,
+    if (esxVI_Context_Execute(ctx, request, NULL, &response,
                               esxVI_Boolean_False) < 0) {
         goto failure;
     }
@@ -730,7 +711,7 @@ esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_CreateFilter(esxVI_Context *ctx,
                    esxVI_PropertyFilterSpec *propertyFilterSpec,
                    esxVI_Boolean partialUpdates,
                    esxVI_ManagedObjectReference **propertyFilter)
@@ -741,26 +722,25 @@ esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (propertyFilter == NULL || *propertyFilter != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<CreateFilter xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->propertyCollector,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_PropertyFilterSpec_Serialize(conn, propertyFilterSpec, "spec",
-                                           &buffer, esxVI_Boolean_True) < 0 ||
-        esxVI_Boolean_Serialize(conn, partialUpdates, "partialUpdates",
-                                &buffer, esxVI_Boolean_True) < 0) {
+        esxVI_PropertyFilterSpec_Serialize(propertyFilterSpec, "spec", &buffer,
+                                           esxVI_Boolean_True) < 0 ||
+        esxVI_Boolean_Serialize(partialUpdates, "partialUpdates", &buffer,
+                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
 
@@ -768,16 +748,15 @@ esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "CreateFilter", request, &response,
+    if (esxVI_Context_Execute(ctx, "CreateFilter", request, &response,
                               esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_ManagedObjectReference_Deserialize(conn, response->node,
-                                                 propertyFilter,
+        esxVI_ManagedObjectReference_Deserialize(response->node, propertyFilter,
                                                  "PropertyFilter") < 0) {
         goto failure;
     }
@@ -799,7 +778,7 @@ esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_DestroyPropertyFilter(esxVI_Context *ctx,
                             esxVI_ManagedObjectReference *propertyFilter)
 {
     int result = 0;
@@ -808,15 +787,14 @@ esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<DestroyPropertyFilter xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, propertyFilter, "_this",
-                                               &buffer,
+    if (esxVI_ManagedObjectReference_Serialize(propertyFilter, "_this", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -825,13 +803,13 @@ esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "DestroyPropertyFilter", request,
+    if (esxVI_Context_Execute(ctx, "DestroyPropertyFilter", request,
                               &response, esxVI_Occurrence_None) < 0) {
         goto failure;
     }
@@ -853,8 +831,8 @@ esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
-                     const char *version, esxVI_UpdateSet **updateSet)
+esxVI_WaitForUpdates(esxVI_Context *ctx, const char *version,
+                     esxVI_UpdateSet **updateSet)
 {
     int result = 0;
     virBuffer buffer = VIR_BUFFER_INITIALIZER;
@@ -862,23 +840,22 @@ esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (updateSet == NULL || *updateSet != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<WaitForUpdates xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn,
-                                               ctx->service->propertyCollector,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->propertyCollector,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_String_SerializeValue(conn, version, "version", &buffer,
+        esxVI_String_SerializeValue(version, "version", &buffer,
                                     esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -887,15 +864,15 @@ esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "WaitForUpdates", request,
+    if (esxVI_Context_Execute(ctx, "WaitForUpdates", request,
                               &response, esxVI_Occurrence_RequiredItem) < 0 ||
-        esxVI_UpdateSet_Deserialize(conn, response->node, updateSet) < 0) {
+        esxVI_UpdateSet_Deserialize(response->node, updateSet) < 0) {
         goto failure;
     }
 
@@ -916,27 +893,26 @@ esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_RebootGuest(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_RebootGuest(esxVI_Context *ctx,
                   esxVI_ManagedObjectReference *virtualMachine)
 {
-    return esxVI_SimpleVirtualMachineMethod(conn, ctx, "RebootGuest",
-                                            virtualMachine);
+    return esxVI_SimpleVirtualMachineMethod(ctx, "RebootGuest", virtualMachine);
 }
 
 
 
 int
-esxVI_ShutdownGuest(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ShutdownGuest(esxVI_Context *ctx,
                     esxVI_ManagedObjectReference *virtualMachine)
 {
-    return esxVI_SimpleVirtualMachineMethod(conn, ctx, "ShutdownGuest",
+    return esxVI_SimpleVirtualMachineMethod(ctx, "ShutdownGuest",
                                             virtualMachine);
 }
 
 
 
 int
-esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_ValidateMigration(esxVI_Context *ctx,
                         esxVI_ManagedObjectReference *virtualMachineList,
                         esxVI_VirtualMachinePowerState powerState,
                         esxVI_String *testTypeList,
@@ -950,12 +926,12 @@ esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (eventList == NULL || *eventList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -967,19 +943,16 @@ esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
                                "ServiceInstance"
                              "</_this>");
 
-    if (esxVI_ManagedObjectReference_SerializeList(conn, virtualMachineList,
-                                                   "vm", &buffer,
+    if (esxVI_ManagedObjectReference_SerializeList(virtualMachineList, "vm",
+                                                   &buffer,
                                                    esxVI_Boolean_True) < 0 ||
-        esxVI_VirtualMachinePowerState_Serialize(conn, powerState, "state",
-                                                 &buffer,
+        esxVI_VirtualMachinePowerState_Serialize(powerState, "state", &buffer,
                                                  esxVI_Boolean_False) < 0 ||
-        esxVI_String_SerializeList(conn, testTypeList, "testType", &buffer,
+        esxVI_String_SerializeList(testTypeList, "testType", &buffer,
                                    esxVI_Boolean_False) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, resourcePool, "pool",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(resourcePool, "pool", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, hostSystem, "host",
-                                               &buffer,
+        esxVI_ManagedObjectReference_Serialize(hostSystem, "host", &buffer,
                                                esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -988,15 +961,15 @@ esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "ValidateMigration", request,
-                              &response, esxVI_Occurrence_List) < 0 ||
-        esxVI_Event_DeserializeList(conn, response->node, eventList) < 0) {
+    if (esxVI_Context_Execute(ctx, "ValidateMigration", request, &response,
+                              esxVI_Occurrence_List) < 0 ||
+        esxVI_Event_DeserializeList(response->node, eventList) < 0) {
         goto failure;
     }
 
@@ -1017,7 +990,7 @@ esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_FindByIp(esxVI_Context *ctx,
                  esxVI_ManagedObjectReference *datacenter,
                  const char *ip, esxVI_Boolean vmSearch,
                  esxVI_ManagedObjectReference **managedObjectReference)
@@ -1028,27 +1001,27 @@ esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (managedObjectReference == NULL || *managedObjectReference != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<FindByIp xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->searchIndex,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->searchIndex,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, datacenter,
-                                               "datacenter", &buffer,
+        esxVI_ManagedObjectReference_Serialize(datacenter, "datacenter",
+                                               &buffer,
                                                esxVI_Boolean_False) < 0 ||
-        esxVI_String_SerializeValue(conn, ip, "ip", &buffer,
+        esxVI_String_SerializeValue(ip, "ip", &buffer,
                                     esxVI_Boolean_True) < 0 ||
-        esxVI_Boolean_Serialize(conn, vmSearch, "vmSearch", &buffer,
+        esxVI_Boolean_Serialize(vmSearch, "vmSearch", &buffer,
                                 esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -1057,16 +1030,16 @@ esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "FindByIp", request, &response,
+    if (esxVI_Context_Execute(ctx, "FindByIp", request, &response,
                               esxVI_Occurrence_OptionalItem) < 0 ||
         esxVI_ManagedObjectReference_Deserialize
-          (conn, response->node, managedObjectReference,
+          (response->node, managedObjectReference,
            vmSearch == esxVI_Boolean_True ? "VirtualMachine"
                                           : "HostSystem") < 0) {
         goto failure;
@@ -1089,7 +1062,7 @@ esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_FindByUuid(esxVI_Context *ctx,
                  esxVI_ManagedObjectReference *datacenter,
                  const unsigned char *uuid, esxVI_Boolean vmSearch,
                  esxVI_ManagedObjectReference **managedObjectReference)
@@ -1101,12 +1074,12 @@ esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (managedObjectReference == NULL || *managedObjectReference != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1115,15 +1088,15 @@ esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<FindByUuid xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->searchIndex,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->searchIndex,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, datacenter,
-                                               "datacenter", &buffer,
+        esxVI_ManagedObjectReference_Serialize(datacenter, "datacenter",
+                                               &buffer,
                                                esxVI_Boolean_False) < 0 ||
-        esxVI_String_SerializeValue(conn, uuid_string, "uuid", &buffer,
+        esxVI_String_SerializeValue(uuid_string, "uuid", &buffer,
                                     esxVI_Boolean_True) < 0 ||
-        esxVI_Boolean_Serialize(conn, vmSearch, "vmSearch", &buffer,
+        esxVI_Boolean_Serialize(vmSearch, "vmSearch", &buffer,
                                 esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -1132,13 +1105,13 @@ esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "FindByUuid", request, &response,
+    if (esxVI_Context_Execute(ctx, "FindByUuid", request, &response,
                               esxVI_Occurrence_OptionalItem) < 0) {
         goto failure;
     }
@@ -1148,7 +1121,7 @@ esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
     }
 
     if (esxVI_ManagedObjectReference_Deserialize
-          (conn, response->node, managedObjectReference,
+          (response->node, managedObjectReference,
            vmSearch == esxVI_Boolean_True ? "VirtualMachine"
                                           : "HostSystem") < 0) {
         goto failure;
@@ -1171,7 +1144,7 @@ esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
+esxVI_QueryAvailablePerfMetric(esxVI_Context *ctx,
                                esxVI_ManagedObjectReference *entity,
                                esxVI_DateTime *beginTime,
                                esxVI_DateTime *endTime, esxVI_Int *intervalId,
@@ -1183,29 +1156,28 @@ esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (perfMetricIdList == NULL || *perfMetricIdList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<QueryAvailablePerfMetric xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_ManagedObjectReference_Serialize(conn, entity,
-                                               "entity", &buffer,
+        esxVI_ManagedObjectReference_Serialize(entity, "entity", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_DateTime_Serialize(conn, beginTime, "beginTime", &buffer,
+        esxVI_DateTime_Serialize(beginTime, "beginTime", &buffer,
                                  esxVI_Boolean_False) < 0 ||
-        esxVI_DateTime_Serialize(conn, endTime, "endTime", &buffer,
+        esxVI_DateTime_Serialize(endTime, "endTime", &buffer,
                                  esxVI_Boolean_False) < 0 ||
-        esxVI_Int_Serialize(conn, intervalId, "intervalId", &buffer,
+        esxVI_Int_Serialize(intervalId, "intervalId", &buffer,
                             esxVI_Boolean_False) < 0) {
         goto failure;
     }
@@ -1214,15 +1186,15 @@ esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "QueryAvailablePerfMetric", request,
+    if (esxVI_Context_Execute(ctx, "QueryAvailablePerfMetric", request,
                               &response, esxVI_Occurrence_List) < 0 ||
-        esxVI_PerfMetricId_DeserializeList(conn, response->node,
+        esxVI_PerfMetricId_DeserializeList(response->node,
                                            perfMetricIdList) < 0) {
         goto failure;
     }
@@ -1244,8 +1216,7 @@ esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
-                       esxVI_Int *counterIdList,
+esxVI_QueryPerfCounter(esxVI_Context *ctx, esxVI_Int *counterIdList,
                        esxVI_PerfCounterInfo **perfCounterInfoList)
 {
     int result = 0;
@@ -1254,22 +1225,22 @@ esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (perfCounterInfoList == NULL || *perfCounterInfoList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<QueryPerfCounter xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_Int_SerializeList(conn, counterIdList, "counterId", &buffer,
+        esxVI_Int_SerializeList(counterIdList, "counterId", &buffer,
                                 esxVI_Boolean_True) < 0) {
         goto failure;
     }
@@ -1278,15 +1249,15 @@ esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "QueryPerfCounter", request,
-                              &response, esxVI_Occurrence_List) < 0 ||
-        esxVI_PerfCounterInfo_DeserializeList(conn, response->node,
+    if (esxVI_Context_Execute(ctx, "QueryPerfCounter", request, &response,
+                              esxVI_Occurrence_List) < 0 ||
+        esxVI_PerfCounterInfo_DeserializeList(response->node,
                                               perfCounterInfoList) < 0) {
         goto failure;
     }
@@ -1308,8 +1279,7 @@ esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
-                esxVI_PerfQuerySpec *querySpecList,
+esxVI_QueryPerf(esxVI_Context *ctx, esxVI_PerfQuerySpec *querySpecList,
                 esxVI_PerfEntityMetric **perfEntityMetricList)
 {
     int result = 0;
@@ -1318,23 +1288,23 @@ esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
     esxVI_Response *response = NULL;
 
     if (ctx->service == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid call");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid call");
         return -1;
     }
 
     if (perfEntityMetricList == NULL || *perfEntityMetricList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_HEADER);
     virBufferAddLit(&buffer, "<QueryPerf xmlns=\"urn:vim25\">");
 
-    if (esxVI_ManagedObjectReference_Serialize(conn, ctx->service->perfManager,
+    if (esxVI_ManagedObjectReference_Serialize(ctx->service->perfManager,
                                                "_this", &buffer,
                                                esxVI_Boolean_True) < 0 ||
-        esxVI_PerfQuerySpec_SerializeList(conn, querySpecList, "querySpec",
-                                          &buffer, esxVI_Boolean_True) < 0) {
+        esxVI_PerfQuerySpec_SerializeList(querySpecList, "querySpec", &buffer,
+                                          esxVI_Boolean_True) < 0) {
         goto failure;
     }
 
@@ -1342,15 +1312,15 @@ esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
     virBufferAddLit(&buffer, ESX_VI__SOAP__REQUEST_FOOTER);
 
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     request = virBufferContentAndReset(&buffer);
 
-    if (esxVI_Context_Execute(conn, ctx, "QueryPerf", request, &response,
+    if (esxVI_Context_Execute(ctx, "QueryPerf", request, &response,
                               esxVI_Occurrence_List) < 0 ||
-        esxVI_PerfEntityMetric_DeserializeList(conn, response->node,
+        esxVI_PerfEntityMetric_DeserializeList(response->node,
                                                perfEntityMetricList) < 0) {
         goto failure;
     }
index 03e4fdf3e533853184c06fc38f721347c27076c5..f84753db649442e9be0c6cae43b4183a6f88c6bb 100644 (file)
  * VI Methods
  */
 
-int esxVI_RetrieveServiceContent(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_RetrieveServiceContent(esxVI_Context *ctx,
                                  esxVI_ServiceContent **serviceContent);
 
-int esxVI_Login(virConnectPtr conn, esxVI_Context *ctx,
-                const char *userName, const char *password,
+int esxVI_Login(esxVI_Context *ctx, const char *userName, const char *password,
                 esxVI_UserSession **userSession);
 
-int esxVI_Logout(virConnectPtr conn, esxVI_Context *ctx);
+int esxVI_Logout(esxVI_Context *ctx);
 
-int esxVI_SessionIsActive(virConnectPtr conn, esxVI_Context *ctx,
-                          const char *sessionID, const char *userName,
-                          esxVI_Boolean *active);
+int esxVI_SessionIsActive(esxVI_Context *ctx, const char *sessionID,
+                          const char *userName, esxVI_Boolean *active);
 
-int esxVI_RetrieveProperties(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_RetrieveProperties(esxVI_Context *ctx,
                              esxVI_PropertyFilterSpec *propertyFilterSpecList,
                              esxVI_ObjectContent **objectContentList);
 
-int esxVI_PowerOnVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_PowerOnVM_Task(esxVI_Context *ctx,
                          esxVI_ManagedObjectReference *virtualMachine,
                          esxVI_ManagedObjectReference **task);
 
-int esxVI_PowerOffVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_PowerOffVM_Task(esxVI_Context *ctx,
                           esxVI_ManagedObjectReference *virtualMachine,
                           esxVI_ManagedObjectReference **task);
 
-int esxVI_SuspendVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_SuspendVM_Task(esxVI_Context *ctx,
                          esxVI_ManagedObjectReference *virtualMachine,
                          esxVI_ManagedObjectReference **task);
 
-int esxVI_MigrateVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_MigrateVM_Task(esxVI_Context *ctx,
                          esxVI_ManagedObjectReference *virtualMachine,
                          esxVI_ManagedObjectReference *resourcePool,
                          esxVI_ManagedObjectReference *hostSystem,
                          esxVI_ManagedObjectReference **task);
 
-int esxVI_ReconfigVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_ReconfigVM_Task(esxVI_Context *ctx,
                           esxVI_ManagedObjectReference *virtualMachine,
                           esxVI_VirtualMachineConfigSpec *spec,
                           esxVI_ManagedObjectReference **task);
 
-int esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_RegisterVM_Task(esxVI_Context *ctx,
                           esxVI_ManagedObjectReference *folder,
                           const char *path, const char *name,
                           esxVI_Boolean asTemplate,
@@ -80,34 +78,33 @@ int esxVI_RegisterVM_Task(virConnectPtr conn, esxVI_Context *ctx,
                           esxVI_ManagedObjectReference *hostSystem,
                           esxVI_ManagedObjectReference **task);
 
-int esxVI_CancelTask(virConnectPtr conn, esxVI_Context *ctx,
-                     esxVI_ManagedObjectReference *task);
+int esxVI_CancelTask(esxVI_Context *ctx, esxVI_ManagedObjectReference *task);
 
-int esxVI_UnregisterVM(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_UnregisterVM(esxVI_Context *ctx,
                        esxVI_ManagedObjectReference *virtualMachine);
 
-int esxVI_AnswerVM(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_AnswerVM(esxVI_Context *ctx,
                    esxVI_ManagedObjectReference *virtualMachine,
                    const char *questionId, const char *answerChoice);
 
-int esxVI_CreateFilter(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_CreateFilter(esxVI_Context *ctx,
                        esxVI_PropertyFilterSpec *propertyFilterSpec,
                        esxVI_Boolean partialUpdates,
                        esxVI_ManagedObjectReference **propertyFilter);
 
-int esxVI_DestroyPropertyFilter(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_DestroyPropertyFilter(esxVI_Context *ctx,
                                 esxVI_ManagedObjectReference *propertyFilter);
 
-int esxVI_WaitForUpdates(virConnectPtr conn, esxVI_Context *ctx,
-                         const char *version, esxVI_UpdateSet **updateSet);
+int esxVI_WaitForUpdates(esxVI_Context *ctx, const char *version,
+                         esxVI_UpdateSet **updateSet);
 
-int esxVI_RebootGuest(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_RebootGuest(esxVI_Context *ctx,
                       esxVI_ManagedObjectReference *virtualMachine);
 
-int esxVI_ShutdownGuest(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_ShutdownGuest(esxVI_Context *ctx,
                         esxVI_ManagedObjectReference *virtualMachine);
 
-int esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_ValidateMigration(esxVI_Context *ctx,
                             esxVI_ManagedObjectReference *virtualMachineList,
                             esxVI_VirtualMachinePowerState powerState,
                             esxVI_String *testTypeList, // FIXME: see ValidateMigrationTestType
@@ -115,29 +112,26 @@ int esxVI_ValidateMigration(virConnectPtr conn, esxVI_Context *ctx,
                             esxVI_ManagedObjectReference *hostSystem,
                             esxVI_Event **eventList);
 
-int esxVI_FindByIp(virConnectPtr conn, esxVI_Context *ctx,
-                   esxVI_ManagedObjectReference *datacenter,
+int esxVI_FindByIp(esxVI_Context *ctx, esxVI_ManagedObjectReference *datacenter,
                    const char *ip, esxVI_Boolean vmSearch,
                    esxVI_ManagedObjectReference **managedObjectReference);
 
-int esxVI_FindByUuid(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_FindByUuid(esxVI_Context *ctx,
                      esxVI_ManagedObjectReference *datacenter,
                      const unsigned char *uuid, esxVI_Boolean vmSearch,
                      esxVI_ManagedObjectReference **managedObjectReference);
 
-int esxVI_QueryAvailablePerfMetric(virConnectPtr conn, esxVI_Context *ctx,
+int esxVI_QueryAvailablePerfMetric(esxVI_Context *ctx,
                                    esxVI_ManagedObjectReference *entity,
                                    esxVI_DateTime *beginTime,
                                    esxVI_DateTime *endTime,
                                    esxVI_Int *intervalId,
                                    esxVI_PerfMetricId **perfMetricIdList);
 
-int esxVI_QueryPerfCounter(virConnectPtr conn, esxVI_Context *ctx,
-                           esxVI_Int *counterIdList,
+int esxVI_QueryPerfCounter(esxVI_Context *ctx, esxVI_Int *counterIdList,
                            esxVI_PerfCounterInfo **perfCounterInfoList);
 
-int esxVI_QueryPerf(virConnectPtr conn, esxVI_Context *ctx,
-                    esxVI_PerfQuerySpec *querySpecList,
+int esxVI_QueryPerf(esxVI_Context *ctx, esxVI_PerfQuerySpec *querySpecList,
                     esxVI_PerfEntityMetric **perfEntityMetricList);
 
 #endif /* __ESX_VI_METHODS_H__ */
index c042e894d441974a9eff0d3aa5705b32ecad3950..c561e13ddefc0b5db996d2b37ecaf71625bd8aa9 100644 (file)
@@ -37,8 +37,8 @@
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_VI_ERROR(conn, code, fmt...)                                      \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_VI_ERROR(code, fmt...)                                            \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, fmt)
 
 
@@ -65,9 +65,9 @@
 
 #define ESX_VI__TEMPLATE__ALLOC(_type)                                        \
     int                                                                       \
-    esxVI_##_type##_Alloc(virConnectPtr conn, esxVI_##_type **ptrptr)         \
+    esxVI_##_type##_Alloc(esxVI_##_type **ptrptr)                             \
     {                                                                         \
-        return esxVI_Alloc(conn, (void **)ptrptr, sizeof(esxVI_##_type));     \
+        return esxVI_Alloc((void **)ptrptr, sizeof(esxVI_##_type));           \
     }
 
 
 
 #define ESX_VI__TEMPLATE__LIST__APPEND(_type)                                 \
     int                                                                       \
-    esxVI_##_type##_AppendToList(virConnectPtr conn, esxVI_##_type **list,    \
-                                 esxVI_##_type *item)                         \
+    esxVI_##_type##_AppendToList(esxVI_##_type **list,  esxVI_##_type *item)  \
     {                                                                         \
-        return esxVI_List_Append(conn, (esxVI_List **)list,                   \
-                                 (esxVI_List *)item);                         \
+        return esxVI_List_Append((esxVI_List **)list, (esxVI_List *)item);    \
     }
 
 
 
 #define ESX_VI__TEMPLATE__LIST__DEEP_COPY(_type)                              \
     int                                                                       \
-    esxVI_##_type##_DeepCopyList(virConnectPtr conn,                          \
-                                 esxVI_##_type **destList,                    \
+    esxVI_##_type##_DeepCopyList(esxVI_##_type **destList,                    \
                                  esxVI_##_type *srcList)                      \
     {                                                                         \
         return esxVI_List_DeepCopy                                            \
-                 (conn, (esxVI_List **)destList, (esxVI_List *)srcList,       \
+                 ((esxVI_List **)destList, (esxVI_List *)srcList,             \
                   (esxVI_List_DeepCopyFunc)esxVI_##_type##_DeepCopy,          \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free);                 \
     }
 
 #define ESX_VI__TEMPLATE__LIST__CAST_FROM_ANY_TYPE(_type)                     \
     int                                                                       \
-    esxVI_##_type##_CastListFromAnyType(virConnectPtr conn,                   \
-                                        esxVI_AnyType *anyType,               \
+    esxVI_##_type##_CastListFromAnyType(esxVI_AnyType *anyType,               \
                                         esxVI_##_type **list)                 \
     {                                                                         \
         return esxVI_List_CastFromAnyType                                     \
-                 (conn, anyType, (esxVI_List **)list,                         \
+                 (anyType, (esxVI_List **)list,                               \
                   (esxVI_List_CastFromAnyTypeFunc)                            \
                     esxVI_##_type##_CastFromAnyType,                          \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free);                 \
 
 #define ESX_VI__TEMPLATE__LIST__SERIALIZE(_type)                              \
     int                                                                       \
-    esxVI_##_type##_SerializeList(virConnectPtr conn, esxVI_##_type *list,    \
-                                  const char *element, virBufferPtr output,   \
+    esxVI_##_type##_SerializeList(esxVI_##_type *list, const char *element,   \
+                                  virBufferPtr output,                        \
                                   esxVI_Boolean required)                     \
     {                                                                         \
-        return esxVI_List_Serialize(conn, (esxVI_List *)list,                 \
-                                    element, output, required,                \
+        return esxVI_List_Serialize((esxVI_List *)list, element,              \
+                                    output, required,                         \
                                     (esxVI_List_SerializeFunc)                \
                                       esxVI_##_type##_Serialize);             \
     }
 
 #define ESX_VI__TEMPLATE__LIST__DESERIALIZE(_type)                            \
     int                                                                       \
-    esxVI_##_type##_DeserializeList(virConnectPtr conn, xmlNodePtr node,      \
-                                    esxVI_##_type **list)                     \
+    esxVI_##_type##_DeserializeList(xmlNodePtr node, esxVI_##_type **list)    \
     {                                                                         \
         return esxVI_List_Deserialize                                         \
-                 (conn, node, (esxVI_List **)list,                            \
+                 (node, (esxVI_List **)list,                                  \
                   (esxVI_List_DeserializeFunc)esxVI_##_type##_Deserialize,    \
                   (esxVI_List_FreeFunc)esxVI_##_type##_Free);                 \
     }
 
 #define ESX_VI__TEMPLATE__CAST_FROM_ANY_TYPE(_type)                           \
     int                                                                       \
-    esxVI_##_type##_CastFromAnyType(virConnectPtr conn,                       \
-                                    esxVI_AnyType *anyType,                   \
+    esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType,                   \
                                     esxVI_##_type **ptrptr)                   \
     {                                                                         \
         if (anyType == NULL || ptrptr == NULL || *ptrptr != NULL) {           \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");   \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
             return -1;                                                        \
         }                                                                     \
                                                                               \
         if (STRNEQ(anyType->other, #_type)) {                                 \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                        \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
                          "Expecting type '%s' but found '%s'",                \
                          #_type, anyType->other);                             \
             return -1;                                                        \
         }                                                                     \
                                                                               \
-        return esxVI_##_type##_Deserialize(conn, anyType->_node, ptrptr);     \
+        return esxVI_##_type##_Deserialize(anyType->_node, ptrptr);           \
     }
 
 
 
 #define ESX_VI__TEMPLATE__SERIALIZE_EXTRA(_type, _type_string, _serialize)    \
     int                                                                       \
-    esxVI_##_type##_Serialize(virConnectPtr conn,                             \
-                              esxVI_##_type *item,                            \
+    esxVI_##_type##_Serialize(esxVI_##_type *item,                            \
                               const char *element, virBufferPtr output,       \
                               esxVI_Boolean required)                         \
     {                                                                         \
         if (element == NULL || output == NULL ) {                             \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");   \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
             return -1;                                                        \
         }                                                                     \
                                                                               \
         if (item == NULL) {                                                   \
-            return esxVI_CheckSerializationNecessity(conn, element,           \
-                                                     required);               \
+            return esxVI_CheckSerializationNecessity(element, required);      \
         }                                                                     \
                                                                               \
         ESV_VI__XML_TAG__OPEN(output, element, _type_string);                 \
 
 #define ESX_VI__TEMPLATE__DESERIALIZE(_type, _deserialize, _require)          \
     int                                                                       \
-    esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node,          \
-                                esxVI_##_type **ptrptr)                       \
+    esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **ptrptr)      \
     {                                                                         \
         xmlNodePtr childNode = NULL;                                          \
                                                                               \
         if (ptrptr == NULL || *ptrptr != NULL) {                              \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");   \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
             return -1;                                                        \
         }                                                                     \
                                                                               \
-        if (esxVI_##_type##_Alloc(conn, ptrptr) < 0) {                        \
+        if (esxVI_##_type##_Alloc(ptrptr) < 0) {                              \
             return -1;                                                        \
         }                                                                     \
                                                                               \
         for (childNode = node->children; childNode != NULL;                   \
              childNode = childNode->next) {                                   \
             if (childNode->type != XML_ELEMENT_NODE) {                        \
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                    \
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
                              "Wrong XML element type %d", childNode->type);   \
                 goto failure;                                                 \
             }                                                                 \
 
 #define ESX_VI__TEMPLATE__DESERIALIZE_NUMBER(_type, _xsdType, _min, _max)     \
     int                                                                       \
-    esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node,          \
-                                esxVI_##_type **number)                       \
+    esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type **number)      \
     {                                                                         \
         int result = 0;                                                       \
         char *string;                                                         \
         long long value;                                                      \
                                                                               \
         if (number == NULL || *number != NULL) {                              \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");   \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");         \
             return -1;                                                        \
         }                                                                     \
                                                                               \
-        if (esxVI_##_type##_Alloc(conn, number) < 0) {                        \
+        if (esxVI_##_type##_Alloc(number) < 0) {                              \
             return -1;                                                        \
         }                                                                     \
                                                                               \
         string = (char *)xmlNodeListGetString(node->doc, node->children, 1);  \
                                                                               \
         if (string == NULL) {                                                 \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                        \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
                          "XML node doesn't contain text, expecting an "       \
                          _xsdType" value");                                   \
             goto failure;                                                     \
         }                                                                     \
                                                                               \
         if (virStrToLong_ll(string, NULL, 10, &value) < 0) {                  \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                        \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
                          "Unknown value '%s' for "_xsdType, string);          \
             goto failure;                                                     \
         }                                                                     \
                                                                               \
         if (value < (_min) || value > (_max)) {                               \
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                        \
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                              \
                          "Value '%s' is not representable as "_xsdType,       \
                          (const char *)string);                               \
             goto failure;                                                     \
 
 
 #define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE(_type, _name, _required)        \
-    if (esxVI_##_type##_Serialize(conn, item->_name, #_name, output,          \
+    if (esxVI_##_type##_Serialize(item->_name, #_name, output,                \
                                   esxVI_Boolean_##_required) < 0) {           \
         return -1;                                                            \
     }
 
 
 #define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_VALUE(_type, _name, _required)  \
-    if (esxVI_##_type##_SerializeValue(conn, item->_name, #_name, output,     \
+    if (esxVI_##_type##_SerializeValue(item->_name, #_name, output,           \
                                        esxVI_Boolean_##_required) < 0) {      \
         return -1;                                                            \
     }
 
 
 #define ESX_VI__TEMPLATE__PROPERTY__SERIALIZE_LIST(_type, _name, _required)   \
-    if (esxVI_##_type##_SerializeList(conn, item->_name, #_name, output,      \
+    if (esxVI_##_type##_SerializeList(item->_name, #_name, output,            \
                                       esxVI_Boolean_##_required) < 0) {       \
         return -1;                                                            \
     }
 
 #define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE(_type, _name)                 \
     if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
-        if (esxVI_##_type##_Deserialize(conn, childNode,                      \
-                                        &(*ptrptr)->_name) < 0) {             \
+        if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name) < 0) {  \
             goto failure;                                                     \
         }                                                                     \
                                                                               \
 
 #define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_VALUE(_type, _name)           \
     if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
-        if (esxVI_##_type##_DeserializeValue(conn, childNode,                 \
+        if (esxVI_##_type##_DeserializeValue(childNode,                       \
                                              &(*ptrptr)->_name) < 0) {        \
             goto failure;                                                     \
         }                                                                     \
 #define ESX_VI__TEMPLATE__PROPERTY__DESERIALIZE_EXPECTED(_type, _expected,    \
                                                         _name)                \
     if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
-        if (esxVI_##_type##_Deserialize(conn, childNode, &(*ptrptr)->_name,   \
+        if (esxVI_##_type##_Deserialize(childNode, &(*ptrptr)->_name,         \
                                         _expected) < 0) {                     \
             goto failure;                                                     \
         }                                                                     \
     if (xmlStrEqual(childNode->name, BAD_CAST #_name)) {                      \
         esxVI_##_type *_name##Item = NULL;                                    \
                                                                               \
-        if (esxVI_##_type##_Deserialize(conn, childNode, &_name##Item) < 0) { \
+        if (esxVI_##_type##_Deserialize(childNode, &_name##Item) < 0) {       \
             goto failure;                                                     \
         }                                                                     \
                                                                               \
-        if (esxVI_##_type##_AppendToList(conn, &(*ptrptr)->_name,             \
+        if (esxVI_##_type##_AppendToList(&(*ptrptr)->_name,                   \
                                          _name##Item) < 0) {                  \
             esxVI_##_type##_Free(&_name##Item);                               \
             goto failure;                                                     \
  */
 #define ESX_VI__TEMPLATE__PROPERTY__REQUIRED(_name)                           \
     if ((*ptrptr)->_name == 0) {                                              \
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                            \
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                                  \
                      "Missing required '%s' property", #_name);               \
         goto failure;                                                         \
     }
 
 #define ESX_VI__TEMPLATE__ENUMERATION__CAST_FROM_ANY_TYPE(_type)              \
     int                                                                       \
-    esxVI_##_type##_CastFromAnyType(virConnectPtr conn,                       \
-                                    esxVI_AnyType *anyType,                   \
+    esxVI_##_type##_CastFromAnyType(esxVI_AnyType *anyType,                   \
                                     esxVI_##_type *value)                     \
     {                                                                         \
         return esxVI_Enumeration_CastFromAnyType                              \
-                 (conn, &_esxVI_##_type##_Enumeration, anyType,               \
-                  (int *)value);                                              \
+                 (&_esxVI_##_type##_Enumeration, anyType, (int *)value);      \
     }
 
 
 
 #define ESX_VI__TEMPLATE__ENUMERATION__SERIALIZE(_type)                       \
     int                                                                       \
-    esxVI_##_type##_Serialize(virConnectPtr conn, esxVI_##_type value,        \
-                              const char *element, virBufferPtr output,       \
-                              esxVI_Boolean required)                         \
+    esxVI_##_type##_Serialize(esxVI_##_type value, const char *element,       \
+                              virBufferPtr output, esxVI_Boolean required)    \
     {                                                                         \
-        return esxVI_Enumeration_Serialize(conn,                              \
-                                           &_esxVI_##_type##_Enumeration,     \
-                                           value, element, output,            \
-                                           required);                         \
+        return esxVI_Enumeration_Serialize(&_esxVI_##_type##_Enumeration,     \
+                                           value, element, output, required); \
     }
 
 
 
 #define ESX_VI__TEMPLATE__ENUMERATION__DESERIALIZE(_type)                     \
     int                                                                       \
-    esxVI_##_type##_Deserialize(virConnectPtr conn, xmlNodePtr node,          \
-                                esxVI_##_type *value)                         \
+    esxVI_##_type##_Deserialize(xmlNodePtr node, esxVI_##_type *value)        \
     {                                                                         \
-        return esxVI_Enumeration_Deserialize(conn,                            \
-                                             &_esxVI_##_type##_Enumeration,   \
+        return esxVI_Enumeration_Deserialize(&_esxVI_##_type##_Enumeration,   \
                                              node, (int *)value);             \
     }
 
@@ -523,11 +505,10 @@ ESX_VI__TEMPLATE__FREE(AnyType,
 });
 
 int
-esxVI_AnyType_ExpectType(virConnectPtr conn, esxVI_AnyType *anyType,
-                         esxVI_Type type)
+esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type)
 {
     if (anyType->type != type) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting type '%s' but found '%s'",
                      esxVI_Type_Name(type),
                      anyType->type != esxVI_Type_Other
@@ -540,11 +521,10 @@ esxVI_AnyType_ExpectType(virConnectPtr conn, esxVI_AnyType *anyType,
 }
 
 int
-esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
-                       esxVI_AnyType *src)
+esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -552,22 +532,21 @@ esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
         return 0;
     }
 
-    if (esxVI_AnyType_Alloc(conn, dest) < 0) {
+    if (esxVI_AnyType_Alloc(dest) < 0) {
         goto failure;
     }
 
     (*dest)->_node = xmlCopyNode(src->_node, 1);
 
     if ((*dest)->_node == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                     "Could not copy an XML node");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
         goto failure;
     }
 
     (*dest)->type = src->type;
 
-    if (esxVI_String_DeepCopyValue(conn, &(*dest)->other, src->other) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value) < 0) {
+    if (esxVI_String_DeepCopyValue(&(*dest)->other, src->other) < 0 ||
+        esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
         goto failure;
     }
 
@@ -605,25 +584,23 @@ esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
 }
 
 int
-esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                          esxVI_AnyType **anyType)
+esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
 {
     long long number;
 
     if (anyType == NULL || *anyType != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_AnyType_Alloc(conn, anyType) < 0) {
+    if (esxVI_AnyType_Alloc(anyType) < 0) {
         return -1;
     }
 
     (*anyType)->_node = xmlCopyNode(node, 1);
 
     if ((*anyType)->_node == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                     "Could not copy an XML node");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Could not copy an XML node");
         goto failure;
     }
 
@@ -633,7 +610,7 @@ esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
                  BAD_CAST "http://www.w3.org/2001/XMLSchema-instance");
 
     if ((*anyType)->other == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "AnyType is missing 'type' property");
         goto failure;
     }
@@ -645,7 +622,7 @@ esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
         (*anyType)->value = strdup("");
 
         if ((*anyType)->value == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
@@ -653,14 +630,14 @@ esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
     #define _DESERIALIZE_NUMBER(_type, _xsdType, _name, _min, _max)           \
         do {                                                                  \
             if (virStrToLong_ll((*anyType)->value, NULL, 10, &number) < 0) {  \
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                    \
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
                              "Unknown value '%s' for "_xsdType,               \
                              (*anyType)->value);                              \
                 goto failure;                                                 \
             }                                                                 \
                                                                               \
             if (number < (_min) || number > (_max)) {                         \
-                ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,                    \
+                ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,                          \
                              "Value '%s' is out of "_xsdType" range",         \
                              (*anyType)->value);                              \
                 goto failure;                                                 \
@@ -678,7 +655,7 @@ esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
         } else if (STREQ((*anyType)->value, "false")) {
             (*anyType)->boolean = esxVI_Boolean_False;
         } else {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Unknown value '%s' for xsd:boolean",
                          (*anyType)->value);
             goto failure;
@@ -725,23 +702,22 @@ ESX_VI__TEMPLATE__FREE(String,
 ESX_VI__TEMPLATE__LIST__APPEND(String);
 
 int
-esxVI_String_AppendValueToList(virConnectPtr conn,
-                               esxVI_String **stringList, const char *value)
+esxVI_String_AppendValueToList(esxVI_String **stringList, const char *value)
 {
     esxVI_String *string = NULL;
 
-    if (esxVI_String_Alloc(conn, &string) < 0) {
+    if (esxVI_String_Alloc(&string) < 0) {
         goto failure;
     }
 
     string->value = strdup(value);
 
     if (string->value == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
-    if (esxVI_String_AppendToList(conn, stringList, string) < 0) {
+    if (esxVI_String_AppendToList(stringList, string) < 0) {
         goto failure;
     }
 
@@ -754,23 +730,21 @@ esxVI_String_AppendValueToList(virConnectPtr conn,
 }
 
 int
-esxVI_String_AppendValueListToList(virConnectPtr conn,
-                                   esxVI_String **stringList,
+esxVI_String_AppendValueListToList(esxVI_String **stringList,
                                    const char *valueList)
 {
     esxVI_String *stringListToAppend = NULL;
     const char *value = valueList;
 
     while (value != NULL && *value != '\0') {
-        if (esxVI_String_AppendValueToList(conn, &stringListToAppend,
-                                           value) < 0) {
+        if (esxVI_String_AppendValueToList(&stringListToAppend, value) < 0) {
             goto failure;
         }
 
         value += strlen(value) + 1;
     }
 
-    if (esxVI_String_AppendToList(conn, stringList, stringListToAppend) < 0) {
+    if (esxVI_String_AppendToList(stringList, stringListToAppend) < 0) {
         goto failure;
     }
 
@@ -783,11 +757,10 @@ esxVI_String_AppendValueListToList(virConnectPtr conn,
 }
 
 int
-esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
-                      esxVI_String *src)
+esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -795,8 +768,8 @@ esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
         return 0;
     }
 
-    if (esxVI_String_Alloc(conn, dest) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value)) {
+    if (esxVI_String_Alloc(dest) < 0 ||
+        esxVI_String_DeepCopyValue(&(*dest)->value, src->value)) {
         goto failure;
     }
 
@@ -812,10 +785,10 @@ esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
 ESX_VI__TEMPLATE__LIST__DEEP_COPY(String);
 
 int
-esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest, const char *src)
+esxVI_String_DeepCopyValue(char **dest, const char *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -826,7 +799,7 @@ esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest, const char *src)
     *dest = strdup(src);
 
     if (*dest == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         return -1;
     }
 
@@ -834,12 +807,10 @@ esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest, const char *src)
 }
 
 int
-esxVI_String_Serialize(virConnectPtr conn, esxVI_String *string,
-                       const char *element, virBufferPtr output,
-                       esxVI_Boolean required)
+esxVI_String_Serialize(esxVI_String *string, const char *element,
+                       virBufferPtr output, esxVI_Boolean required)
 {
-    return esxVI_String_SerializeValue(conn,
-                                       string != NULL ? string->value : NULL,
+    return esxVI_String_SerializeValue(string != NULL ? string->value : NULL,
                                        element, output, required);
 }
 
@@ -847,17 +818,16 @@ esxVI_String_Serialize(virConnectPtr conn, esxVI_String *string,
 ESX_VI__TEMPLATE__LIST__SERIALIZE(String);
 
 int
-esxVI_String_SerializeValue(virConnectPtr conn, const char *value,
-                            const char *element, virBufferPtr output,
-                            esxVI_Boolean required)
+esxVI_String_SerializeValue(const char *value, const char *element,
+                            virBufferPtr output, esxVI_Boolean required)
 {
     if (element == NULL || output == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (value == NULL) {
-        return esxVI_CheckSerializationNecessity(conn, element, required);
+        return esxVI_CheckSerializationNecessity(element, required);
     }
 
     ESV_VI__XML_TAG__OPEN(output, element, "xsd:string");
@@ -870,15 +840,14 @@ esxVI_String_SerializeValue(virConnectPtr conn, const char *value,
 }
 
 int
-esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                         esxVI_String **string)
+esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string)
 {
     if (string == NULL || *string != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_String_Alloc(conn, string) < 0) {
+    if (esxVI_String_Alloc(string) < 0) {
         return -1;
     }
 
@@ -889,7 +858,7 @@ esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
         (*string)->value = strdup("");
 
         if ((*string)->value == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     }
@@ -906,11 +875,10 @@ esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
 ESX_VI__TEMPLATE__LIST__DESERIALIZE(String);
 
 int
-esxVI_String_DeserializeValue(virConnectPtr conn, xmlNodePtr node,
-                              char **value)
+esxVI_String_DeserializeValue(xmlNodePtr node, char **value)
 {
     if (value == NULL || *value != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -920,7 +888,7 @@ esxVI_String_DeserializeValue(virConnectPtr conn, xmlNodePtr node,
         *value = strdup("");
 
         if (*value == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             return -1;
         }
     }
@@ -947,10 +915,10 @@ ESX_VI__TEMPLATE__FREE(Int,
 ESX_VI__TEMPLATE__LIST__APPEND(Int);
 
 int
-esxVI_Int_DeepCopy(virConnectPtr conn, esxVI_Int **dest, esxVI_Int *src)
+esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -958,7 +926,7 @@ esxVI_Int_DeepCopy(virConnectPtr conn, esxVI_Int **dest, esxVI_Int *src)
         return 0;
     }
 
-    if (esxVI_Int_Alloc(conn, dest) < 0) {
+    if (esxVI_Int_Alloc(dest) < 0) {
         goto failure;
     }
 
@@ -1036,15 +1004,14 @@ ESX_VI__TEMPLATE__SERIALIZE_EXTRA(DateTime, "xsd:dateTime",
 });
 
 int
-esxVI_DateTime_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                           esxVI_DateTime **dateTime)
+esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime)
 {
     if (dateTime == NULL || *dateTime != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_DateTime_Alloc(conn, dateTime) < 0) {
+    if (esxVI_DateTime_Alloc(dateTime) < 0) {
         return -1;
     }
 
@@ -1052,7 +1019,7 @@ esxVI_DateTime_Deserialize(virConnectPtr conn, xmlNodePtr node,
       (char *)xmlNodeListGetString(node->doc, node->children, 1);
 
     if ((*dateTime)->value == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "XML node doesn't contain text, expecting an "
                      "xsd:dateTime value");
         goto failure;
@@ -1291,12 +1258,11 @@ ESX_VI__TEMPLATE__FREE(ManagedObjectReference,
 });
 
 int
-esxVI_ManagedObjectReference_DeepCopy(virConnectPtr conn,
-                                      esxVI_ManagedObjectReference **dest,
+esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
                                       esxVI_ManagedObjectReference *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1304,9 +1270,9 @@ esxVI_ManagedObjectReference_DeepCopy(virConnectPtr conn,
         return 0;
     }
 
-    if (esxVI_ManagedObjectReference_Alloc(conn, dest) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &(*dest)->type, src->type) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &(*dest)->value, src->value) < 0) {
+    if (esxVI_ManagedObjectReference_Alloc(dest) < 0 ||
+        esxVI_String_DeepCopyValue(&(*dest)->type, src->type) < 0 ||
+        esxVI_String_DeepCopyValue(&(*dest)->value, src->value) < 0) {
         goto failure;
     }
 
@@ -1323,31 +1289,31 @@ ESX_VI__TEMPLATE__LIST__APPEND(ManagedObjectReference);
 
 int
 esxVI_ManagedObjectReference_CastFromAnyType
-  (virConnectPtr conn, esxVI_AnyType *anyType,
+  (esxVI_AnyType *anyType,
    esxVI_ManagedObjectReference **managedObjectReference,
    const char *expectedType)
 {
     if (anyType == NULL || managedObjectReference == NULL ||
         *managedObjectReference != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (STRNEQ(anyType->other, "ManagedObjectReference")) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting type 'ManagedObjectReference' but found '%s'",
                      anyType->other);
         return -1;
     }
 
-    return esxVI_ManagedObjectReference_Deserialize(conn, anyType->_node,
+    return esxVI_ManagedObjectReference_Deserialize(anyType->_node,
                                                     managedObjectReference,
                                                     expectedType);
 }
 
 int
 esxVI_ManagedObjectReference_CastListFromAnyType
-  (virConnectPtr conn, esxVI_AnyType *anyType,
+  (esxVI_AnyType *anyType,
    esxVI_ManagedObjectReference **managedObjectReferenceList,
    const char *expectedType)
 {
@@ -1358,7 +1324,7 @@ esxVI_ManagedObjectReference_CastListFromAnyType
 
     if (managedObjectReferenceList == NULL ||
         *managedObjectReferenceList != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         goto failure;
     }
 
@@ -1367,7 +1333,7 @@ esxVI_ManagedObjectReference_CastListFromAnyType
     }
 
     if (STRNEQ(anyType->other, "ArrayOfManagedObjectReference")) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expecting type to be 'ArrayOfManagedObjectReference' "
                      "but found '%s'", anyType->other);
         goto failure;
@@ -1376,27 +1342,26 @@ esxVI_ManagedObjectReference_CastListFromAnyType
     for (childNode = anyType->_node->children; childNode != NULL;
          childNode = childNode->next) {
         if (childNode->type != XML_ELEMENT_NODE) {
-            ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                          "Wrong XML element type %d", childNode->type);
             goto failure;
         }
 
         esxVI_AnyType_Free(&childAnyType);
 
-        if (esxVI_AnyType_Deserialize(conn, childNode, &childAnyType) < 0) {
+        if (esxVI_AnyType_Deserialize(childNode, &childAnyType) < 0) {
             goto failure;
         }
 
         managedObjectReference = NULL;
 
         if (esxVI_ManagedObjectReference_CastFromAnyType
-              (conn, childAnyType, &managedObjectReference,
-               expectedType) < 0) {
+              (childAnyType, &managedObjectReference, expectedType) < 0) {
             goto failure;
         }
 
         if (esxVI_ManagedObjectReference_AppendToList
-              (conn, managedObjectReferenceList, managedObjectReference) < 0) {
+              (managedObjectReferenceList, managedObjectReference) < 0) {
             goto failure;
         }
     }
@@ -1417,16 +1382,16 @@ esxVI_ManagedObjectReference_CastListFromAnyType
 
 int
 esxVI_ManagedObjectReference_Serialize
-  (virConnectPtr conn, esxVI_ManagedObjectReference *managedObjectReference,
+  (esxVI_ManagedObjectReference *managedObjectReference,
    const char *element, virBufferPtr output, esxVI_Boolean required)
 {
     if (element == NULL || output == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (managedObjectReference == NULL) {
-        return esxVI_CheckSerializationNecessity(conn, element, required);
+        return esxVI_CheckSerializationNecessity(element, required);
     }
 
     virBufferAddLit(output, "<");
@@ -1448,16 +1413,15 @@ ESX_VI__TEMPLATE__LIST__SERIALIZE(ManagedObjectReference);
 
 int
 esxVI_ManagedObjectReference_Deserialize
-  (virConnectPtr conn, xmlNodePtr node,
-   esxVI_ManagedObjectReference **managedObjectReference,
+  (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
    const char *expectedType)
 {
     if (managedObjectReference == NULL || *managedObjectReference != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVI_ManagedObjectReference_Alloc(conn, managedObjectReference) < 0) {
+    if (esxVI_ManagedObjectReference_Alloc(managedObjectReference) < 0) {
         return -1;
     }
 
@@ -1465,20 +1429,20 @@ esxVI_ManagedObjectReference_Deserialize
       (char *)xmlGetNoNsProp(node, BAD_CAST "type");
 
     if ((*managedObjectReference)->type == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "ManagedObjectReference is missing 'type' property");
         goto failure;
     }
 
     if (expectedType != NULL &&
         STRNEQ(expectedType, (*managedObjectReference)->type)) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR,
                      "Expected type '%s' but found '%s'", expectedType,
                      (*managedObjectReference)->type);
         goto failure;
     }
 
-    if (esxVI_String_DeserializeValue(conn, node,
+    if (esxVI_String_DeserializeValue(node,
                                       &(*managedObjectReference)->value) < 0) {
         goto failure;
     }
@@ -1510,12 +1474,11 @@ ESX_VI__TEMPLATE__FREE(DynamicProperty,
 });
 
 int
-esxVI_DynamicProperty_DeepCopy(virConnectPtr conn,
-                               esxVI_DynamicProperty **dest,
+esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
                                esxVI_DynamicProperty *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1523,9 +1486,9 @@ esxVI_DynamicProperty_DeepCopy(virConnectPtr conn,
         return 0;
     }
 
-    if (esxVI_DynamicProperty_Alloc(conn, dest) < 0 ||
-        esxVI_String_DeepCopyValue(conn, &(*dest)->name, src->name) < 0 ||
-        esxVI_AnyType_DeepCopy(conn, &(*dest)->val, src->val) < 0) {
+    if (esxVI_DynamicProperty_Alloc(dest) < 0 ||
+        esxVI_String_DeepCopyValue(&(*dest)->name, src->name) < 0 ||
+        esxVI_AnyType_DeepCopy(&(*dest)->val, src->val) < 0) {
         goto failure;
     }
 
@@ -1648,28 +1611,27 @@ esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpec)
 ESX_VI__TEMPLATE__LIST__APPEND(SelectionSpec);
 
 int
-esxVI_SelectionSpec_Serialize(virConnectPtr conn,
-                              esxVI_SelectionSpec *selectionSpec,
+esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
                               const char *element, virBufferPtr output,
                               esxVI_Boolean required)
 {
     if (element == NULL || output == NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (selectionSpec == NULL) {
-        return esxVI_CheckSerializationNecessity(conn, element, required);
+        return esxVI_CheckSerializationNecessity(element, required);
     }
 
     if (selectionSpec->_super != NULL) {
-        return esxVI_TraversalSpec_Serialize(conn, selectionSpec->_super,
-                                             element, output, required);
+        return esxVI_TraversalSpec_Serialize(selectionSpec->_super, element,
+                                             output, required);
     }
 
     ESV_VI__XML_TAG__OPEN(output, element, "SelectionSpec");
 
-    if (esxVI_String_SerializeValue(conn, selectionSpec->name, "name", output,
+    if (esxVI_String_SerializeValue(selectionSpec->name, "name", output,
                                     esxVI_Boolean_False) < 0) {
         return -1;
     }
@@ -1689,15 +1651,13 @@ ESX_VI__TEMPLATE__LIST__SERIALIZE(SelectionSpec);
  */
 
 int
-esxVI_TraversalSpec_Alloc(virConnectPtr conn,
-                          esxVI_TraversalSpec **traversalSpec)
+esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec)
 {
-    if (esxVI_Alloc(conn, (void **)traversalSpec,
-                    sizeof(esxVI_TraversalSpec)) < 0) {
+    if (esxVI_Alloc((void **)traversalSpec, sizeof(esxVI_TraversalSpec)) < 0) {
         return -1;
     }
 
-    if (esxVI_SelectionSpec_Alloc(conn, &(*traversalSpec)->_base) < 0) {
+    if (esxVI_SelectionSpec_Alloc(&(*traversalSpec)->_base) < 0) {
         esxVI_TraversalSpec_Free(traversalSpec);
         return -1;
     }
@@ -1750,7 +1710,7 @@ esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec)
 /* esxVI_TraversalSpec_Serialize */
 ESX_VI__TEMPLATE__SERIALIZE(TraversalSpec,
 {
-    if (esxVI_String_SerializeValue(conn, item->_base->name, "name", output,
+    if (esxVI_String_SerializeValue(item->_base->name, "name", output,
                                     esxVI_Boolean_False) < 0) {
         return -1;
     }
@@ -1915,12 +1875,11 @@ ESX_VI__TEMPLATE__FREE(ObjectContent,
 ESX_VI__TEMPLATE__LIST__APPEND(ObjectContent);
 
 int
-esxVI_ObjectContent_DeepCopy(virConnectPtr conn,
-                             esxVI_ObjectContent **dest,
+esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
                              esxVI_ObjectContent *src)
 {
     if (dest == NULL || *dest != NULL) {
-        ESX_VI_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_VI_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -1928,10 +1887,9 @@ esxVI_ObjectContent_DeepCopy(virConnectPtr conn,
         return 0;
     }
 
-    if (esxVI_ObjectContent_Alloc(conn, dest) < 0 ||
-        esxVI_ManagedObjectReference_DeepCopy(conn, &(*dest)->obj,
-                                              src->obj) < 0 ||
-        esxVI_DynamicProperty_DeepCopyList(conn, &(*dest)->propSet,
+    if (esxVI_ObjectContent_Alloc(dest) < 0 ||
+        esxVI_ManagedObjectReference_DeepCopy(&(*dest)->obj, src->obj) < 0 ||
+        esxVI_DynamicProperty_DeepCopyList(&(*dest)->propSet,
                                            src->propSet) < 0) {
         goto failure;
     }
index 77f712e27a3a60875e28aefed0d4bdd61fc6db50..d0ec489b1e274d8c74fc4e00295cce9faa9b0993 100644 (file)
@@ -131,11 +131,9 @@ enum _esxVI_Boolean {
     esxVI_Boolean_False,
 };
 
-int esxVI_Boolean_Serialize(virConnectPtr conn, esxVI_Boolean boolean_,
-                            const char *element, virBufferPtr output,
-                            esxVI_Boolean required);
-int esxVI_Boolean_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                              esxVI_Boolean *boolean_);
+int esxVI_Boolean_Serialize(esxVI_Boolean boolean_, const char *element,
+                            virBufferPtr output, esxVI_Boolean required);
+int esxVI_Boolean_Deserialize(xmlNodePtr node, esxVI_Boolean *boolean_);
 
 
 
@@ -158,14 +156,11 @@ struct _esxVI_AnyType {
     };
 };
 
-int esxVI_AnyType_Alloc(virConnectPtr conn, esxVI_AnyType **anyType);
+int esxVI_AnyType_Alloc(esxVI_AnyType **anyType);
 void esxVI_AnyType_Free(esxVI_AnyType **anyType);
-int esxVI_AnyType_ExpectType(virConnectPtr conn, esxVI_AnyType *anyType,
-                             esxVI_Type type);
-int esxVI_AnyType_DeepCopy(virConnectPtr conn, esxVI_AnyType **dest,
-                           esxVI_AnyType *src);
-int esxVI_AnyType_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                              esxVI_AnyType **anyType);
+int esxVI_AnyType_ExpectType(esxVI_AnyType *anyType, esxVI_Type type);
+int esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyType *src);
+int esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType);
 
 
 
@@ -179,37 +174,25 @@ struct _esxVI_String {
     char *value;                                           /* required */
 };
 
-int esxVI_String_Alloc(virConnectPtr conn, esxVI_String **string);
+int esxVI_String_Alloc(esxVI_String **string);
 void esxVI_String_Free(esxVI_String **stringList);
-int esxVI_String_AppendToList(virConnectPtr conn, esxVI_String **stringList,
-                              esxVI_String *string);
-int esxVI_String_AppendValueToList(virConnectPtr conn,
-                                   esxVI_String **stringList,
+int esxVI_String_AppendToList(esxVI_String **stringList, esxVI_String *string);
+int esxVI_String_AppendValueToList(esxVI_String **stringList,
                                    const char *value);
-int esxVI_String_AppendValueListToList(virConnectPtr conn,
-                                       esxVI_String **stringList,
+int esxVI_String_AppendValueListToList(esxVI_String **stringList,
                                        const char *valueList);
-int esxVI_String_DeepCopy(virConnectPtr conn, esxVI_String **dest,
-                          esxVI_String *src);
-int esxVI_String_DeepCopyList(virConnectPtr conn, esxVI_String **destList,
-                              esxVI_String *srcList);
-int esxVI_String_DeepCopyValue(virConnectPtr conn, char **dest,
-                               const char *src);
-int esxVI_String_Serialize(virConnectPtr conn, esxVI_String *string,
-                           const char *element, virBufferPtr output,
-                           esxVI_Boolean required);
-int esxVI_String_SerializeList(virConnectPtr conn, esxVI_String *stringList,
-                               const char *element, virBufferPtr output,
-                               esxVI_Boolean required);
-int esxVI_String_SerializeValue(virConnectPtr conn, const char *value,
-                                const char *element, virBufferPtr output,
-                                esxVI_Boolean required);
-int esxVI_String_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                             esxVI_String **string);
-int esxVI_String_DeserializeList(virConnectPtr conn, xmlNodePtr node,
-                                 esxVI_String **stringList);
-int esxVI_String_DeserializeValue(virConnectPtr conn, xmlNodePtr node,
-                                  char **value);
+int esxVI_String_DeepCopy(esxVI_String **dest, esxVI_String *src);
+int esxVI_String_DeepCopyList(esxVI_String **destList, esxVI_String *srcList);
+int esxVI_String_DeepCopyValue(char **dest, const char *src);
+int esxVI_String_Serialize(esxVI_String *string, const char *element,
+                           virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_SerializeList(esxVI_String *stringList, const char *element,
+                               virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_SerializeValue(const char *value, const char *element,
+                                virBufferPtr output, esxVI_Boolean required);
+int esxVI_String_Deserialize(xmlNodePtr node, esxVI_String **string);
+int esxVI_String_DeserializeList(xmlNodePtr node, esxVI_String **stringList);
+int esxVI_String_DeserializeValue(xmlNodePtr node, char **value);
 
 
 
@@ -223,19 +206,15 @@ struct _esxVI_Int {
     int32_t value;                                         /* required */
 };
 
-int esxVI_Int_Alloc(virConnectPtr conn, esxVI_Int **number);
+int esxVI_Int_Alloc(esxVI_Int **number);
 void esxVI_Int_Free(esxVI_Int **numberList);
-int esxVI_Int_AppendToList(virConnectPtr conn, esxVI_Int **numberList,
-                           esxVI_Int *number);
-int esxVI_Int_DeepCopy(virConnectPtr conn, esxVI_Int **dest, esxVI_Int *src);
-int esxVI_Int_Serialize(virConnectPtr conn, esxVI_Int *number,
-                        const char *element, virBufferPtr output,
-                        esxVI_Boolean required);
-int esxVI_Int_SerializeList(virConnectPtr conn, esxVI_Int *numberList,
-                            const char *element, virBufferPtr output,
-                            esxVI_Boolean required);
-int esxVI_Int_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                          esxVI_Int **number);
+int esxVI_Int_AppendToList(esxVI_Int **numberList, esxVI_Int *number);
+int esxVI_Int_DeepCopy(esxVI_Int **dest, esxVI_Int *src);
+int esxVI_Int_Serialize(esxVI_Int *number, const char *element,
+                        virBufferPtr output, esxVI_Boolean required);
+int esxVI_Int_SerializeList(esxVI_Int *numberList, const char *element,
+                            virBufferPtr output, esxVI_Boolean required);
+int esxVI_Int_Deserialize(xmlNodePtr node, esxVI_Int **number);
 
 
 
@@ -249,18 +228,14 @@ struct _esxVI_Long {
     int64_t value;                                         /* required */
 };
 
-int esxVI_Long_Alloc(virConnectPtr conn, esxVI_Long **number);
+int esxVI_Long_Alloc(esxVI_Long **number);
 void esxVI_Long_Free(esxVI_Long **numberList);
-int esxVI_Long_AppendToList(virConnectPtr conn, esxVI_Long **numberList,
-                            esxVI_Long *number);
-int esxVI_Long_Serialize(virConnectPtr conn, esxVI_Long *number,
-                         const char *element, virBufferPtr output,
-                         esxVI_Boolean required);
-int esxVI_Long_SerializeList(virConnectPtr conn, esxVI_Long *numberList,
-                             const char *element, virBufferPtr output,
-                             esxVI_Boolean required);
-int esxVI_Long_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                           esxVI_Long **number);
+int esxVI_Long_AppendToList(esxVI_Long **numberList, esxVI_Long *number);
+int esxVI_Long_Serialize(esxVI_Long *number, const char *element,
+                         virBufferPtr output, esxVI_Boolean required);
+int esxVI_Long_SerializeList(esxVI_Long *numberList, const char *element,
+                             virBufferPtr output,esxVI_Boolean required);
+int esxVI_Long_Deserialize(xmlNodePtr node, esxVI_Long **number);
 
 
 
@@ -272,13 +247,11 @@ struct _esxVI_DateTime {
     char *value;                                           /* required */
 };
 
-int esxVI_DateTime_Alloc(virConnectPtr conn, esxVI_DateTime **dateTime);
+int esxVI_DateTime_Alloc(esxVI_DateTime **dateTime);
 void esxVI_DateTime_Free(esxVI_DateTime **dateTime);
-int esxVI_DateTime_Serialize(virConnectPtr conn, esxVI_DateTime *dateTime,
-                             const char *element, virBufferPtr output,
-                             esxVI_Boolean required);
-int esxVI_DateTime_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                               esxVI_DateTime **dateTime);
+int esxVI_DateTime_Serialize(esxVI_DateTime *dateTime, const char *element,
+                             virBufferPtr output, esxVI_Boolean required);
+int esxVI_DateTime_Deserialize(xmlNodePtr node, esxVI_DateTime **dateTime);
 
 
 
@@ -295,8 +268,7 @@ enum _esxVI_ManagedEntityStatus {
 };
 
 int esxVI_ManagedEntityStatus_CastFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
-       esxVI_ManagedEntityStatus *managedEntityStatus);
+      (esxVI_AnyType *anyType, esxVI_ManagedEntityStatus *managedEntityStatus);
 
 
 
@@ -312,8 +284,7 @@ enum _esxVI_ObjectUpdateKind {
 };
 
 int esxVI_ObjectUpdateKind_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_ObjectUpdateKind *objectUpdateKind);
+      (xmlNodePtr node, esxVI_ObjectUpdateKind *objectUpdateKind);
 
 
 
@@ -331,7 +302,7 @@ enum _esxVI_PerfSummaryType {
     esxVI_PerfSummaryType_Summation,
 };
 
-int esxVI_PerfSummaryType_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfSummaryType_Deserialize(xmlNodePtr node,
                                       esxVI_PerfSummaryType *perfSummaryType);
 
 
@@ -347,7 +318,7 @@ enum _esxVI_PerfStatsType {
     esxVI_PerfStatsType_Rate,
 };
 
-int esxVI_PerfStatsType_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfStatsType_Deserialize(xmlNodePtr node,
                                     esxVI_PerfStatsType *perfStatsType);
 
 
@@ -365,8 +336,7 @@ enum _esxVI_PropertyChangeOp {
 };
 
 int esxVI_PropertyChangeOp_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PropertyChangeOp *propertyChangeOp);
+      (xmlNodePtr node, esxVI_PropertyChangeOp *propertyChangeOp);
 
 
 
@@ -382,11 +352,10 @@ enum _esxVI_SharesLevel {
     esxVI_SharesLevel_Normal,
 };
 
-int esxVI_SharesLevel_Serialize(virConnectPtr conn,
-                                esxVI_SharesLevel sharesLevel,
+int esxVI_SharesLevel_Serialize(esxVI_SharesLevel sharesLevel,
                                 const char *element, virBufferPtr output,
                                 esxVI_Boolean required);
-int esxVI_SharesLevel_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_SharesLevel_Deserialize(xmlNodePtr node,
                                   esxVI_SharesLevel *sharesLevel);
 
 
@@ -403,10 +372,9 @@ enum _esxVI_TaskInfoState {
     esxVI_TaskInfoState_Success,
 };
 
-int esxVI_TaskInfoState_CastFromAnyType(virConnectPtr conn,
-                                        esxVI_AnyType *anyType,
+int esxVI_TaskInfoState_CastFromAnyType(esxVI_AnyType *anyType,
                                         esxVI_TaskInfoState *taskInfoState);
-int esxVI_TaskInfoState_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_TaskInfoState_Deserialize(xmlNodePtr node,
                                     esxVI_TaskInfoState *taskInfoState);
 
 
@@ -423,8 +391,7 @@ enum _esxVI_VirtualMachineMovePriority {
 };
 
 int esxVI_VirtualMachineMovePriority_Serialize
-      (virConnectPtr conn,
-       esxVI_VirtualMachineMovePriority virtualMachineMovePriority,
+      (esxVI_VirtualMachineMovePriority virtualMachineMovePriority,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 
 
@@ -441,11 +408,10 @@ enum _esxVI_VirtualMachinePowerState {
 };
 
 int esxVI_VirtualMachinePowerState_CastFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
+      (esxVI_AnyType *anyType,
        esxVI_VirtualMachinePowerState *virtualMachinePowerState);
 int esxVI_VirtualMachinePowerState_Serialize
-      (virConnectPtr conn,
-       esxVI_VirtualMachinePowerState virtualMachinePowerState,
+      (esxVI_VirtualMachinePowerState virtualMachinePowerState,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 
 
@@ -459,10 +425,9 @@ struct _esxVI_Fault {
     char *faultstring;                                     /* required */
 };
 
-int esxVI_Fault_Alloc(virConnectPtr conn, esxVI_Fault **fault);
+int esxVI_Fault_Alloc(esxVI_Fault **fault);
 void esxVI_Fault_Free(esxVI_Fault **fault);
-int esxVI_Fault_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                            esxVI_Fault **fault);
+int esxVI_Fault_Deserialize(xmlNodePtr node, esxVI_Fault **fault);
 
 
 
@@ -478,37 +443,30 @@ struct _esxVI_ManagedObjectReference {
 };
 
 int esxVI_ManagedObjectReference_Alloc
-      (virConnectPtr conn,
-       esxVI_ManagedObjectReference **managedObjectReference);
+      (esxVI_ManagedObjectReference **managedObjectReference);
 void esxVI_ManagedObjectReference_Free
        (esxVI_ManagedObjectReference **managedObjectReferenceList);
-int esxVI_ManagedObjectReference_DeepCopy(virConnectPtr conn,
-                                          esxVI_ManagedObjectReference **dest,
+int esxVI_ManagedObjectReference_DeepCopy(esxVI_ManagedObjectReference **dest,
                                           esxVI_ManagedObjectReference *src);
 int esxVI_ManagedObjectReference_AppendToList
-      (virConnectPtr conn,
-       esxVI_ManagedObjectReference **managedObjectReferenceList,
+      (esxVI_ManagedObjectReference **managedObjectReferenceList,
        esxVI_ManagedObjectReference *managedObjectReference);
-int esxVI_ManagedObjectReference_CastFromAnyType(virConnectPtr conn,
-                                                 esxVI_AnyType *anyType,
+int esxVI_ManagedObjectReference_CastFromAnyType(esxVI_AnyType *anyType,
                                                  esxVI_ManagedObjectReference
                                                  **managedObjectReference,
                                                  const char *expectedType);
 int esxVI_ManagedObjectReference_CastListFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
+      (esxVI_AnyType *anyType,
        esxVI_ManagedObjectReference **managedObjectReferenceList,
        const char *expectedType);
 int esxVI_ManagedObjectReference_Serialize
-      (virConnectPtr conn,
-       esxVI_ManagedObjectReference *managedObjectReference,
+      (esxVI_ManagedObjectReference *managedObjectReference,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 int esxVI_ManagedObjectReference_SerializeList
-      (virConnectPtr conn,
-       esxVI_ManagedObjectReference *managedObjectReference,
+      (esxVI_ManagedObjectReference *managedObjectReference,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 int esxVI_ManagedObjectReference_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_ManagedObjectReference **managedObjectReference,
+      (xmlNodePtr node, esxVI_ManagedObjectReference **managedObjectReference,
        const char *expectedType);
 
 
@@ -524,24 +482,20 @@ struct _esxVI_DynamicProperty {
     esxVI_AnyType *val;                                    /* required */
 };
 
-int esxVI_DynamicProperty_Alloc(virConnectPtr conn,
-                                esxVI_DynamicProperty **dynamicProperty);
+int esxVI_DynamicProperty_Alloc(esxVI_DynamicProperty **dynamicProperty);
 void esxVI_DynamicProperty_Free
        (esxVI_DynamicProperty **dynamicPropertyList);
-int esxVI_DynamicProperty_DeepCopy(virConnectPtr conn,
-                                   esxVI_DynamicProperty **dest,
+int esxVI_DynamicProperty_DeepCopy(esxVI_DynamicProperty **dest,
                                    esxVI_DynamicProperty *src);
-int esxVI_DynamicProperty_DeepCopyList(virConnectPtr conn,
-                                       esxVI_DynamicProperty **destList,
+int esxVI_DynamicProperty_DeepCopyList(esxVI_DynamicProperty **destList,
                                        esxVI_DynamicProperty *srcList);
 int esxVI_DynamicProperty_AppendToList
-      (virConnectPtr conn, esxVI_DynamicProperty **dynamicPropertyList,
+      (esxVI_DynamicProperty **dynamicPropertyList,
        esxVI_DynamicProperty *dynamicProperty);
-int esxVI_DynamicProperty_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_DynamicProperty_Deserialize(xmlNodePtr node,
                                       esxVI_DynamicProperty **dynamicProperty);
 int esxVI_DynamicProperty_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_DynamicProperty **dynamicPropertyList);
+      (xmlNodePtr node, esxVI_DynamicProperty **dynamicPropertyList);
 
 
 
@@ -560,20 +514,16 @@ struct _esxVI_HostCpuIdInfo {
     char *edx;                                             /* optional */
 };
 
-int esxVI_HostCpuIdInfo_Alloc(virConnectPtr conn,
-                              esxVI_HostCpuIdInfo **hostCpuIdInfo);
+int esxVI_HostCpuIdInfo_Alloc(esxVI_HostCpuIdInfo **hostCpuIdInfo);
 void esxVI_HostCpuIdInfo_Free(esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_CastFromAnyType(virConnectPtr conn,
-                                        esxVI_AnyType *anyType,
+int esxVI_HostCpuIdInfo_CastFromAnyType(esxVI_AnyType *anyType,
                                         esxVI_HostCpuIdInfo **hostCpuIdInfo);
 int esxVI_HostCpuIdInfo_CastListFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
-       esxVI_HostCpuIdInfo **hostCpuIdInfoList);
-int esxVI_HostCpuIdInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+      (esxVI_AnyType *anyType, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
+int esxVI_HostCpuIdInfo_Deserialize(xmlNodePtr node,
                                     esxVI_HostCpuIdInfo **hostCpuIdInfo);
 int esxVI_HostCpuIdInfo_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_HostCpuIdInfo **hostCpuIdInfoList);
+      (xmlNodePtr node, esxVI_HostCpuIdInfo **hostCpuIdInfoList);
 
 
 
@@ -588,18 +538,14 @@ struct _esxVI_SelectionSpec {
     char *name;                                            /* optional */
 };
 
-int esxVI_SelectionSpec_Alloc(virConnectPtr conn,
-                              esxVI_SelectionSpec **selectionSpec);
+int esxVI_SelectionSpec_Alloc(esxVI_SelectionSpec **selectionSpec);
 void esxVI_SelectionSpec_Free(esxVI_SelectionSpec **selectionSpecList);
-int esxVI_SelectionSpec_AppendToList(virConnectPtr conn,
-                                     esxVI_SelectionSpec **selectionSpecList,
+int esxVI_SelectionSpec_AppendToList(esxVI_SelectionSpec **selectionSpecList,
                                      esxVI_SelectionSpec *selectionSpec);
-int esxVI_SelectionSpec_Serialize(virConnectPtr conn,
-                                  esxVI_SelectionSpec *selectionSpec,
+int esxVI_SelectionSpec_Serialize(esxVI_SelectionSpec *selectionSpec,
                                   const char *element, virBufferPtr output,
                                   esxVI_Boolean required);
-int esxVI_SelectionSpec_SerializeList(virConnectPtr conn,
-                                      esxVI_SelectionSpec *selectionSpecList,
+int esxVI_SelectionSpec_SerializeList(esxVI_SelectionSpec *selectionSpecList,
                                       const char *element, virBufferPtr output,
                                       esxVI_Boolean required);
 
@@ -618,11 +564,9 @@ struct _esxVI_TraversalSpec {
     esxVI_SelectionSpec *selectSet;                        /* optional, list */
 };
 
-int esxVI_TraversalSpec_Alloc(virConnectPtr conn,
-                              esxVI_TraversalSpec **traversalSpec);
+int esxVI_TraversalSpec_Alloc(esxVI_TraversalSpec **traversalSpec);
 void esxVI_TraversalSpec_Free(esxVI_TraversalSpec **traversalSpec);
-int esxVI_TraversalSpec_Serialize(virConnectPtr conn,
-                                  esxVI_TraversalSpec *traversalSpec,
+int esxVI_TraversalSpec_Serialize(esxVI_TraversalSpec *traversalSpec,
                                   const char *element, virBufferPtr output,
                                   esxVI_Boolean required);
 
@@ -640,17 +584,14 @@ struct _esxVI_ObjectSpec {
     esxVI_SelectionSpec *selectSet;                        /* optional, list */
 };
 
-int esxVI_ObjectSpec_Alloc(virConnectPtr conn, esxVI_ObjectSpec **objectSpec);
+int esxVI_ObjectSpec_Alloc(esxVI_ObjectSpec **objectSpec);
 void esxVI_ObjectSpec_Free(esxVI_ObjectSpec **objectSpecList);
-int esxVI_ObjectSpec_AppendToList(virConnectPtr conn,
-                                  esxVI_ObjectSpec **objectSpecList,
+int esxVI_ObjectSpec_AppendToList(esxVI_ObjectSpec **objectSpecList,
                                   esxVI_ObjectSpec *objectSpec);
-int esxVI_ObjectSpec_Serialize(virConnectPtr conn,
-                               esxVI_ObjectSpec *objectSpec,
+int esxVI_ObjectSpec_Serialize(esxVI_ObjectSpec *objectSpec,
                                const char *element, virBufferPtr output,
                                esxVI_Boolean required);
-int esxVI_ObjectSpec_SerializeList(virConnectPtr conn,
-                                   esxVI_ObjectSpec *objectSpecList,
+int esxVI_ObjectSpec_SerializeList(esxVI_ObjectSpec *objectSpecList,
                                    const char *element, virBufferPtr output,
                                    esxVI_Boolean required);
 
@@ -668,17 +609,15 @@ struct _esxVI_PropertyChange {
     esxVI_AnyType *val;                                    /* optional */
 };
 
-int esxVI_PropertyChange_Alloc(virConnectPtr conn,
-                               esxVI_PropertyChange **propertyChange);
+int esxVI_PropertyChange_Alloc(esxVI_PropertyChange **propertyChange);
 void esxVI_PropertyChange_Free(esxVI_PropertyChange **propertyChangeList);
 int esxVI_PropertyChange_AppendToList
-      (virConnectPtr conn, esxVI_PropertyChange **propertyChangeList,
+      (esxVI_PropertyChange **propertyChangeList,
        esxVI_PropertyChange *propertyChange);
-int esxVI_PropertyChange_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PropertyChange_Deserialize(xmlNodePtr node,
                                      esxVI_PropertyChange **propertyChange);
 int esxVI_PropertyChange_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PropertyChange **propertyChangeList);
+      (xmlNodePtr node, esxVI_PropertyChange **propertyChangeList);
 
 
 
@@ -694,18 +633,14 @@ struct _esxVI_PropertySpec {
     esxVI_String *pathSet;                                 /* optional, list */
 };
 
-int esxVI_PropertySpec_Alloc(virConnectPtr conn,
-                             esxVI_PropertySpec **propertySpec);
+int esxVI_PropertySpec_Alloc(esxVI_PropertySpec **propertySpec);
 void esxVI_PropertySpec_Free(esxVI_PropertySpec **propertySpecList);
-int esxVI_PropertySpec_AppendToList(virConnectPtr conn,
-                                    esxVI_PropertySpec **propertySpecList,
+int esxVI_PropertySpec_AppendToList(esxVI_PropertySpec **propertySpecList,
                                     esxVI_PropertySpec *propertySpec);
-int esxVI_PropertySpec_Serialize(virConnectPtr conn,
-                                 esxVI_PropertySpec *propertySpec,
+int esxVI_PropertySpec_Serialize(esxVI_PropertySpec *propertySpec,
                                  const char *element, virBufferPtr output,
                                  esxVI_Boolean required);
-int esxVI_PropertySpec_SerializeList(virConnectPtr conn,
-                                     esxVI_PropertySpec *propertySpecList,
+int esxVI_PropertySpec_SerializeList(esxVI_PropertySpec *propertySpecList,
                                      const char *element, virBufferPtr output,
                                      esxVI_Boolean required);
 
@@ -723,18 +658,18 @@ struct _esxVI_PropertyFilterSpec {
 };
 
 int esxVI_PropertyFilterSpec_Alloc
-      (virConnectPtr conn, esxVI_PropertyFilterSpec **propertyFilterSpec);
+      (esxVI_PropertyFilterSpec **propertyFilterSpec);
 void esxVI_PropertyFilterSpec_Free
        (esxVI_PropertyFilterSpec **propertyFilterSpecList);
 int esxVI_PropertyFilterSpec_AppendToList
-      (virConnectPtr conn, esxVI_PropertyFilterSpec **propertyFilterSpecList,
+      (esxVI_PropertyFilterSpec **propertyFilterSpecList,
        esxVI_PropertyFilterSpec *propertyFilterSpec);
 int esxVI_PropertyFilterSpec_Serialize
-      (virConnectPtr conn, esxVI_PropertyFilterSpec *propertyFilterSpec,
-       const char *element, virBufferPtr output, esxVI_Boolean required);
+      (esxVI_PropertyFilterSpec *propertyFilterSpec, const char *element,
+       virBufferPtr output, esxVI_Boolean required);
 int esxVI_PropertyFilterSpec_SerializeList
-      (virConnectPtr conn, esxVI_PropertyFilterSpec *propertyFilterSpecList,
-       const char *element, virBufferPtr output, esxVI_Boolean required);
+      (esxVI_PropertyFilterSpec *propertyFilterSpecList, const char *element,
+       virBufferPtr output, esxVI_Boolean required);
 
 
 
@@ -750,20 +685,16 @@ struct _esxVI_ObjectContent {
     /*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
 };
 
-int esxVI_ObjectContent_Alloc(virConnectPtr conn,
-                              esxVI_ObjectContent **objectContent);
+int esxVI_ObjectContent_Alloc(esxVI_ObjectContent **objectContent);
 void esxVI_ObjectContent_Free(esxVI_ObjectContent **objectContentList);
-int esxVI_ObjectContent_AppendToList(virConnectPtr conn,
-                                     esxVI_ObjectContent **objectContentList,
+int esxVI_ObjectContent_AppendToList(esxVI_ObjectContent **objectContentList,
                                      esxVI_ObjectContent *objectContent);
-int esxVI_ObjectContent_DeepCopy(virConnectPtr conn,
-                                 esxVI_ObjectContent **dest,
+int esxVI_ObjectContent_DeepCopy(esxVI_ObjectContent **dest,
                                  esxVI_ObjectContent *src);
-int esxVI_ObjectContent_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectContent_Deserialize(xmlNodePtr node,
                                     esxVI_ObjectContent **objectContent);
 int esxVI_ObjectContent_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_ObjectContent **objectContentList);
+      (xmlNodePtr node, esxVI_ObjectContent **objectContentList);
 
 
 
@@ -780,15 +711,13 @@ struct _esxVI_ObjectUpdate {
     /*esxVI_MissingProperty *missingSet; *//* optional, list *//* FIXME */
 };
 
-int esxVI_ObjectUpdate_Alloc(virConnectPtr conn,
-                             esxVI_ObjectUpdate **objectUpdate);
+int esxVI_ObjectUpdate_Alloc(esxVI_ObjectUpdate **objectUpdate);
 void esxVI_ObjectUpdate_Free(esxVI_ObjectUpdate **objectUpdateList);
-int esxVI_ObjectUpdate_AppendToList(virConnectPtr conn,
-                                    esxVI_ObjectUpdate **objectUpdateList,
+int esxVI_ObjectUpdate_AppendToList(esxVI_ObjectUpdate **objectUpdateList,
                                     esxVI_ObjectUpdate *objectUpdate);
-int esxVI_ObjectUpdate_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectUpdate_Deserialize(xmlNodePtr node,
                                    esxVI_ObjectUpdate **objectUpdate);
-int esxVI_ObjectUpdate_DeserializeList(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ObjectUpdate_DeserializeList(xmlNodePtr node,
                                        esxVI_ObjectUpdate **objectUpdateList);
 
 
@@ -806,20 +735,16 @@ struct _esxVI_PropertyFilterUpdate {
 };
 
 int esxVI_PropertyFilterUpdate_Alloc
-      (virConnectPtr conn,
-       esxVI_PropertyFilterUpdate **propertyFilterUpdate);
+      (esxVI_PropertyFilterUpdate **propertyFilterUpdate);
 void esxVI_PropertyFilterUpdate_Free
        (esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
 int esxVI_PropertyFilterUpdate_AppendToList
-      (virConnectPtr conn,
-       esxVI_PropertyFilterUpdate **propertyFilterUpdateList,
+      (esxVI_PropertyFilterUpdate **propertyFilterUpdateList,
        esxVI_PropertyFilterUpdate *propertyFilterUpdate);
 int esxVI_PropertyFilterUpdate_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PropertyFilterUpdate **propertyFilterUpdate);
+      (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdate);
 int esxVI_PropertyFilterUpdate_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
+      (xmlNodePtr node, esxVI_PropertyFilterUpdate **propertyFilterUpdateList);
 
 
 
@@ -841,10 +766,9 @@ struct _esxVI_AboutInfo {
     char *apiVersion;                                      /* required */
 };
 
-int esxVI_AboutInfo_Alloc(virConnectPtr conn, esxVI_AboutInfo **aboutInfo);
+int esxVI_AboutInfo_Alloc(esxVI_AboutInfo **aboutInfo);
 void esxVI_AboutInfo_Free(esxVI_AboutInfo **aboutInfo);
-int esxVI_AboutInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                                esxVI_AboutInfo **aboutInfo);
+int esxVI_AboutInfo_Deserialize(xmlNodePtr node, esxVI_AboutInfo **aboutInfo);
 
 
 
@@ -878,10 +802,9 @@ struct _esxVI_ServiceContent {
     esxVI_ManagedObjectReference *virtualizationManager;   /* optional */
 };
 
-int esxVI_ServiceContent_Alloc(virConnectPtr conn,
-                               esxVI_ServiceContent **serviceContent);
+int esxVI_ServiceContent_Alloc(esxVI_ServiceContent **serviceContent);
 void esxVI_ServiceContent_Free(esxVI_ServiceContent **serviceContent);
-int esxVI_ServiceContent_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ServiceContent_Deserialize(xmlNodePtr node,
                                      esxVI_ServiceContent **serviceContent);
 
 
@@ -895,10 +818,9 @@ struct _esxVI_UpdateSet {
     esxVI_PropertyFilterUpdate *filterSet;                 /* optional, list */
 };
 
-int esxVI_UpdateSet_Alloc(virConnectPtr conn, esxVI_UpdateSet **updateSet);
+int esxVI_UpdateSet_Alloc(esxVI_UpdateSet **updateSet);
 void esxVI_UpdateSet_Free(esxVI_UpdateSet **updateSet);
-int esxVI_UpdateSet_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                                esxVI_UpdateSet **updateSet);
+int esxVI_UpdateSet_Deserialize(xmlNodePtr node, esxVI_UpdateSet **updateSet);
 
 
 
@@ -911,15 +833,13 @@ struct _esxVI_SharesInfo {
     esxVI_SharesLevel level;                               /* required */
 };
 
-int esxVI_SharesInfo_Alloc(virConnectPtr conn, esxVI_SharesInfo **sharesInfo);
+int esxVI_SharesInfo_Alloc(esxVI_SharesInfo **sharesInfo);
 void esxVI_SharesInfo_Free(esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_CastFromAnyType(virConnectPtr conn,
-                                     esxVI_AnyType *anyType,
+int esxVI_SharesInfo_CastFromAnyType(esxVI_AnyType *anyType,
                                      esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_SharesInfo_Deserialize(xmlNodePtr node,
                                  esxVI_SharesInfo **sharesInfo);
-int esxVI_SharesInfo_Serialize(virConnectPtr conn,
-                               esxVI_SharesInfo *sharesInfo,
+int esxVI_SharesInfo_Serialize(esxVI_SharesInfo *sharesInfo,
                                const char *element, virBufferPtr output,
                                esxVI_Boolean required);
 
@@ -938,12 +858,11 @@ struct _esxVI_ResourceAllocationInfo {
 };
 
 int esxVI_ResourceAllocationInfo_Alloc
-      (virConnectPtr conn,
-       esxVI_ResourceAllocationInfo **resourceAllocationInfo);
+      (esxVI_ResourceAllocationInfo **resourceAllocationInfo);
 void esxVI_ResourceAllocationInfo_Free
        (esxVI_ResourceAllocationInfo **resourceAllocationInfo);
 int esxVI_ResourceAllocationInfo_Serialize
-      (virConnectPtr conn, esxVI_ResourceAllocationInfo *resourceAllocationInfo,
+      (esxVI_ResourceAllocationInfo *resourceAllocationInfo,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 
 
@@ -962,15 +881,14 @@ struct _esxVI_ResourcePoolResourceUsage {
 };
 
 int esxVI_ResourcePoolResourceUsage_Alloc
-      (virConnectPtr conn,
-       esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
+      (esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
 void esxVI_ResourcePoolResourceUsage_Free
        (esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
 int esxVI_ResourcePoolResourceUsage_CastFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
+      (esxVI_AnyType *anyType,
        esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
 int esxVI_ResourcePoolResourceUsage_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
+      (xmlNodePtr node,
        esxVI_ResourcePoolResourceUsage **resourcePoolResourceUsage);
 
 
@@ -1013,13 +931,11 @@ struct _esxVI_VirtualMachineConfigSpec {
 };
 
 int esxVI_VirtualMachineConfigSpec_Alloc
-      (virConnectPtr conn,
-       esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
+      (esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
 void esxVI_VirtualMachineConfigSpec_Free
        (esxVI_VirtualMachineConfigSpec **virtualMachineConfigSpec);
 int esxVI_VirtualMachineConfigSpec_Serialize
-      (virConnectPtr conn,
-       esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec,
+      (esxVI_VirtualMachineConfigSpec *virtualMachineConfigSpec,
        const char *element, virBufferPtr output, esxVI_Boolean required);
 
 
@@ -1043,12 +959,10 @@ struct _esxVI_Event {
     char *fullFormattedMessage;                            /* optional */
 };
 
-int esxVI_Event_Alloc(virConnectPtr conn, esxVI_Event **event);
+int esxVI_Event_Alloc(esxVI_Event **event);
 void esxVI_Event_Free(esxVI_Event **eventList);
-int esxVI_Event_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                            esxVI_Event **event);
-int esxVI_Event_DeserializeList(virConnectPtr conn, xmlNodePtr node,
-                                esxVI_Event **eventList);
+int esxVI_Event_Deserialize(xmlNodePtr node, esxVI_Event **event);
+int esxVI_Event_DeserializeList(xmlNodePtr node, esxVI_Event **eventList);
 
 
 
@@ -1066,13 +980,11 @@ struct _esxVI_UserSession {
     char *messageLocale;                                   /* required */
 };
 
-int esxVI_UserSession_Alloc(virConnectPtr conn,
-                            esxVI_UserSession **userSession);
+int esxVI_UserSession_Alloc(esxVI_UserSession **userSession);
 void esxVI_UserSession_Free(esxVI_UserSession **userSession);
-int esxVI_UserSession_CastFromAnyType(virConnectPtr conn,
-                                      esxVI_AnyType *anyType,
+int esxVI_UserSession_CastFromAnyType(esxVI_AnyType *anyType,
                                       esxVI_UserSession **userSession);
-int esxVI_UserSession_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_UserSession_Deserialize(xmlNodePtr node,
                                   esxVI_UserSession **userSession);
 
 
@@ -1090,15 +1002,14 @@ struct _esxVI_VirtualMachineQuestionInfo {
 };
 
 int esxVI_VirtualMachineQuestionInfo_Alloc
-      (virConnectPtr conn,
-       esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
+      (esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
 void esxVI_VirtualMachineQuestionInfo_Free
        (esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
 int esxVI_VirtualMachineQuestionInfo_CastFromAnyType
-      (virConnectPtr conn, esxVI_AnyType *anyType,
+      (esxVI_AnyType *anyType,
        esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
 int esxVI_VirtualMachineQuestionInfo_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
+      (xmlNodePtr node,
        esxVI_VirtualMachineQuestionInfo **virtualMachineQuestionInfo);
 
 
@@ -1123,15 +1034,14 @@ struct _esxVI_ElementDescription {
 };
 
 int esxVI_ElementDescription_Alloc
-      (virConnectPtr conn, esxVI_ElementDescription **elementDescription);
+      (esxVI_ElementDescription **elementDescription);
 void esxVI_ElementDescription_Free
        (esxVI_ElementDescription **elementDescription);
 int esxVI_ElementDescription_AppendToList
-      (virConnectPtr conn, esxVI_ElementDescription **elementDescriptionList,
+      (esxVI_ElementDescription **elementDescriptionList,
        esxVI_ElementDescription *elementDescription);
 int esxVI_ElementDescription_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_ElementDescription **elementDescription);
+      (xmlNodePtr node, esxVI_ElementDescription **elementDescription);
 
 
 
@@ -1152,10 +1062,9 @@ struct _esxVI_ChoiceOption {
     esxVI_Int *defaultIndex;                               /* optional */
 };
 
-int esxVI_ChoiceOption_Alloc(virConnectPtr conn,
-                             esxVI_ChoiceOption **choiceOption);
+int esxVI_ChoiceOption_Alloc(esxVI_ChoiceOption **choiceOption);
 void esxVI_ChoiceOption_Free(esxVI_ChoiceOption **choiceOption);
-int esxVI_ChoiceOption_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_ChoiceOption_Deserialize(xmlNodePtr node,
                                    esxVI_ChoiceOption **choiceOption);
 
 
@@ -1171,20 +1080,17 @@ struct _esxVI_PerfMetricId {
     char *instance;                                        /* required */
 };
 
-int esxVI_PerfMetricId_Alloc(virConnectPtr conn,
-                             esxVI_PerfMetricId **perfMetricId);
+int esxVI_PerfMetricId_Alloc(esxVI_PerfMetricId **perfMetricId);
 void esxVI_PerfMetricId_Free(esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_Serialize(virConnectPtr conn,
-                                 esxVI_PerfMetricId *perfMetricId,
+int esxVI_PerfMetricId_Serialize(esxVI_PerfMetricId *perfMetricId,
                                  const char *element, virBufferPtr output,
                                  esxVI_Boolean required);
-int esxVI_PerfMetricId_SerializeList(virConnectPtr conn,
-                                     esxVI_PerfMetricId *perfMetricIdList,
+int esxVI_PerfMetricId_SerializeList(esxVI_PerfMetricId *perfMetricIdList,
                                      const char *element, virBufferPtr output,
                                      esxVI_Boolean required);
-int esxVI_PerfMetricId_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfMetricId_Deserialize(xmlNodePtr node,
                                    esxVI_PerfMetricId **perfMetricId);
-int esxVI_PerfMetricId_DeserializeList(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfMetricId_DeserializeList(xmlNodePtr node,
                                        esxVI_PerfMetricId **perfMetricIdList);
 
 
@@ -1206,14 +1112,12 @@ struct _esxVI_PerfCounterInfo {
     esxVI_Int *associatedCounterId;                        /* optional, list */
 };
 
-int esxVI_PerfCounterInfo_Alloc(virConnectPtr conn,
-                                esxVI_PerfCounterInfo **perfCounterInfo);
+int esxVI_PerfCounterInfo_Alloc(esxVI_PerfCounterInfo **perfCounterInfo);
 void esxVI_PerfCounterInfo_Free(esxVI_PerfCounterInfo **perfCounterInfo);
-int esxVI_PerfCounterInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfCounterInfo_Deserialize(xmlNodePtr node,
                                       esxVI_PerfCounterInfo **perfCounterInfo);
 int esxVI_PerfCounterInfo_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PerfCounterInfo **perfCounterInfoList);
+      (xmlNodePtr node, esxVI_PerfCounterInfo **perfCounterInfoList);
 
 
 
@@ -1233,15 +1137,12 @@ struct _esxVI_PerfQuerySpec {
     char *format;                                          /* optional */ // FIXME: see PerfFormat
 };
 
-int esxVI_PerfQuerySpec_Alloc(virConnectPtr conn,
-                              esxVI_PerfQuerySpec **perfQuerySpec);
+int esxVI_PerfQuerySpec_Alloc(esxVI_PerfQuerySpec **perfQuerySpec);
 void esxVI_PerfQuerySpec_Free(esxVI_PerfQuerySpec **perfQuerySpec);
-int esxVI_PerfQuerySpec_Serialize(virConnectPtr conn,
-                                  esxVI_PerfQuerySpec *perfQuerySpec,
+int esxVI_PerfQuerySpec_Serialize(esxVI_PerfQuerySpec *perfQuerySpec,
                                   const char *element, virBufferPtr output,
                                   esxVI_Boolean required);
-int esxVI_PerfQuerySpec_SerializeList(virConnectPtr conn,
-                                      esxVI_PerfQuerySpec *perfQuerySpecList,
+int esxVI_PerfQuerySpec_SerializeList(esxVI_PerfQuerySpec *perfQuerySpecList,
                                       const char *element, virBufferPtr output,
                                       esxVI_Boolean required);
 
@@ -1258,17 +1159,14 @@ struct _esxVI_PerfSampleInfo {
     esxVI_Int *interval;                                   /* required */
 };
 
-int esxVI_PerfSampleInfo_Alloc(virConnectPtr conn,
-                               esxVI_PerfSampleInfo **perfSampleInfo);
+int esxVI_PerfSampleInfo_Alloc(esxVI_PerfSampleInfo **perfSampleInfo);
 void esxVI_PerfSampleInfo_Free(esxVI_PerfSampleInfo **perfSampleInfo);
-int esxVI_PerfSampleInfo_AppendToList(virConnectPtr conn,
-                                      esxVI_PerfSampleInfo **perfSampleInfoList,
+int esxVI_PerfSampleInfo_AppendToList(esxVI_PerfSampleInfo **perfSampleInfoList,
                                       esxVI_PerfSampleInfo *perfSampleInfo);
-int esxVI_PerfSampleInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
+int esxVI_PerfSampleInfo_Deserialize(xmlNodePtr node,
                                      esxVI_PerfSampleInfo **perfSampleInfo);
 int esxVI_PerfSampleInfo_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PerfSampleInfo **perfSampleInfoList);
+      (xmlNodePtr node, esxVI_PerfSampleInfo **perfSampleInfoList);
 
 
 
@@ -1292,15 +1190,14 @@ struct _esxVI_PerfMetricIntSeries {
 };
 
 int esxVI_PerfMetricIntSeries_Alloc
-      (virConnectPtr conn, esxVI_PerfMetricIntSeries **perfMetricIntSeries);
+      (esxVI_PerfMetricIntSeries **perfMetricIntSeries);
 void esxVI_PerfMetricIntSeries_Free
        (esxVI_PerfMetricIntSeries **perfMetricIntSeries);
 int esxVI_PerfMetricIntSeries_AppendToList
-      (virConnectPtr conn, esxVI_PerfMetricIntSeries **perfMetricIntSeriesList,
+      (esxVI_PerfMetricIntSeries **perfMetricIntSeriesList,
        esxVI_PerfMetricIntSeries *perfMetricIntSeries);
 int esxVI_PerfMetricIntSeries_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PerfMetricIntSeries **perfMetricIntSeries);
+      (xmlNodePtr node, esxVI_PerfMetricIntSeries **perfMetricIntSeries);
 
 
 
@@ -1328,16 +1225,13 @@ struct _esxVI_PerfEntityMetric {
     esxVI_PerfMetricIntSeries *value;                      /* optional, list */
 };
 
-int esxVI_PerfEntityMetric_Alloc(virConnectPtr conn,
-                                 esxVI_PerfEntityMetric **perfEntityMetric);
+int esxVI_PerfEntityMetric_Alloc(esxVI_PerfEntityMetric **perfEntityMetric);
 void esxVI_PerfEntityMetric_Free
        (esxVI_PerfEntityMetric **perfEntityMetric);
 int esxVI_PerfEntityMetric_Deserialize
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PerfEntityMetric **perfEntityMetric);
+      (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetric);
 int esxVI_PerfEntityMetric_DeserializeList
-      (virConnectPtr conn, xmlNodePtr node,
-       esxVI_PerfEntityMetric **perfEntityMetricList);
+      (xmlNodePtr node, esxVI_PerfEntityMetric **perfEntityMetricList);
 
 
 
@@ -1368,14 +1262,12 @@ struct _esxVI_TaskInfo {
     esxVI_Int *eventChainId;                               /* required */
 };
 
-int esxVI_TaskInfo_Alloc(virConnectPtr conn, esxVI_TaskInfo **taskInfo);
+int esxVI_TaskInfo_Alloc(esxVI_TaskInfo **taskInfo);
 void esxVI_TaskInfo_Free(esxVI_TaskInfo **taskInfoList);
-int esxVI_TaskInfo_CastFromAnyType(virConnectPtr conn, esxVI_AnyType *anyType,
+int esxVI_TaskInfo_CastFromAnyType(esxVI_AnyType *anyType,
                                    esxVI_TaskInfo **taskInfo);
-int esxVI_TaskInfo_AppendToList(virConnectPtr conn,
-                                esxVI_TaskInfo **taskInfoList,
+int esxVI_TaskInfo_AppendToList(esxVI_TaskInfo **taskInfoList,
                                 esxVI_TaskInfo *taskInfo);
-int esxVI_TaskInfo_Deserialize(virConnectPtr conn, xmlNodePtr node,
-                               esxVI_TaskInfo **taskInfo);
+int esxVI_TaskInfo_Deserialize(xmlNodePtr node, esxVI_TaskInfo **taskInfo);
 
 #endif /* __ESX_VI_TYPES_H__ */
index 52041428fa19b6a3161e0e974b9ad90e1092bb9a..8a6496d80b6c601909b539c21a972289a8adaaf7 100644 (file)
@@ -420,8 +420,8 @@ def->parallels[0]...
 
 #define VIR_FROM_THIS VIR_FROM_ESX
 
-#define ESX_ERROR(conn, code, fmt...)                                         \
-    virReportErrorHelper(conn, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
+#define ESX_ERROR(code, fmt...)                                               \
+    virReportErrorHelper(NULL, VIR_FROM_ESX, code, __FILE__, __FUNCTION__,    \
                          __LINE__, fmt)
 
 
@@ -432,13 +432,12 @@ def->parallels[0]...
 
 
 int
-esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
-                                     int *controller, int *id)
+esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id)
 {
     int idx;
 
     if (! STRPREFIX(name, "sd")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'dev' of entry "
                   "'devices/disk/target' to start with 'sd'");
         return -1;
@@ -447,14 +446,14 @@ esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
     idx = virDiskNameToIndex(name);
 
     if (idx < 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not parse valid disk index from '%s'", name);
         return -1;
     }
 
     /* Each of the 4 SCSI controllers offers 15 IDs for devices */
     if (idx >= (4 * 15)) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "SCSI disk index (parsed from '%s') is too large", name);
         return -1;
     }
@@ -473,13 +472,12 @@ esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
 
 
 int
-esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
-                                    int *controller, int *id)
+esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id)
 {
     int idx;
 
     if (! STRPREFIX(name, "hd")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'dev' of entry "
                   "'devices/disk/target' to start with 'hd'");
         return -1;
@@ -488,14 +486,14 @@ esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
     idx = virDiskNameToIndex(name);
 
     if (idx < 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not parse valid disk index from '%s'", name);
         return -1;
     }
 
     /* Each of the 2 IDE controllers offers 2 IDs for devices */
     if (idx >= (2 * 2)) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "IDE disk index (parsed from '%s') is too large", name);
         return -1;
     }
@@ -509,13 +507,12 @@ esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
 
 
 int
-esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
-                                  int *controller)
+esxVMX_FloppyDiskNameToController(const char *name, int *controller)
 {
     int idx;
 
     if (! STRPREFIX(name, "fd")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'dev' of entry "
                   "'devices/disk/target' to start with 'fd'");
         return -1;
@@ -524,13 +521,13 @@ esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
     idx = virDiskNameToIndex(name);
 
     if (idx < 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Could not parse valid disk index from '%s'", name);
         return -1;
     }
 
     if (idx >= 2) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Floppy disk index (parsed from '%s') is too large", name);
         return -1;
     }
@@ -543,8 +540,8 @@ esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
 
 
 int
-esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr def,
-                             char *virtualDev[4], int present[4])
+esxVMX_GatherSCSIControllers(virDomainDefPtr def, char *virtualDev[4],
+                             int present[4])
 {
     virDomainDiskDefPtr disk;
     int i, controller, id;
@@ -560,15 +557,15 @@ esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr def,
         if (disk->driverName != NULL &&
             STRCASENEQ(disk->driverName, "buslogic") &&
             STRCASENEQ(disk->driverName, "lsilogic")) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting domain XML entry 'devices/disk/target' to be "
                       "'buslogic' or 'lsilogic' but found '%s'",
                       disk->driverName);
             return -1;
         }
 
-        if (esxVMX_SCSIDiskNameToControllerAndID(conn, disk->dst,
-                                                 &controller, &id) < 0) {
+        if (esxVMX_SCSIDiskNameToControllerAndID(disk->dst, &controller,
+                                                 &id) < 0) {
             return -1;
         }
 
@@ -577,7 +574,7 @@ esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr def,
         if (virtualDev[controller] == NULL) {
             virtualDev[controller] = disk->driverName;
         } else if (STRCASENEQ(virtualDev[controller], disk->driverName)) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Inconsistent driver usage ('%s' is not '%s') on SCSI "
                       "controller index %d", virtualDev[controller],
                       disk->driverName, controller);
@@ -591,8 +588,7 @@ esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr def,
 
 
 char *
-esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
-                                          esxVI_Context *ctx,
+esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
                                           const char *absolutePath)
 {
     char *datastoreRelatedPath = NULL;
@@ -604,14 +600,14 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
 
     if (sscanf(absolutePath, "/vmfs/volumes/%a[^/]/%a[^\n]",
                &preliminaryDatastoreName, &directoryAndFileName) != 2) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Absolute path '%s' doesn't have expected format "
                   "'/vmfs/volumes/<datastore>/<path>'", absolutePath);
         goto failure;
     }
 
     if (ctx != NULL) {
-        if (esxVI_LookupDatastoreByName(conn, ctx, preliminaryDatastoreName,
+        if (esxVI_LookupDatastoreByName(ctx, preliminaryDatastoreName,
                                         NULL, &datastore,
                                         esxVI_Occurrence_OptionalItem) < 0) {
             goto failure;
@@ -623,7 +619,7 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
                 if (STREQ(dynamicProperty->name, "summary.accessible")) {
                     /* Ignore it */
                 } else if (STREQ(dynamicProperty->name, "summary.name")) {
-                    if (esxVI_AnyType_ExpectType(conn, dynamicProperty->val,
+                    if (esxVI_AnyType_ExpectType(dynamicProperty->val,
                                                  esxVI_Type_String) < 0) {
                         goto failure;
                     }
@@ -651,7 +647,7 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
 
     if (virAsprintf(&datastoreRelatedPath, "[%s] %s", datastoreName,
                     directoryAndFileName) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -677,21 +673,20 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
  */
 
 char *
-esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
-                     const char *fileName, const char *datastoreName,
-                     const char *directoryName)
+esxVMX_ParseFileName(esxVI_Context *ctx, const char *fileName,
+                     const char *datastoreName, const char *directoryName)
 {
     char *src = NULL;
 
     if (STRPREFIX(fileName, "/vmfs/volumes/")) {
         /* Found absolute path referencing a file inside a datastore */
-        return esxVMX_AbsolutePathToDatastoreRelatedPath(conn, ctx, fileName);
+        return esxVMX_AbsolutePathToDatastoreRelatedPath(ctx, fileName);
     } else if (STRPREFIX(fileName, "/")) {
         /* Found absolute path referencing a file outside a datastore */
         src = strdup(fileName);
 
         if (src == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             return NULL;
         }
 
@@ -700,7 +695,7 @@ esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
         return src;
     } else if (strchr(fileName, '/') != NULL) {
         /* Found relative path, this is not supported */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Found relative path '%s' in VMX file, this is not "
                   "supported", fileName);
         return NULL;
@@ -708,7 +703,7 @@ esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
         /* Found single file name referencing a file inside a datastore */
         if (virAsprintf(&src, "[%s] %s/%s", datastoreName, directoryName,
                         fileName) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             return NULL;
         }
 
@@ -721,7 +716,7 @@ esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
 
 
 virDomainDefPtr
-esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
+esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
                    const char *datastoreName, const char *directoryName,
                    esxVI_APIVersion apiVersion)
 {
@@ -747,7 +742,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     }
 
     if (VIR_ALLOC(def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -755,28 +750,28 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     def->id = -1;
 
     /* vmx:config.version */
-    if (esxUtil_GetConfigLong(conn, conf, "config.version",
-                              &config_version, 0, 0) < 0) {
+    if (esxUtil_GetConfigLong(conf, "config.version", &config_version, 0,
+                              0) < 0) {
         goto failure;
     }
 
     if (config_version != 8) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry 'config.version' to be 8 but found "
                   "%lld", config_version);
         goto failure;
     }
 
     /* vmx:virtualHW.version */
-    if (esxUtil_GetConfigLong(conn, conf, "virtualHW.version",
-                              &virtualHW_version, 0, 0) < 0) {
+    if (esxUtil_GetConfigLong(conf, "virtualHW.version", &virtualHW_version, 0,
+                              0) < 0) {
         goto failure;
     }
 
     switch (apiVersion) {
       case esxVI_APIVersion_25:
         if (virtualHW_version != 4) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting VMX entry 'virtualHW.version' to be 4 for "
                       "VI API version 2.5 but found %lld", virtualHW_version);
             goto failure;
@@ -786,7 +781,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
       case esxVI_APIVersion_40:
         if (virtualHW_version != 4 && virtualHW_version != 7) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting VMX entry 'virtualHW.version' to be 4 or 7 for "
                       "VI API version 4.0 but found %lld", virtualHW_version);
             goto failure;
@@ -796,7 +791,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
       case esxVI_APIVersion_Unknown:
         if (virtualHW_version != 4 && virtualHW_version != 7) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting VMX entry 'virtualHW.version' to be 4 or 7 "
                       "but found %lld", virtualHW_version);
             goto failure;
@@ -805,30 +800,29 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
         break;
 
       default:
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VI API version 2.5 or 4.0");
         goto failure;
     }
 
     /* vmx:uuid.bios -> def:uuid */
     /* FIXME: Need to handle 'uuid.action = "create"' */
-    if (esxUtil_GetConfigUUID(conn, conf, "uuid.bios", def->uuid, 1) < 0) {
+    if (esxUtil_GetConfigUUID(conf, "uuid.bios", def->uuid, 1) < 0) {
         goto failure;
     }
 
     /* vmx:displayName -> def:name */
-    if (esxUtil_GetConfigString(conn, conf, "displayName",
-                                &def->name, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, "displayName", &def->name, 1) < 0) {
         goto failure;
     }
 
     /* vmx:memsize -> def:maxmem */
-    if (esxUtil_GetConfigLong(conn, conf, "memsize", &memsize, 32, 1) < 0) {
+    if (esxUtil_GetConfigLong(conf, "memsize", &memsize, 32, 1) < 0) {
         goto failure;
     }
 
     if (memsize <= 0 || memsize % 4 != 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry 'memsize' to be an unsigned "
                   "integer (multiple of 4) but found %lld", memsize);
         goto failure;
@@ -837,8 +831,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     def->maxmem = memsize * 1024; /* Scale from megabytes to kilobytes */
 
     /* vmx:sched.mem.max -> def:memory */
-    if (esxUtil_GetConfigLong(conn, conf, "sched.mem.max", &memory,
-                              memsize, 1) < 0) {
+    if (esxUtil_GetConfigLong(conf, "sched.mem.max", &memory, memsize, 1) < 0) {
         goto failure;
     }
 
@@ -853,12 +846,12 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     }
 
     /* vmx:numvcpus -> def:vcpus */
-    if (esxUtil_GetConfigLong(conn, conf, "numvcpus", &numvcpus, 1, 1) < 0) {
+    if (esxUtil_GetConfigLong(conf, "numvcpus", &numvcpus, 1, 1) < 0) {
         goto failure;
     }
 
     if (numvcpus <= 0 || (numvcpus % 2 != 0 && numvcpus != 1)) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry 'numvcpus' to be an unsigned "
                   "integer (1 or a multiple of 2) but found %lld", numvcpus);
         goto failure;
@@ -868,8 +861,8 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* vmx:sched.cpu.affinity -> def:cpumask */
     // VirtualMachine:config.cpuAffinity.affinitySet
-    if (esxUtil_GetConfigString(conn, conf, "sched.cpu.affinity",
-                                &sched_cpu_affinity, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, "sched.cpu.affinity", &sched_cpu_affinity,
+                                1) < 0) {
         goto failure;
     }
 
@@ -880,7 +873,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
         def->cpumasklen = 0;
 
         if (VIR_ALLOC_N(def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
 
@@ -890,7 +883,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
             number = virParseNumber(&current);
 
             if (number < 0) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Expecting VMX entry 'sched.cpu.affinity' to be "
                           "a comma separated list of unsigned integers but "
                           "found '%s'", sched_cpu_affinity);
@@ -898,7 +891,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
             }
 
             if (number >= VIR_DOMAIN_CPUMASK_LEN) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "VMX entry 'sched.cpu.affinity' contains a %d, this "
                           "value is too large", number);
                 goto failure;
@@ -918,7 +911,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
             } else if (*current == '\0') {
                 break;
             } else {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Expecting VMX entry 'sched.cpu.affinity' to be "
                           "a comma separated list of unsigned integers but "
                           "found '%s'", sched_cpu_affinity);
@@ -929,7 +922,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
         }
 
         if (count < numvcpus) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting VMX entry 'sched.cpu.affinity' to contain "
                       "at least as many values as 'numvcpus' (%lld) but "
                       "found only %d value(s)", numvcpus, count);
@@ -946,12 +939,12 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     def->os.type = strdup("hvm");
 
     if (def->os.type == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     /* vmx:guestOS -> def:os.arch */
-    if (esxUtil_GetConfigString(conn, conf, "guestOS", &guestOS, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, "guestOS", &guestOS, 1) < 0) {
         goto failure;
     }
 
@@ -962,7 +955,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     }
 
     if (def->os.arch == NULL) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -975,13 +968,13 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:graphics */
     if (VIR_ALLOC_N(def->graphics, 1) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     def->ngraphics = 0;
 
-    if (esxVMX_ParseVNC(conn, conf, &def->graphics[def->ngraphics]) < 0) {
+    if (esxVMX_ParseVNC(conf, &def->graphics[def->ngraphics]) < 0) {
         goto failure;
     }
 
@@ -991,7 +984,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:disks: 4 * 15 scsi + 2 * 2 ide + 2 floppy = 66 */
     if (VIR_ALLOC_N(def->disks, 66) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -1001,8 +994,8 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     for (controller = 0; controller < 4; ++controller) {
         VIR_FREE(scsi_virtualDev);
 
-        if (esxVMX_ParseSCSIController(conn, conf, controller,
-                                       &present, &scsi_virtualDev) < 0) {
+        if (esxVMX_ParseSCSIController(conf, controller, &present,
+                                       &scsi_virtualDev) < 0) {
             goto failure;
         }
 
@@ -1019,7 +1012,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
                 continue;
             }
 
-            if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+            if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
                                  VIR_DOMAIN_DISK_BUS_SCSI, controller, id,
                                  scsi_virtualDev, datastoreName, directoryName,
                                  &def->disks[def->ndisks]) < 0) {
@@ -1031,7 +1024,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
                 continue;
             }
 
-            if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+            if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
                                  VIR_DOMAIN_DISK_BUS_SCSI, controller, id,
                                  scsi_virtualDev, datastoreName, directoryName,
                                  &def->disks[def->ndisks]) < 0) {
@@ -1047,7 +1040,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
     /* def:disks (ide) */
     for (controller = 0; controller < 2; ++controller) {
         for (id = 0; id < 2; ++id) {
-            if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
+            if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_DISK,
                                  VIR_DOMAIN_DISK_BUS_IDE, controller, id,
                                  NULL, datastoreName, directoryName,
                                  &def->disks[def->ndisks]) < 0) {
@@ -1059,7 +1052,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
                 continue;
             }
 
-            if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
+            if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_CDROM,
                                  VIR_DOMAIN_DISK_BUS_IDE, controller, id,
                                  NULL, datastoreName, directoryName,
                                  &def->disks[def->ndisks]) < 0) {
@@ -1074,7 +1067,7 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:disks (floppy) */
     for (controller = 0; controller < 2; ++controller) {
-        if (esxVMX_ParseDisk(conn, ctx, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
+        if (esxVMX_ParseDisk(ctx, conf, VIR_DOMAIN_DISK_DEVICE_FLOPPY,
                              VIR_DOMAIN_DISK_BUS_FDC, controller, -1, NULL,
                              datastoreName, directoryName,
                              &def->disks[def->ndisks]) < 0) {
@@ -1091,14 +1084,14 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:nets */
     if (VIR_ALLOC_N(def->nets, 4) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     def->nnets = 0;
 
     for (controller = 0; controller < 4; ++controller) {
-        if (esxVMX_ParseEthernet(conn, conf, controller,
+        if (esxVMX_ParseEthernet(conf, controller,
                                  &def->nets[def->nnets]) < 0) {
             goto failure;
         }
@@ -1119,15 +1112,15 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:serials */
     if (VIR_ALLOC_N(def->serials, 4) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     def->nserials = 0;
 
     for (port = 0; port < 4; ++port) {
-        if (esxVMX_ParseSerial(conn, ctx, conf, port,
-                               datastoreName, directoryName,
+        if (esxVMX_ParseSerial(ctx, conf, port, datastoreName,
+                               directoryName,
                                &def->serials[def->nserials]) < 0) {
             goto failure;
         }
@@ -1139,15 +1132,15 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
     /* def:parallels */
     if (VIR_ALLOC_N(def->parallels, 3) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     def->nparallels = 0;
 
     for (port = 0; port < 3; ++port) {
-        if (esxVMX_ParseParallel(conn, ctx, conf, port,
-                                 datastoreName, directoryName,
+        if (esxVMX_ParseParallel(ctx, conf, port, datastoreName,
+                                 directoryName,
                                  &def->parallels[def->nparallels]) < 0) {
             goto failure;
         }
@@ -1175,18 +1168,18 @@ esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
 
 
 int
-esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *def)
+esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
 {
     int enabled = 0; // boolean
     long long port = 0;
 
     if (def == NULL || *def != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxUtil_GetConfigBoolean(conn, conf, "RemoteDisplay.vnc.enabled",
-                                 &enabled, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, "RemoteDisplay.vnc.enabled", &enabled,
+                                 0, 1) < 0) {
         return -1;
     }
 
@@ -1195,19 +1188,19 @@ esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *de
     }
 
     if (VIR_ALLOC(*def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
     (*def)->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
 
-    if (esxUtil_GetConfigLong(conn, conf, "RemoteDisplay.vnc.port",
-                              &port, -1, 1) < 0 ||
-        esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.ip",
+    if (esxUtil_GetConfigLong(conf, "RemoteDisplay.vnc.port", &port, -1,
+                               1) < 0 ||
+        esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.ip",
                                 &(*def)->data.vnc.listenAddr, 1) < 0 ||
-        esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.keymap",
+        esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.keymap",
                                 &(*def)->data.vnc.keymap, 1) < 0 ||
-        esxUtil_GetConfigString(conn, conf, "RemoteDisplay.vnc.password",
+        esxUtil_GetConfigString(conf, "RemoteDisplay.vnc.password",
                                 &(*def)->data.vnc.passwd, 1) < 0) {
         goto failure;
     }
@@ -1239,19 +1232,19 @@ esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *de
 
 
 int
-esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
-                           int *present, char **virtualDev)
+esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
+                           char **virtualDev)
 {
     char present_name[32];
     char virtualDev_name[32];
 
     if (virtualDev == NULL || *virtualDev != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (controller < 0 || controller > 3) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "SCSI controller index %d out of [0..3] range",
                   controller);
         return -1;
@@ -1261,7 +1254,7 @@ esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
     snprintf(virtualDev_name, sizeof(virtualDev_name), "scsi%d.virtualDev",
              controller);
 
-    if (esxUtil_GetConfigBoolean(conn, conf, present_name, present, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, present_name, present, 0, 1) < 0) {
         goto failure;
     }
 
@@ -1269,15 +1262,14 @@ esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf, int controller,
         return 0;
     }
 
-    if (esxUtil_GetConfigString(conn, conf, virtualDev_name,
-                                virtualDev, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, virtualDev_name, virtualDev, 1) < 0) {
         goto failure;
     }
 
     if (*virtualDev != NULL &&
         STRCASENEQ(*virtualDev, "buslogic") &&
         STRCASENEQ(*virtualDev, "lsilogic")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
                   "but found '%s'", virtualDev_name, *virtualDev);
         goto failure;
@@ -1309,10 +1301,10 @@ struct _virDomainDiskDef {
 };*/
 
 int
-esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                 int device, int bus, int controller, int id,
-                 const char *virtualDev, const char *datastoreName,
-                 const char *directoryName, virDomainDiskDefPtr *def)
+esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
+                 int controller, int id, const char *virtualDev,
+                 const char *datastoreName, const char *directoryName,
+                 virDomainDiskDefPtr *def)
 {
     /*
      *     device = {VIR_DOMAIN_DISK_DEVICE_DISK, VIR_DOMAIN_DISK_DEVICE_CDROM}
@@ -1359,12 +1351,12 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     int writeThrough = 0;
 
     if (def == NULL || *def != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -1376,20 +1368,20 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
         device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
         if (bus == VIR_DOMAIN_DISK_BUS_SCSI) {
             if (controller < 0 || controller > 3) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "SCSI controller index %d out of [0..3] range",
                           controller);
                 goto failure;
             }
 
             if (id < 0 || id > 15 || id == 7) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "SCSI ID %d out of [0..6,8..15] range", id);
                 goto failure;
             }
 
             if (virAsprintf(&prefix, "scsi%d:%d", controller, id) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
 
@@ -1405,26 +1397,26 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                 (*def)->driverName = strdup(virtualDev);
 
                 if ((*def)->driverName == NULL) {
-                    virReportOOMError(conn);
+                    virReportOOMError(NULL);
                     goto failure;
                 }
             }
         } else if (bus == VIR_DOMAIN_DISK_BUS_IDE) {
             if (controller < 0 || controller > 1) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "IDE controller index %d out of [0..1] range",
                           controller);
                 goto failure;
             }
 
             if (id < 0 || id > 1) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "IDE ID %d out of [0..1] range", id);
                 goto failure;
             }
 
             if (virAsprintf(&prefix, "ide%d:%d", controller, id) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
 
@@ -1434,7 +1426,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                 goto failure;
             }
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Unsupported bus type '%s' for device type '%s'",
                       virDomainDiskBusTypeToString(bus),
                       virDomainDiskDeviceTypeToString(device));
@@ -1443,14 +1435,14 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     } else if (device == VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
         if (bus == VIR_DOMAIN_DISK_BUS_FDC) {
             if (controller < 0 || controller > 1) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Floppy controller index %d out of [0..1] range",
                           controller);
                 goto failure;
             }
 
             if (virAsprintf(&prefix, "floppy%d", controller) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
 
@@ -1460,14 +1452,14 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
                 goto failure;
             }
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Unsupported bus type '%s' for device type '%s'",
                       virDomainDiskBusTypeToString(bus),
                       virDomainDiskDeviceTypeToString(device));
             goto failure;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Unsupported device type '%s'",
                   virDomainDiskDeviceTypeToString(device));
         goto failure;
@@ -1482,14 +1474,13 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     ESX_BUILD_VMX_NAME(writeThrough);
 
     /* vmx:present */
-    if (esxUtil_GetConfigBoolean(conn, conf, present_name,
-                                 &present, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
         goto failure;
     }
 
     /* vmx:startConnected */
-    if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
-                                 &startConnected, 1, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected,
+                                 1, 1) < 0) {
         goto failure;
     }
 
@@ -1499,14 +1490,13 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     }
 
     /* vmx:deviceType -> def:type */
-    if (esxUtil_GetConfigString(conn, conf, deviceType_name,
-                                &deviceType, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, deviceType_name, &deviceType, 1) < 0) {
         goto failure;
     }
 
     /* vmx:clientDevice */
-    if (esxUtil_GetConfigBoolean(conn, conf, clientDevice_name,
-                                 &clientDevice, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, clientDevice_name, &clientDevice, 0,
+                                 1) < 0) {
         goto failure;
     }
 
@@ -1519,19 +1509,18 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     }
 
     /* vmx:fileType -> def:type */
-    if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 1) < 0) {
         goto failure;
     }
 
     /* vmx:fileName -> def:src, def:type */
-    if (esxUtil_GetConfigString(conn, conf, fileName_name,
-                                &fileName, 0) < 0) {
+    if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
         goto failure;
     }
 
     /* vmx:writeThrough -> def:cachemode */
-    if (esxUtil_GetConfigBoolean(conn, conf, writeThrough_name,
-                                 &writeThrough, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, writeThrough_name, &writeThrough, 0,
+                                 1) < 0) {
         goto failure;
     }
 
@@ -1541,13 +1530,13 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
             if (deviceType != NULL) {
                 if (bus == VIR_DOMAIN_DISK_BUS_SCSI &&
                     STRCASENEQ(deviceType, "scsi-hardDisk")) {
-                    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                               "Expecting VMX entry '%s' to be 'scsi-hardDisk' "
                               "but found '%s'", deviceType_name, deviceType);
                     goto failure;
                 } else if (bus == VIR_DOMAIN_DISK_BUS_IDE &&
                            STRCASENEQ(deviceType, "ata-hardDisk")) {
-                    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                               "Expecting VMX entry '%s' to be 'ata-hardDisk' "
                               "but found '%s'", deviceType_name, deviceType);
                     goto failure;
@@ -1565,8 +1554,8 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
             }
 
             (*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
-            (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
-                                               datastoreName, directoryName);
+            (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+                                               directoryName);
             (*def)->cachemode = writeThrough ? VIR_DOMAIN_DISK_CACHE_WRITETHRU
                                              : VIR_DOMAIN_DISK_CACHE_DEFAULT;
 
@@ -1583,7 +1572,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
              */
             goto ignore;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Invalid or not yet handled value '%s' for VMX entry "
                       "'%s'", fileName, fileName_name);
             goto failure;
@@ -1592,7 +1581,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
         if (virFileHasSuffix(fileName, ".iso")) {
             if (deviceType != NULL) {
                 if (STRCASENEQ(deviceType, "cdrom-image")) {
-                    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                               "Expecting VMX entry '%s' to be 'cdrom-image' "
                               "but found '%s'", deviceType_name, deviceType);
                     goto failure;
@@ -1600,8 +1589,8 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
             }
 
             (*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
-            (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
-                                               datastoreName, directoryName);
+            (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+                                               directoryName);
 
             if ((*def)->src == NULL) {
                 goto failure;
@@ -1620,7 +1609,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
 
             fileName = NULL;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Invalid or not yet handled value '%s' for VMX entry "
                       "'%s'", fileName, fileName_name);
             goto failure;
@@ -1629,7 +1618,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
         if (virFileHasSuffix(fileName, ".flp")) {
             if (fileType != NULL) {
                 if (STRCASENEQ(fileType, "file")) {
-                    ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                    ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                               "Expecting VMX entry '%s' to be 'file' but "
                               "found '%s'", fileType_name, fileType);
                     goto failure;
@@ -1637,8 +1626,8 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
             }
 
             (*def)->type = VIR_DOMAIN_DISK_TYPE_FILE;
-            (*def)->src = esxVMX_ParseFileName(conn, ctx, fileName,
-                                               datastoreName, directoryName);
+            (*def)->src = esxVMX_ParseFileName(ctx, fileName, datastoreName,
+                                               directoryName);
 
             if ((*def)->src == NULL) {
                 goto failure;
@@ -1649,14 +1638,13 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
 
             fileName = NULL;
         } else {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Invalid or not yet handled value '%s' for VMX entry "
                       "'%s'", fileName, fileName_name);
             goto failure;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                  "Unsupported device type '%s'",
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported device type '%s'",
                   virDomainDiskDeviceTypeToString(device));
         goto failure;
     }
@@ -1682,8 +1670,7 @@ esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
 
 
 int
-esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
-                     virDomainNetDefPtr *def)
+esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def)
 {
     int result = 0;
     char prefix[48] = "";
@@ -1716,19 +1703,19 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
     char *networkName = NULL;
 
     if (def == NULL || *def != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (controller < 0 || controller > 3) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Ethernet controller index %d out of [0..3] range",
                   controller);
         return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -1745,14 +1732,13 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
     ESX_BUILD_VMX_NAME(vnet);
 
     /* vmx:present */
-    if (esxUtil_GetConfigBoolean(conn, conf, present_name,
-                                 &present, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
         goto failure;
     }
 
     /* vmx:startConnected */
-    if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
-                                 &startConnected, 1, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+                                 1) < 0) {
         goto failure;
     }
 
@@ -1762,17 +1748,16 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
     }
 
     /* vmx:connectionType -> def:type */
-    if (esxUtil_GetConfigString(conn, conf, connectionType_name,
-                                &connectionType, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, connectionType_name, &connectionType,
+                                1) < 0) {
         goto failure;
     }
 
     /* vmx:addressType, vmx:generatedAddress, vmx:address -> def:mac */
-    if (esxUtil_GetConfigString(conn, conf, addressType_name,
-                                &addressType, 1) < 0 ||
-        esxUtil_GetConfigString(conn, conf, generatedAddress_name,
-                                &generatedAddress, 1) < 0 ||
-        esxUtil_GetConfigString(conn, conf, address_name, &address, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, addressType_name, &addressType, 1) < 0 ||
+        esxUtil_GetConfigString(conf, generatedAddress_name, &generatedAddress,
+                                1) < 0 ||
+        esxUtil_GetConfigString(conf, address_name, &address, 1) < 0) {
         goto failure;
     }
 
@@ -1780,7 +1765,7 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
         STRCASEEQ(addressType, "vpx")) {
         if (generatedAddress != NULL) {
             if (virParseMacAddr(generatedAddress, (*def)->mac) < 0) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Expecting VMX entry '%s' to be MAC address but "
                           "found '%s'", generatedAddress_name,
                           generatedAddress);
@@ -1790,22 +1775,21 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
     } else if (STRCASEEQ(addressType, "static")) {
         if (address != NULL) {
             if (virParseMacAddr(address, (*def)->mac) < 0) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Expecting VMX entry '%s' to be MAC address but "
                           "found '%s'", address_name, address);
                 goto failure;
             }
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry '%s' to be 'generated' or 'static' or "
                   "'vpx' but found '%s'", addressType_name, addressType);
         goto failure;
     }
 
     /* vmx:virtualDev -> def:model */
-    if (esxUtil_GetConfigString(conn, conf, virtualDev_name,
-                                &virtualDev, 1) < 0) {
+    if (esxUtil_GetConfigString(conf, virtualDev_name, &virtualDev, 1) < 0) {
         goto failure;
     }
 
@@ -1814,7 +1798,7 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
         STRCASENEQ(virtualDev, "vmxnet") &&
         STRCASENEQ(virtualDev, "vmxnet3") &&
         STRCASENEQ(virtualDev, "e1000")) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry '%s' to be 'vlance' or 'vmxnet' or "
                   "'vmxnet3' or 'e1000' but found '%s'", virtualDev_name,
                   virtualDev);
@@ -1825,14 +1809,13 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
     if ((connectionType == NULL ||
          STRCASEEQ(connectionType, "bridged") ||
          STRCASEEQ(connectionType, "custom")) &&
-        esxUtil_GetConfigString(conn, conf, networkName_name,
-                                &networkName, 0) < 0) {
+        esxUtil_GetConfigString(conf, networkName_name, &networkName, 0) < 0) {
         goto failure;
     }
 
     /* vmx:vnet -> def:data.ifname */
     if (connectionType != NULL && STRCASEEQ(connectionType, "custom") &&
-        esxUtil_GetConfigString(conn, conf, vnet_name, &vnet, 0) < 0) {
+        esxUtil_GetConfigString(conf, vnet_name, &vnet, 0) < 0) {
         goto failure;
     }
 
@@ -1846,13 +1829,13 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
         networkName = NULL;
     } else if (STRCASEEQ(connectionType, "hostonly")) {
         /* FIXME */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "No yet handled value '%s' for VMX entry '%s'",
                   connectionType, connectionType_name);
         goto failure;
     } else if (STRCASEEQ(connectionType, "nat")) {
         /* FIXME */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "No yet handled value '%s' for VMX entry '%s'",
                   connectionType, connectionType_name);
         goto failure;
@@ -1866,7 +1849,7 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
         networkName = NULL;
         vnet = NULL;
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Invalid value '%s' for VMX entry '%s'", connectionType,
                   connectionType_name);
         goto failure;
@@ -1895,9 +1878,9 @@ esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
 
 
 int
-esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                   int port, const char *datastoreName,
-                   const char *directoryName, virDomainChrDefPtr *def)
+esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
+                   const char *datastoreName, const char *directoryName,
+                   virDomainChrDefPtr *def)
 {
     int result = 0;
     char prefix[48] = "";
@@ -1915,18 +1898,18 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     char *fileName = NULL;
 
     if (def == NULL || *def != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (port < 0 || port > 3) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Serial port index %d out of [0..3] range", port);
         return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -1940,14 +1923,13 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     ESX_BUILD_VMX_NAME(fileName);
 
     /* vmx:present */
-    if (esxUtil_GetConfigBoolean(conn, conf, present_name,
-                                 &present, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
         goto failure;
     }
 
     /* vmx:startConnected */
-    if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
-                                 &startConnected, 1, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+                                 1) < 0) {
         goto failure;
     }
 
@@ -1957,12 +1939,12 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     }
 
     /* vmx:fileType -> def:type */
-    if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 0) < 0) {
+    if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 0) < 0) {
         goto failure;
     }
 
     /* vmx:fileName -> def:data.file.path */
-    if (esxUtil_GetConfigString(conn, conf, fileName_name, &fileName, 0) < 0) {
+    if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
         goto failure;
     }
 
@@ -1976,7 +1958,7 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     } else if (STRCASEEQ(fileType, "file")) {
         (*def)->target.port = port;
         (*def)->type = VIR_DOMAIN_CHR_TYPE_FILE;
-        (*def)->data.file.path = esxVMX_ParseFileName(conn, ctx, fileName,
+        (*def)->data.file.path = esxVMX_ParseFileName(ctx, fileName,
                                                       datastoreName,
                                                       directoryName);
 
@@ -1994,7 +1976,7 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
 
         fileName = NULL;
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry '%s' to be 'device', 'file' or 'pipe' "
                   "but found '%s'", fileType_name, fileType);
         goto failure;
@@ -2019,9 +2001,9 @@ esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
 
 
 int
-esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                     int port, const char *datastoreName,
-                     const char *directoryName, virDomainChrDefPtr *def)
+esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
+                     const char *datastoreName, const char *directoryName,
+                     virDomainChrDefPtr *def)
 {
     int result = 0;
     char prefix[48] = "";
@@ -2039,18 +2021,18 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     char *fileName = NULL;
 
     if (def == NULL || *def != NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
     if (port < 0 || port > 2) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Parallel port index %d out of [0..2] range", port);
         return -1;
     }
 
     if (VIR_ALLOC(*def) < 0) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -2064,14 +2046,13 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     ESX_BUILD_VMX_NAME(fileName);
 
     /* vmx:present */
-    if (esxUtil_GetConfigBoolean(conn, conf, present_name,
-                                 &present, 0, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, present_name, &present, 0, 1) < 0) {
         goto failure;
     }
 
     /* vmx:startConnected */
-    if (esxUtil_GetConfigBoolean(conn, conf, startConnected_name,
-                                 &startConnected, 1, 1) < 0) {
+    if (esxUtil_GetConfigBoolean(conf, startConnected_name, &startConnected, 1,
+                                 1) < 0) {
         goto failure;
     }
 
@@ -2081,12 +2062,12 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     }
 
     /* vmx:fileType -> def:type */
-    if (esxUtil_GetConfigString(conn, conf, fileType_name, &fileType, 0) < 0) {
+    if (esxUtil_GetConfigString(conf, fileType_name, &fileType, 0) < 0) {
         goto failure;
     }
 
     /* vmx:fileName -> def:data.file.path */
-    if (esxUtil_GetConfigString(conn, conf, fileName_name, &fileName, 0) < 0) {
+    if (esxUtil_GetConfigString(conf, fileName_name, &fileName, 0) < 0) {
         goto failure;
     }
 
@@ -2100,7 +2081,7 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
     } else if (STRCASEEQ(fileType, "file")) {
         (*def)->target.port = port;
         (*def)->type = VIR_DOMAIN_CHR_TYPE_FILE;
-        (*def)->data.file.path = esxVMX_ParseFileName(conn, ctx, fileName,
+        (*def)->data.file.path = esxVMX_ParseFileName(ctx, fileName,
                                                       datastoreName,
                                                       directoryName);
 
@@ -2108,7 +2089,7 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
             goto failure;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VMX entry '%s' to be 'device' or 'file' but "
                   "found '%s'", fileType_name, fileType);
         goto failure;
@@ -2137,8 +2118,7 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
  */
 
 char *
-esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
-                      const char *src)
+esxVMX_FormatFileName(esxVI_Context *ctx ATTRIBUTE_UNUSED, const char *src)
 {
     char *datastoreName = NULL;
     char *directoryName = NULL;
@@ -2147,7 +2127,7 @@ esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
 
     if (STRPREFIX(src, "[")) {
         /* Found potential datastore related path */
-        if (esxUtil_ParseDatastoreRelatedPath(conn, src, &datastoreName,
+        if (esxUtil_ParseDatastoreRelatedPath(src, &datastoreName,
                                               &directoryName, &fileName) < 0) {
             goto failure;
         }
@@ -2155,13 +2135,13 @@ esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
         if (directoryName == NULL) {
             if (virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s",
                             datastoreName, fileName) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
         } else {
             if (virAsprintf(&absolutePath, "/vmfs/volumes/%s/%s/%s",
                             datastoreName, directoryName, fileName) < 0) {
-                virReportOOMError(conn);
+                virReportOOMError(NULL);
                 goto failure;
             }
         }
@@ -2170,12 +2150,12 @@ esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
         absolutePath = strdup(src);
 
         if (absolutePath == NULL) {
-            virReportOOMError(conn);
+            virReportOOMError(NULL);
             goto failure;
         }
     } else {
         /* Found relative path, this is not supported */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Found relative path '%s' in domain XML, this is not "
                   "supported", src);
         goto failure;
@@ -2199,8 +2179,8 @@ esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx ATTRIBUTE_UNUSED,
 
 
 char *
-esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainDefPtr def, esxVI_APIVersion apiVersion)
+esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
+                    esxVI_APIVersion apiVersion)
 {
     int i;
     int sched_cpu_affinity_length;
@@ -2210,7 +2190,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     memset(zero, 0, VIR_UUID_BUFLEN);
 
     if (def->virtType != VIR_DOMAIN_VIRT_VMWARE) { /* FIXME: maybe add VIR_DOMAIN_VIRT_ESX ? */
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting virt type to be '%s' but found '%s'",
                   virDomainVirtTypeToString(VIR_DOMAIN_VIRT_VMWARE),
                   virDomainVirtTypeToString(def->virtType));
@@ -2231,7 +2211,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
         break;
 
       default:
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting VI API version 2.5 or 4.0");
         goto failure;
     }
@@ -2242,7 +2222,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     } else if (STRCASEEQ(def->os.arch, "x86_64")) {
         virBufferAddLit(&buffer, "guestOS = \"other-64\"\n");
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'arch' of entry 'os/type' "
                   "to be 'i686' or 'x86_64' but found '%s'", def->os.arch);
         goto failure;
@@ -2266,7 +2246,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
 
     /* def:maxmem -> vmx:memsize */
     if (def->maxmem <= 0 || def->maxmem % 4096 != 0) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML entry 'memory' to be an unsigned "
                   "integer (multiple of 4096) but found %lld",
                   (unsigned long long)def->maxmem);
@@ -2280,7 +2260,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     /* def:memory -> vmx:sched.mem.max */
     if (def->memory < def->maxmem) {
         if (def->memory <= 0 || def->memory % 1024 != 0) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting domain XML entry 'currentMemory' to be an "
                       "unsigned integer (multiple of 1024) but found %lld",
                       (unsigned long long)def->memory);
@@ -2294,7 +2274,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
 
     /* def:vcpus -> vmx:numvcpus */
     if (def->vcpus <= 0 || (def->vcpus % 2 != 0 && def->vcpus != 1)) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML entry 'vcpu' to be an unsigned "
                   "integer (1 or a multiple of 2) but found %d",
                   (int)def->vcpus);
@@ -2316,7 +2296,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
         }
 
         if (sched_cpu_affinity_length < def->vcpus) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting domain XML attribute 'cpuset' of entry "
                       "'vcpu' to contains at least %d CPU(s)",
                       (int)def->vcpus);
@@ -2342,14 +2322,14 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     for (i = 0; i < def->ngraphics; ++i) {
         switch (def->graphics[i]->type) {
           case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
-            if (esxVMX_FormatVNC(conn, def->graphics[i], &buffer) < 0) {
+            if (esxVMX_FormatVNC(def->graphics[i], &buffer) < 0) {
                 goto failure;
             }
 
             break;
 
           default:
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Unsupported graphics type '%s'",
                       virDomainGraphicsTypeToString(def->graphics[i]->type));
             goto failure;
@@ -2360,8 +2340,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     int scsi_present[4] = { 0, 0, 0, 0 };
     char *scsi_virtualDev[4] = { NULL, NULL, NULL, NULL };
 
-    if (esxVMX_GatherSCSIControllers(conn, def, scsi_virtualDev,
-                                     scsi_present) < 0) {
+    if (esxVMX_GatherSCSIControllers(def, scsi_virtualDev, scsi_present) < 0) {
         goto failure;
     }
 
@@ -2379,28 +2358,28 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
     for (i = 0; i < def->ndisks; ++i) {
         switch (def->disks[i]->device) {
           case VIR_DOMAIN_DISK_DEVICE_DISK:
-            if (esxVMX_FormatHardDisk(conn, ctx, def->disks[i], &buffer) < 0) {
+            if (esxVMX_FormatHardDisk(ctx, def->disks[i], &buffer) < 0) {
                 goto failure;
             }
 
             break;
 
           case VIR_DOMAIN_DISK_DEVICE_CDROM:
-            if (esxVMX_FormatCDROM(conn, ctx, def->disks[i], &buffer) < 0) {
+            if (esxVMX_FormatCDROM(ctx, def->disks[i], &buffer) < 0) {
                 goto failure;
             }
 
             break;
 
           case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
-            if (esxVMX_FormatFloppy(conn, ctx, def->disks[i], &buffer) < 0) {
+            if (esxVMX_FormatFloppy(ctx, def->disks[i], &buffer) < 0) {
                 goto failure;
             }
 
             break;
 
           default:
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Unsupported disk device type '%s'",
                       virDomainDiskDeviceTypeToString(def->disks[i]->device));
             goto failure;
@@ -2412,7 +2391,7 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
 
     /* def:nets */
     for (i = 0; i < def->nnets; ++i) {
-        if (esxVMX_FormatEthernet(conn, def->nets[i], i, &buffer) < 0) {
+        if (esxVMX_FormatEthernet(def->nets[i], i, &buffer) < 0) {
             goto failure;
         }
     }
@@ -2428,21 +2407,21 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
 
     /* def:serials */
     for (i = 0; i < def->nserials; ++i) {
-        if (esxVMX_FormatSerial(conn, ctx, def->serials[i], &buffer) < 0) {
+        if (esxVMX_FormatSerial(ctx, def->serials[i], &buffer) < 0) {
             goto failure;
         }
     }
 
     /* def:parallels */
     for (i = 0; i < def->nparallels; ++i) {
-        if (esxVMX_FormatParallel(conn, ctx, def->parallels[i], &buffer) < 0) {
+        if (esxVMX_FormatParallel(ctx, def->parallels[i], &buffer) < 0) {
             goto failure;
         }
     }
 
     /* Get final VMX output */
     if (virBufferError(&buffer)) {
-        virReportOOMError(conn);
+        virReportOOMError(NULL);
         goto failure;
     }
 
@@ -2457,10 +2436,10 @@ esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVMX_FormatVNC(virConnectPtr conn, virDomainGraphicsDefPtr def, virBufferPtr buffer)
+esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
 {
     if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -2500,8 +2479,8 @@ esxVMX_FormatVNC(virConnectPtr conn, virDomainGraphicsDefPtr def, virBufferPtr b
 
 
 int
-esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
-                      virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                      virBufferPtr buffer)
 {
     int controller, id;
     const char *busName = NULL;
@@ -2510,7 +2489,7 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
     char *fileName = NULL;
 
     if (def->device != VIR_DOMAIN_DISK_DEVICE_DISK) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -2519,8 +2498,8 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
         entryPrefix = "scsi";
         deviceTypePrefix = "scsi";
 
-        if (esxVMX_SCSIDiskNameToControllerAndID(conn, def->dst,
-                                                 &controller, &id) < 0) {
+        if (esxVMX_SCSIDiskNameToControllerAndID(def->dst, &controller,
+                                                 &id) < 0) {
             return -1;
         }
     } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
@@ -2528,19 +2507,19 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
         entryPrefix = "ide";
         deviceTypePrefix = "ata";
 
-        if (esxVMX_IDEDiskNameToControllerAndID(conn, def->dst,
-                                                 &controller, &id) < 0) {
+        if (esxVMX_IDEDiskNameToControllerAndID(def->dst, &controller,
+                                                &id) < 0) {
             return -1;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Unsupported bus type '%s' for harddisk",
                   virDomainDiskBusTypeToString(def->bus));
         return -1;
     }
 
     if (def->type != VIR_DOMAIN_DISK_TYPE_FILE) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "%s harddisk '%s' has unsupported type '%s', expecting '%s'",
                   busName, def->dst, virDomainDiskTypeToString(def->type),
                   virDomainDiskTypeToString(VIR_DOMAIN_DISK_TYPE_FILE));
@@ -2554,13 +2533,13 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
 
     if (def->src != NULL) {
         if (! virFileHasSuffix(def->src, ".vmdk")) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Image file for %s harddisk '%s' has unsupported suffix, "
                       "expecting '.vmdk'", busName, def->dst);
             return -1;
         }
 
-        fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+        fileName = esxVMX_FormatFileName(ctx, def->src);
 
         if (fileName == NULL) {
             return -1;
@@ -2577,7 +2556,7 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
             virBufferVSprintf(buffer, "%s%d:%d.writeThrough = \"true\"\n",
                               entryPrefix, controller, id);
         } else if (def->cachemode != VIR_DOMAIN_DISK_CACHE_DEFAULT) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "%s harddisk '%s' has unsupported cache mode '%s'",
                       busName, def->dst,
                       virDomainDiskCacheTypeToString(def->cachemode));
@@ -2591,8 +2570,8 @@ esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
-                   virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                   virBufferPtr buffer)
 {
     int controller, id;
     const char *busName = NULL;
@@ -2600,7 +2579,7 @@ esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
     char *fileName = NULL;
 
     if (def->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
@@ -2608,21 +2587,20 @@ esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
         busName = "SCSI";
         entryPrefix = "scsi";
 
-        if (esxVMX_SCSIDiskNameToControllerAndID(conn, def->dst,
-                                                 &controller, &id) < 0) {
+        if (esxVMX_SCSIDiskNameToControllerAndID(def->dst, &controller,
+                                                 &id) < 0) {
             return -1;
         }
     } else if (def->bus == VIR_DOMAIN_DISK_BUS_IDE) {
         busName = "IDE";
         entryPrefix = "ide";
 
-        if (esxVMX_IDEDiskNameToControllerAndID(conn, def->dst,
-                                                 &controller, &id) < 0) {
+        if (esxVMX_IDEDiskNameToControllerAndID(def->dst, &controller,
+                                                &id) < 0) {
             return -1;
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                  "Unsupported bus type '%s' for cdrom",
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported bus type '%s' for cdrom",
                   virDomainDiskBusTypeToString(def->bus));
         return -1;
     }
@@ -2636,13 +2614,13 @@ esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
 
         if (def->src != NULL) {
             if (! virFileHasSuffix(def->src, ".iso")) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Image file for %s cdrom '%s' has unsupported "
                           "suffix, expecting '.iso'", busName, def->dst);
                 return -1;
             }
 
-            fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+            fileName = esxVMX_FormatFileName(ctx, def->src);
 
             if (fileName == NULL) {
                 return -1;
@@ -2662,7 +2640,7 @@ esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
                               entryPrefix, controller, id, def->src);
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "%s cdrom '%s' has unsupported type '%s', expecting '%s' "
                   "or '%s'", busName, def->dst,
                   virDomainDiskTypeToString(def->type),
@@ -2677,18 +2655,18 @@ esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainDiskDefPtr def, virBufferPtr buffer)
+esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                    virBufferPtr buffer)
 {
     int controller;
     char *fileName = NULL;
 
     if (def->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR, "Invalid argument");
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Invalid argument");
         return -1;
     }
 
-    if (esxVMX_FloppyDiskNameToController(conn, def->dst, &controller) < 0) {
+    if (esxVMX_FloppyDiskNameToController(def->dst, &controller) < 0) {
         return -1;
     }
 
@@ -2700,13 +2678,13 @@ esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
 
         if (def->src != NULL) {
             if (! virFileHasSuffix(def->src, ".flp")) {
-                ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+                ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                           "Image file for floppy '%s' has unsupported suffix, "
                           "expecting '.flp'", def->dst);
                 return -1;
             }
 
-            fileName = esxVMX_FormatFileName(conn, ctx, def->src);
+            fileName = esxVMX_FormatFileName(ctx, def->src);
 
             if (fileName == NULL) {
                 return -1;
@@ -2726,7 +2704,7 @@ esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
                               controller, def->src);
         }
     } else {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Floppy '%s' has unsupported type '%s', expecting '%s' "
                   "or '%s'", def->dst,
                   virDomainDiskTypeToString(def->type),
@@ -2741,14 +2719,14 @@ esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
-                      int controller, virBufferPtr buffer)
+esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
+                      virBufferPtr buffer)
 {
     char mac_string[VIR_MAC_STRING_BUFLEN];
     unsigned int prefix, suffix;
 
     if (controller < 0 || controller > 3) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Ethernet controller index %d out of [0..3] range",
                   controller);
         return -1;
@@ -2762,7 +2740,7 @@ esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
             STRCASENEQ(def->model, "vmxnet") &&
             STRCASENEQ(def->model, "vmxnet3") &&
             STRCASENEQ(def->model, "e1000")) {
-            ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+            ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                       "Expecting domain XML entry 'devices/interfase/model' "
                       "to be 'vlance' or 'vmxnet' or 'vmxnet3' or 'e1000' but "
                       "found '%s'", def->model);
@@ -2792,8 +2770,7 @@ esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
         break;
 
       default:
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                  "Unsupported net type '%s'",
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR, "Unsupported net type '%s'",
                   virDomainNetTypeToString(def->type));
         return -1;
     }
@@ -2836,19 +2813,19 @@ esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
 
 
 int
-esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainChrDefPtr def, virBufferPtr buffer)
+esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
+                    virBufferPtr buffer)
 {
     char *fileName = NULL;
 
     if (def->target.port < 0 || def->target.port > 3) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Serial port index %d out of [0..3] range", def->target.port);
         return -1;
     }
 
     if (def->data.file.path == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'path' of entry "
                   "'devices/serial/source' to be present");
         return -1;
@@ -2869,7 +2846,7 @@ esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
         virBufferVSprintf(buffer, "serial%d.fileType = \"file\"\n",
                           def->target.port);
 
-        fileName = esxVMX_FormatFileName(conn, ctx, def->data.file.path);
+        fileName = esxVMX_FormatFileName(ctx, def->data.file.path);
 
         if (fileName == NULL) {
             return -1;
@@ -2895,7 +2872,7 @@ esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
         break;
 
       default:
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Unsupported character device type '%s'",
                   virDomainChrTypeToString(def->type));
         return -1;
@@ -2912,25 +2889,27 @@ esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
 
 
 int
-esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
-                      virDomainChrDefPtr def, virBufferPtr buffer)
+esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
+                      virBufferPtr buffer)
 {
     char *fileName = NULL;
 
     if (def->target.port < 0 || def->target.port > 2) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
-                  "Parallel port index %d out of [0..2] range", def->target.port);
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
+                  "Parallel port index %d out of [0..2] range",
+                  def->target.port);
         return -1;
     }
 
     if (def->data.file.path == NULL) {
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Expecting domain XML attribute 'path' of entry "
                   "'devices/parallel/source' to be present");
         return -1;
     }
 
-    virBufferVSprintf(buffer, "parallel%d.present = \"true\"\n", def->target.port);
+    virBufferVSprintf(buffer, "parallel%d.present = \"true\"\n",
+                      def->target.port);
 
     /* def:type -> vmx:fileType and def:data.file.path -> vmx:fileName */
     switch (def->type) {
@@ -2945,7 +2924,7 @@ esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
         virBufferVSprintf(buffer, "parallel%d.fileType = \"file\"\n",
                           def->target.port);
 
-        fileName = esxVMX_FormatFileName(conn, ctx, def->data.file.path);
+        fileName = esxVMX_FormatFileName(ctx, def->data.file.path);
 
         if (fileName == NULL) {
             return -1;
@@ -2958,7 +2937,7 @@ esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
         break;
 
       default:
-        ESX_ERROR(conn, VIR_ERR_INTERNAL_ERROR,
+        ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
                   "Unsupported character device type '%s'",
                   virDomainChrTypeToString(def->type));
         return -1;
index 0c06fefbba88b3f51f08890461b3b5a453bc8cac..61934094f369358656dfdd74f7c402b7756ef481 100644 (file)
 #include "esx_vi.h"
 
 int
-esxVMX_SCSIDiskNameToControllerAndID(virConnectPtr conn, const char *name,
-                                     int *controller, int *id);
+esxVMX_SCSIDiskNameToControllerAndID(const char *name, int *controller, int *id);
 
 int
-esxVMX_IDEDiskNameToControllerAndID(virConnectPtr conn, const char *name,
-                                    int *controller, int *id);
+esxVMX_IDEDiskNameToControllerAndID(const char *name, int *controller, int *id);
 
 int
-esxVMX_FloppyDiskNameToController(virConnectPtr conn, const char *name,
-                                  int *controller);
+esxVMX_FloppyDiskNameToController(const char *name, int *controller);
 
 int
-esxVMX_GatherSCSIControllers(virConnectPtr conn, virDomainDefPtr conf,
-                             char *virtualDev[4], int present[4]);
+esxVMX_GatherSCSIControllers(virDomainDefPtr conf, char *virtualDev[4],
+                             int present[4]);
 
 char *
-esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
-                                          esxVI_Context *ctx,
+esxVMX_AbsolutePathToDatastoreRelatedPath(esxVI_Context *ctx,
                                           const char *absolutePath);
 
 
@@ -56,40 +52,38 @@ esxVMX_AbsolutePathToDatastoreRelatedPath(virConnectPtr conn,
  */
 
 char *
-esxVMX_ParseFileName(virConnectPtr conn, esxVI_Context *ctx,
-                     const char *fileName, const char *datastoreName,
-                     const char *directoryName);
+esxVMX_ParseFileName(esxVI_Context *ctx, const char *fileName,
+                     const char *datastoreName, const char *directoryName);
 
 virDomainDefPtr
-esxVMX_ParseConfig(virConnectPtr conn, esxVI_Context *ctx, const char *vmx,
+esxVMX_ParseConfig(esxVI_Context *ctx, const char *vmx,
                    const char *datastoreName, const char *directoryName,
                    esxVI_APIVersion apiVersion);
 
 int
-esxVMX_ParseVNC(virConnectPtr conn, virConfPtr conf, virDomainGraphicsDefPtr *def);
+esxVMX_ParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def);
 
 int
-esxVMX_ParseSCSIController(virConnectPtr conn, virConfPtr conf,
-                           int controller, int *present, char **virtualDev);
+esxVMX_ParseSCSIController(virConfPtr conf, int controller, int *present,
+                           char **virtualDev);
 
 int
-esxVMX_ParseDisk(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                 int device, int bus, int controller, int id,
-                 const char *virtualDev, const char *datastoreName,
-                 const char *directoryName, virDomainDiskDefPtr *def);
+esxVMX_ParseDisk(esxVI_Context *ctx, virConfPtr conf, int device, int bus,
+                 int controller, int id, const char *virtualDev,
+                 const char *datastoreName, const char *directoryName,
+                 virDomainDiskDefPtr *def);
 int
-esxVMX_ParseEthernet(virConnectPtr conn, virConfPtr conf, int controller,
-                     virDomainNetDefPtr *def);
+esxVMX_ParseEthernet(virConfPtr conf, int controller, virDomainNetDefPtr *def);
 
 int
-esxVMX_ParseSerial(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                   int port, const char *datastoreName,
-                   const char *directoryName, virDomainChrDefPtr *def);
+esxVMX_ParseSerial(esxVI_Context *ctx, virConfPtr conf, int port,
+                   const char *datastoreName, const char *directoryName,
+                   virDomainChrDefPtr *def);
 
 int
-esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
-                     int port, const char *datastoreName,
-                     const char *directoryName, virDomainChrDefPtr *def);
+esxVMX_ParseParallel(esxVI_Context *ctx, virConfPtr conf, int port,
+                     const char *datastoreName, const char *directoryName,
+                     virDomainChrDefPtr *def);
 
 
 
@@ -98,37 +92,37 @@ esxVMX_ParseParallel(virConnectPtr conn, esxVI_Context *ctx, virConfPtr conf,
  */
 
 char *
-esxVMX_FormatFileName(virConnectPtr conn, esxVI_Context *ctx, const char *src);
+esxVMX_FormatFileName(esxVI_Context *ctx, const char *src);
 
 char *
-esxVMX_FormatConfig(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainDefPtr def, esxVI_APIVersion apiVersion);
+esxVMX_FormatConfig(esxVI_Context *ctx, virDomainDefPtr def,
+                    esxVI_APIVersion apiVersion);
 
 int
-esxVMX_FormatVNC(virConnectPtr conn, virDomainGraphicsDefPtr def, virBufferPtr buffer);
+esxVMX_FormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer);
 
 int
-esxVMX_FormatHardDisk(virConnectPtr conn, esxVI_Context *ctx,
-                      virDomainDiskDefPtr def, virBufferPtr buffer);
+esxVMX_FormatHardDisk(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                      virBufferPtr buffer);
 
 int
-esxVMX_FormatCDROM(virConnectPtr conn, esxVI_Context *ctx,
-                   virDomainDiskDefPtr def, virBufferPtr buffer);
+esxVMX_FormatCDROM(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                   virBufferPtr buffer);
 
 int
-esxVMX_FormatFloppy(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainDiskDefPtr def, virBufferPtr buffer);
+esxVMX_FormatFloppy(esxVI_Context *ctx, virDomainDiskDefPtr def,
+                    virBufferPtr buffer);
 
 int
-esxVMX_FormatEthernet(virConnectPtr conn, virDomainNetDefPtr def,
-                      int controller, virBufferPtr buffer);
+esxVMX_FormatEthernet(virDomainNetDefPtr def, int controller,
+                      virBufferPtr buffer);
 
 int
-esxVMX_FormatSerial(virConnectPtr conn, esxVI_Context *ctx,
-                    virDomainChrDefPtr def, virBufferPtr buffer);
+esxVMX_FormatSerial(esxVI_Context *ctx, virDomainChrDefPtr def,
+                    virBufferPtr buffer);
 
 int
-esxVMX_FormatParallel(virConnectPtr conn, esxVI_Context *ctx,
-                      virDomainChrDefPtr def, virBufferPtr buffer);
+esxVMX_FormatParallel(esxVI_Context *ctx, virDomainChrDefPtr def,
+                      virBufferPtr buffer);
 
 #endif /* __ESX_VMX_H__ */
index f73df48783c6128cc54d4ce8f5b2d5db1efcc0ca..d8cfa2a8afb60e631f04cecf47c39ada4975f848 100644 (file)
@@ -122,8 +122,7 @@ testParseDatastoreRelatedPath(const void *data ATTRIBUTE_UNUSED)
         VIR_FREE(directoryName);
         VIR_FREE(fileName);
 
-        if (esxUtil_ParseDatastoreRelatedPath(NULL,
-                                              paths[i].datastoreRelatedPath,
+        if (esxUtil_ParseDatastoreRelatedPath(paths[i].datastoreRelatedPath,
                                               &datastoreName, &directoryName,
                                               &fileName) != paths[i].result) {
             goto failure;
index 2e4547e88ed693db62c03792f9b87dcc56d8d8d8..8ea0b12048321ad85bf5518ad1a3bd548b172ed1 100644 (file)
@@ -35,7 +35,7 @@ testCompareFiles(const char *vmx, const char *xml, esxVI_APIVersion apiVersion)
         goto failure;
     }
 
-    def = esxVMX_ParseConfig(NULL, NULL, vmxData, "datastore", "directory",
+    def = esxVMX_ParseConfig(NULL, vmxData, "datastore", "directory",
                              apiVersion);
 
     if (def == NULL) {
index 1a621a2da5bfc8fda67b865740182f474f322684..530dd2a023da675e6adaf87d01d8f80557f040c7 100644 (file)
@@ -89,7 +89,7 @@ testCompareFiles(const char *xml, const char *vmx, esxVI_APIVersion apiVersion)
         goto failure;
     }
 
-    formatted = esxVMX_FormatConfig(NULL, NULL, def, apiVersion);
+    formatted = esxVMX_FormatConfig(NULL, def, apiVersion);
 
     if (formatted == NULL) {
         goto failure;