Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/esx/esx_driver.c | 390 +++++++++++++++++----------------------------------
1 file changed, 130 insertions(+), 260 deletions(-)
diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
index af567d2..1cbebb9 100644
--- a/src/esx/esx_driver.c
+++ b/src/esx/esx_driver.c
@@ -66,9 +66,8 @@ struct _esxVMX_Data {
static void
esxFreePrivate(esxPrivate **priv)
{
- if (!priv || !(*priv)) {
+ if (!priv || !(*priv))
return;
- }
esxVI_Context_Free(&(*priv)->host);
esxVI_Context_Free(&(*priv)->vCenter);
@@ -174,26 +173,22 @@ esxParseVMXFileName(const char *fileName, void *opaque)
tmp = (char *)STRSKIP(fileName, hostMount->mountInfo->path);
- if (!tmp) {
+ if (!tmp)
continue;
- }
/* Found a match. Strip leading separators */
- while (*tmp == '/' || *tmp == '\\') {
+ while (*tmp == '/' || *tmp == '\\')
++tmp;
- }
- if (VIR_STRDUP(strippedFileName, tmp) < 0) {
+ if (VIR_STRDUP(strippedFileName, tmp) < 0)
goto cleanup;
- }
tmp = strippedFileName;
/* Convert \ to / */
while (*tmp != '\0') {
- if (*tmp == '\\') {
+ if (*tmp == '\\')
*tmp = '/';
- }
++tmp;
}
@@ -207,9 +202,8 @@ esxParseVMXFileName(const char *fileName, void *opaque)
/* Fallback to direct datastore name match */
if (!result && STRPREFIX(fileName, "/vmfs/volumes/")) {
- if (VIR_STRDUP(copyOfFileName, fileName) < 0) {
+ if (VIR_STRDUP(copyOfFileName, fileName) < 0)
goto cleanup;
- }
/* Expected format: '/vmfs/volumes/<datastore>/<path>'
*/
if (!(tmp = STRSKIP(copyOfFileName, "/vmfs/volumes/")) ||
@@ -244,9 +238,8 @@ esxParseVMXFileName(const char *fileName, void *opaque)
/* If it's an absolute path outside of a datastore just use it as is */
if (!result && *fileName == '/') {
/* FIXME: need to deal with Windows paths here too */
- if (VIR_STRDUP(result, fileName) < 0) {
+ if (VIR_STRDUP(result, fileName) < 0)
goto cleanup;
- }
}
if (!result) {
@@ -312,16 +305,14 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
}
/* Detect separator type */
- if (strchr(hostMount->mountInfo->path, '\\')) {
+ if (strchr(hostMount->mountInfo->path, '\\'))
separator = '\\';
- }
/* Strip trailing separators */
length = strlen(hostMount->mountInfo->path);
- while (length > 0 && hostMount->mountInfo->path[length - 1] ==
separator) {
+ while (length > 0 && hostMount->mountInfo->path[length - 1] ==
separator)
--length;
- }
/* Format as <mount>[/<directory>]/<file>, convert / to \ when
necessary */
virBufferAdd(&buffer, hostMount->mountInfo->path, length);
@@ -330,9 +321,8 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
tmp = directoryAndFileName;
while (*tmp != '\0') {
- if (*tmp == '/') {
+ if (*tmp == '/')
*tmp = separator;
- }
++tmp;
}
@@ -347,9 +337,8 @@ esxFormatVMXFileName(const char *fileName, void *opaque)
result = virBufferContentAndReset(&buffer);
} else if (*fileName == '/') {
/* FIXME: need to deal with Windows paths here too */
- if (VIR_STRDUP(result, fileName) < 0) {
+ if (VIR_STRDUP(result, fileName) < 0)
goto cleanup;
- }
} else {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Could not handle file name '%s'"),
fileName);
@@ -451,13 +440,11 @@ esxSupportsLongMode(esxPrivate *priv)
esxVI_ParsedHostCpuIdInfo parsedHostCpuIdInfo;
char edxLongModeBit = '?';
- if (priv->supportsLongMode != esxVI_Boolean_Undefined) {
+ if (priv->supportsLongMode != esxVI_Boolean_Undefined)
return priv->supportsLongMode;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return esxVI_Boolean_Undefined;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"hardware.cpuFeature") < 0 ||
@@ -529,9 +516,8 @@ esxLookupHostSystemBiosUuid(esxPrivate *priv, unsigned char *uuid)
esxVI_ObjectContent *hostSystem = NULL;
char *uuid_string = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"hardware.systemInfo.uuid") < 0 ||
@@ -571,9 +557,8 @@ esxCapsInit(esxPrivate *priv)
virCapsPtr caps = NULL;
virCapsGuestPtr guest = NULL;
- if (supportsLongMode == esxVI_Boolean_Undefined) {
+ if (supportsLongMode == esxVI_Boolean_Undefined)
return NULL;
- }
if (supportsLongMode == esxVI_Boolean_True) {
caps = virCapabilitiesNew(VIR_ARCH_X86_64, true, true);
@@ -587,9 +572,8 @@ esxCapsInit(esxPrivate *priv)
virCapabilitiesAddHostMigrateTransport(caps, "vpxmigr");
- if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0) {
+ if (esxLookupHostSystemBiosUuid(priv, caps->host.host_uuid) < 0)
goto failure;
- }
/* i686 */
guest = virCapabilitiesAddGuest(caps, "hvm",
@@ -597,13 +581,11 @@ esxCapsInit(esxPrivate *priv)
NULL, NULL, 0,
NULL);
- if (!guest) {
+ if (!guest)
goto failure;
- }
- if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL))
{
+ if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0, NULL))
goto failure;
- }
/* x86_64 */
if (supportsLongMode == esxVI_Boolean_True) {
@@ -612,13 +594,11 @@ esxCapsInit(esxPrivate *priv)
NULL, NULL,
0, NULL);
- if (!guest) {
+ if (!guest)
goto failure;
- }
- if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
NULL)) {
+ if (!virCapabilitiesAddGuestDomain(guest, "vmware", NULL, NULL, 0,
NULL))
goto failure;
- }
}
return caps;
@@ -655,9 +635,8 @@ esxConnectToHost(esxPrivate *priv,
return -1;
}
- if (esxUtil_ResolveHostname(conn->uri->server, ipAddress, NI_MAXHOST) < 0)
{
+ if (esxUtil_ResolveHostname(conn->uri->server, ipAddress, NI_MAXHOST) < 0)
return -1;
- }
if (conn->uri->user) {
if (VIR_STRDUP(username, conn->uri->user) < 0)
@@ -680,9 +659,8 @@ esxConnectToHost(esxPrivate *priv,
password = esxUtil_EscapeForXml(unescapedPassword);
- if (!password) {
+ if (!password)
goto cleanup;
- }
if (virAsprintf(&url, "%s://%s:%d/sdk",
priv->parsedUri->transport,
conn->uri->server, conn->uri->port) < 0)
@@ -720,9 +698,8 @@ esxConnectToHost(esxPrivate *priv,
}
/* Warn if host is in maintenance mode */
- if (inMaintenanceMode == esxVI_Boolean_True) {
+ if (inMaintenanceMode == esxVI_Boolean_True)
VIR_WARN("The server is in maintenance mode");
- }
if (VIR_STRDUP(*vCenterIpAddress, *vCenterIpAddress) < 0)
goto cleanup;
@@ -763,14 +740,12 @@ esxConnectToVCenter(esxPrivate *priv,
return -1;
}
- if (esxUtil_ResolveHostname(hostname, ipAddress, NI_MAXHOST) < 0) {
+ if (esxUtil_ResolveHostname(hostname, ipAddress, NI_MAXHOST) < 0)
return -1;
- }
if (conn->uri->user) {
- if (VIR_STRDUP(username, conn->uri->user) < 0) {
+ if (VIR_STRDUP(username, conn->uri->user) < 0)
goto cleanup;
- }
} else {
username = virAuthGetUsername(conn, auth, "esx",
"administrator", hostname);
@@ -789,9 +764,8 @@ esxConnectToVCenter(esxPrivate *priv,
password = esxUtil_EscapeForXml(unescapedPassword);
- if (!password) {
+ if (!password)
goto cleanup;
- }
if (virAsprintf(&url, "%s://%s:%d/sdk",
priv->parsedUri->transport,
hostname, conn->uri->port) < 0)
@@ -895,9 +869,8 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
/* Decline if the URI is NULL or the scheme is NULL */
- if (!conn->uri || !conn->uri->scheme) {
+ if (!conn->uri || !conn->uri->scheme)
return VIR_DRV_OPEN_DECLINED;
- }
/* Decline if the scheme is not one of {vpx|esx|gsx} */
plus = strchr(conn->uri->scheme, '+');
@@ -946,9 +919,8 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
if (VIR_ALLOC(priv) < 0)
goto cleanup;
- if (esxUtil_ParseUri(&priv->parsedUri, conn->uri) < 0) {
+ if (esxUtil_ParseUri(&priv->parsedUri, conn->uri) < 0)
goto cleanup;
- }
priv->maxVcpus = -1;
priv->supportsVMotion = esxVI_Boolean_Undefined;
@@ -1043,9 +1015,8 @@ esxConnectOpen(virConnectPtr conn, virConnectAuthPtr auth,
/* Setup capabilities */
priv->caps = esxCapsInit(priv);
- if (!priv->caps) {
+ if (!priv->caps)
goto cleanup;
- }
if (!(priv->xmlopt = virVMXDomainXMLConfInit()))
goto cleanup;
@@ -1098,13 +1069,11 @@ esxSupportsVMotion(esxPrivate *priv)
esxVI_String *propertyNameList = NULL;
esxVI_ObjectContent *hostSystem = NULL;
- if (priv->supportsVMotion != esxVI_Boolean_Undefined) {
+ if (priv->supportsVMotion != esxVI_Boolean_Undefined)
return priv->supportsVMotion;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return esxVI_Boolean_Undefined;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"capability.vmotionSupported") < 0
||
@@ -1173,9 +1142,8 @@ esxConnectSupportsFeature(virConnectPtr conn, int feature)
case VIR_DRV_FEATURE_MIGRATION_V1:
supportsVMotion = esxSupportsVMotion(priv);
- if (supportsVMotion == esxVI_Boolean_Undefined) {
+ if (supportsVMotion == esxVI_Boolean_Undefined)
return -1;
- }
/* Migration is only possible via a vCenter and if VMotion is enabled */
return priv->vCenter &&
@@ -1219,9 +1187,8 @@ esxConnectGetHostname(virConnectPtr conn)
const char *domainName = NULL;
char *complete = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_String_AppendValueListToList
(&propertyNameList,
@@ -1301,9 +1268,8 @@ esxNodeGetInfo(virConnectPtr conn, virNodeInfoPtr nodeinfo)
memset(nodeinfo, 0, sizeof(*nodeinfo));
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"hardware.cpuInfo.hz\0"
@@ -1448,13 +1414,11 @@ esxConnectListDomains(virConnectPtr conn, int *ids, int maxids)
esxVI_VirtualMachinePowerState powerState;
int count = 0;
- if (maxids == 0) {
+ if (maxids == 0)
return 0;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -1470,9 +1434,8 @@ esxConnectListDomains(virConnectPtr conn, int *ids, int maxids)
goto cleanup;
}
- if (powerState != esxVI_VirtualMachinePowerState_PoweredOn) {
+ if (powerState != esxVI_VirtualMachinePowerState_PoweredOn)
continue;
- }
if (esxUtil_ParseVirtualMachineIDString(virtualMachine->obj->value,
&ids[count]) < 0 ||
@@ -1485,9 +1448,8 @@ esxConnectListDomains(virConnectPtr conn, int *ids, int maxids)
count++;
- if (count >= maxids) {
+ if (count >= maxids)
break;
- }
}
success = true;
@@ -1506,9 +1468,8 @@ esxConnectNumOfDomains(virConnectPtr conn)
{
esxPrivate *priv = conn->privateData;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
return esxVI_LookupNumberOfDomainsByPowerState
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, false);
@@ -1529,9 +1490,8 @@ esxDomainLookupByID(virConnectPtr conn, int id)
unsigned char uuid_candidate[VIR_UUID_BUFLEN];
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
@@ -1551,9 +1511,8 @@ esxDomainLookupByID(virConnectPtr conn, int id)
}
/* Only running/suspended domains have an ID != -1 */
- if (powerState == esxVI_VirtualMachinePowerState_PoweredOff) {
+ if (powerState == esxVI_VirtualMachinePowerState_PoweredOff)
continue;
- }
VIR_FREE(name_candidate);
@@ -1563,24 +1522,21 @@ esxDomainLookupByID(virConnectPtr conn, int id)
goto cleanup;
}
- if (id != id_candidate) {
+ if (id != id_candidate)
continue;
- }
domain = virGetDomain(conn, name_candidate, uuid_candidate);
- if (!domain) {
+ if (!domain)
goto cleanup;
- }
domain->id = id;
break;
}
- if (!domain) {
+ if (!domain)
virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
- }
cleanup:
esxVI_String_Free(&propertyNameList);
@@ -1603,9 +1559,8 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
char *name = NULL;
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
@@ -1620,9 +1575,8 @@ esxDomainLookupByUUID(virConnectPtr conn, const unsigned char
*uuid)
domain = virGetDomain(conn, name, uuid);
- if (!domain) {
+ if (!domain)
goto cleanup;
- }
/* Only running/suspended virtual machines have an ID != -1 */
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
@@ -1652,9 +1606,8 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
unsigned char uuid[VIR_UUID_BUFLEN];
virDomainPtr domain = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"configStatus\0"
@@ -1678,9 +1631,8 @@ esxDomainLookupByName(virConnectPtr conn, const char *name)
domain = virGetDomain(conn, name, uuid);
- if (!domain) {
+ if (!domain)
goto cleanup;
- }
/* Only running/suspended virtual machines have an ID != -1 */
if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
@@ -1710,9 +1662,8 @@ esxDomainSuspend(virDomainPtr domain)
esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -1768,9 +1719,8 @@ esxDomainResume(virDomainPtr domain)
esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -1825,9 +1775,8 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -1844,9 +1793,8 @@ esxDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
goto cleanup;
}
- if (esxVI_ShutdownGuest(priv->primary, virtualMachine->obj) < 0) {
+ if (esxVI_ShutdownGuest(priv->primary, virtualMachine->obj) < 0)
goto cleanup;
- }
result = 0;
@@ -1876,9 +1824,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -1895,9 +1842,8 @@ esxDomainReboot(virDomainPtr domain, unsigned int flags)
goto cleanup;
}
- if (esxVI_RebootGuest(priv->primary, virtualMachine->obj) < 0) {
+ if (esxVI_RebootGuest(priv->primary, virtualMachine->obj) < 0)
goto cleanup;
- }
result = 0;
@@ -1932,9 +1878,8 @@ esxDomainDestroyFlags(virDomainPtr domain,
ctx = priv->host;
}
- if (esxVI_EnsureSession(ctx) < 0) {
+ if (esxVI_EnsureSession(ctx) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -2005,9 +1950,8 @@ esxDomainGetMaxMemory(virDomainPtr domain)
esxVI_DynamicProperty *dynamicProperty = NULL;
unsigned long memoryMB = 0;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return 0;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"config.hardware.memoryMB") < 0 ||
@@ -2061,9 +2005,8 @@ esxDomainSetMaxMemory(virDomainPtr domain, unsigned long memory)
esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -2130,9 +2073,8 @@ esxDomainSetMemory(virDomainPtr domain, unsigned long memory)
esxVI_TaskInfoState taskInfoState;
char *taskInfoErrorMessage = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
(priv->primary, domain->uuid, NULL, &virtualMachine,
@@ -2211,9 +2153,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
memset(info, 0, sizeof(*info));
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"runtime.powerState\0"
@@ -2261,9 +2202,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
memory_limit = dynamicProperty->val->int64;
- if (memory_limit > 0) {
+ if (memory_limit > 0)
memory_limit *= 1024; /* Scale from megabyte to kilobyte */
- }
} else {
VIR_WARN("Unexpected '%s' property",
dynamicProperty->name);
}
@@ -2277,15 +2217,13 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
/* FIXME: Currently no host for a vpx:// connection */
if (priv->host) {
if (info->state == VIR_DOMAIN_RUNNING && priv->usedCpuTimeCounterId
>= 0) {
- if (esxVI_Int_Alloc(&counterId) < 0) {
+ if (esxVI_Int_Alloc(&counterId) < 0)
goto cleanup;
- }
counterId->value = priv->usedCpuTimeCounterId;
- if (esxVI_Int_AppendToList(&counterIdList, counterId) < 0) {
+ if (esxVI_Int_AppendToList(&counterIdList, counterId) < 0)
goto cleanup;
- }
if (esxVI_QueryPerfCounter(priv->host, counterIdList,
&perfCounterInfo) < 0) {
@@ -2353,9 +2291,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
}
}
- if (priv->usedCpuTimeCounterId < 0) {
+ if (priv->usedCpuTimeCounterId < 0)
VIR_WARN("Could not find 'used CPU time' performance
counter");
- }
}
/*
@@ -2442,9 +2379,8 @@ esxDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
querySpec->entity = NULL;
querySpec->format = NULL;
- if (querySpec->metricId) {
+ if (querySpec->metricId)
querySpec->metricId->instance = NULL;
- }
}
#endif
@@ -2477,9 +2413,8 @@ esxDomainGetState(virDomainPtr domain,
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -2608,15 +2543,13 @@ esxDomainSetVcpusFlags(virDomainPtr domain, unsigned int nvcpus,
return -1;
}
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
maxVcpus = esxDomainGetMaxVcpus(domain);
- if (maxVcpus < 0) {
+ if (maxVcpus < 0)
return -1;
- }
if (nvcpus > maxVcpus) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -2686,15 +2619,13 @@ esxDomainGetVcpusFlags(virDomainPtr domain, unsigned int flags)
return -1;
}
- if (priv->maxVcpus > 0) {
+ if (priv->maxVcpus > 0)
return priv->maxVcpus;
- }
priv->maxVcpus = -1;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"capability.maxSupportedVcpus") < 0
||
@@ -2760,9 +2691,8 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
memset(&data, 0, sizeof(data));
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"config.files.vmPathName\0"
@@ -2795,9 +2725,8 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
url = virBufferContentAndReset(&buffer);
- if (esxVI_CURL_Download(priv->primary->curl, url, &vmx, 0, NULL) < 0) {
+ if (esxVI_CURL_Download(priv->primary->curl, url, &vmx, 0, NULL) < 0)
goto cleanup;
- }
data.ctx = priv->primary;
@@ -2819,17 +2748,15 @@ esxDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
def = virVMXParseConfig(&ctx, priv->xmlopt, vmx);
if (def) {
- if (powerState != esxVI_VirtualMachinePowerState_PoweredOff) {
+ if (powerState != esxVI_VirtualMachinePowerState_PoweredOff)
def->id = id;
- }
xml = virDomainDefFormat(def, flags);
}
cleanup:
- if (!url) {
+ if (!url)
virBufferFreeAndReset(&buffer);
- }
esxVI_String_Free(&propertyNameList);
esxVI_ObjectContent_Free(&virtualMachine);
@@ -2877,9 +2804,8 @@ esxConnectDomainXMLFromNative(virConnectPtr conn, const char
*nativeFormat,
def = virVMXParseConfig(&ctx, priv->xmlopt, nativeConfig);
- if (def) {
+ if (def)
xml = virDomainDefFormat(def, VIR_DOMAIN_XML_INACTIVE);
- }
virDomainDefFree(def);
@@ -2913,17 +2839,15 @@ esxConnectDomainXMLToNative(virConnectPtr conn, const char
*nativeFormat,
virtualHW_version = esxVI_ProductVersionToDefaultVirtualHWVersion
(priv->primary->productLine,
priv->primary->productVersion);
- if (virtualHW_version < 0) {
+ if (virtualHW_version < 0)
return NULL;
- }
def = virDomainDefParseString(domainXml, priv->caps, priv->xmlopt,
1 << VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_XML_INACTIVE);
- if (!def) {
+ if (!def)
return NULL;
- }
data.ctx = priv->primary;
data.datastorePathWithoutFileName = NULL;
@@ -2954,13 +2878,11 @@ esxConnectListDefinedDomains(virConnectPtr conn, char **const
names, int maxname
int count = 0;
size_t i;
- if (maxnames == 0) {
+ if (maxnames == 0)
return 0;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"name\0"
@@ -2977,9 +2899,8 @@ esxConnectListDefinedDomains(virConnectPtr conn, char **const names,
int maxname
goto cleanup;
}
- if (powerState == esxVI_VirtualMachinePowerState_PoweredOn) {
+ if (powerState == esxVI_VirtualMachinePowerState_PoweredOn)
continue;
- }
names[count] = NULL;
@@ -2990,18 +2911,16 @@ esxConnectListDefinedDomains(virConnectPtr conn, char **const
names, int maxname
++count;
- if (count >= maxnames) {
+ if (count >= maxnames)
break;
- }
}
success = true;
cleanup:
if (! success) {
- for (i = 0; i < count; ++i) {
+ for (i = 0; i < count; ++i)
VIR_FREE(names[i]);
- }
count = -1;
}
@@ -3019,9 +2938,8 @@ esxConnectNumOfDefinedDomains(virConnectPtr conn)
{
esxPrivate *priv = conn->privateData;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
return esxVI_LookupNumberOfDomainsByPowerState
(priv->primary, esxVI_VirtualMachinePowerState_PoweredOn, true);
@@ -3044,9 +2962,8 @@ esxDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -3130,18 +3047,16 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
memset(&data, 0, sizeof(data));
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
/* Parse domain XML */
def = virDomainDefParseString(xml, priv->caps, priv->xmlopt,
1 << VIR_DOMAIN_VIRT_VMWARE,
VIR_DOMAIN_XML_INACTIVE);
- if (!def) {
+ if (!def)
return NULL;
- }
/* Check if an existing domain should be edited */
if (esxVI_LookupVirtualMachineByUuid(priv->primary, def->uuid, NULL,
@@ -3169,9 +3084,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
virtualHW_version = esxVI_ProductVersionToDefaultVirtualHWVersion
(priv->primary->productLine,
priv->primary->productVersion);
- if (virtualHW_version < 0) {
+ if (virtualHW_version < 0)
goto cleanup;
- }
data.ctx = priv->primary;
data.datastorePathWithoutFileName = NULL;
@@ -3183,9 +3097,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
vmx = virVMXFormatConfig(&ctx, priv->xmlopt, def, virtualHW_version);
- if (!vmx) {
+ if (!vmx)
goto cleanup;
- }
/*
* Build VMX datastore URL. Use the source of the first file-based harddisk
@@ -3246,9 +3159,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
escapedName = esxUtil_EscapeDatastoreItem(def->name);
- if (!escapedName) {
+ if (!escapedName)
goto cleanup;
- }
virBufferURIEncodeString(&buffer, escapedName);
virBufferAddLit(&buffer, ".vmx?dcPath=");
@@ -3267,9 +3179,8 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
/* Upload VMX file */
VIR_DEBUG("Uploading .vmx config, url='%s' vmx='%s'", url,
vmx);
- if (esxVI_CURL_Upload(priv->primary->curl, url, vmx) < 0) {
+ if (esxVI_CURL_Upload(priv->primary->curl, url, vmx) < 0)
goto cleanup;
- }
/* Register the domain */
if (directoryName) {
@@ -3302,16 +3213,14 @@ esxDomainDefineXML(virConnectPtr conn, const char *xml)
domain = virGetDomain(conn, def->name, def->uuid);
- if (domain) {
+ if (domain)
domain->id = -1;
- }
/* FIXME: Add proper rollback in case of an error */
cleanup:
- if (!url) {
+ if (!url)
virBufferFreeAndReset(&buffer);
- }
virDomainDefFree(def);
VIR_FREE(vmx);
@@ -3354,9 +3263,8 @@ esxDomainUndefineFlags(virDomainPtr domain,
ctx = priv->host;
}
- if (esxVI_EnsureSession(ctx) < 0) {
+ if (esxVI_EnsureSession(ctx) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -3374,9 +3282,8 @@ esxDomainUndefineFlags(virDomainPtr domain,
goto cleanup;
}
- if (esxVI_UnregisterVM(ctx, virtualMachine->obj) < 0) {
+ if (esxVI_UnregisterVM(ctx, virtualMachine->obj) < 0)
goto cleanup;
- }
result = 0;
@@ -3407,14 +3314,12 @@ esxDomainGetAutostart(virDomainPtr domain, int *autostart)
*autostart = 0;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
/* Check general autostart config */
- if (esxVI_LookupAutoStartDefaults(priv->primary, &defaults) < 0) {
+ if (esxVI_LookupAutoStartDefaults(priv->primary, &defaults) < 0)
goto cleanup;
- }
if (defaults->enabled != esxVI_Boolean_True) {
/* Autostart is disabled in general, exit early here */
@@ -3423,9 +3328,8 @@ esxDomainGetAutostart(virDomainPtr domain, int *autostart)
}
/* Check specific autostart config */
- if (esxVI_LookupAutoStartPowerInfoList(priv->primary, &powerInfoList) < 0)
{
+ if (esxVI_LookupAutoStartPowerInfoList(priv->primary, &powerInfoList) < 0)
goto cleanup;
- }
if (!powerInfoList) {
/* powerInfo list is empty, exit early here */
@@ -3442,9 +3346,8 @@ esxDomainGetAutostart(virDomainPtr domain, int *autostart)
for (powerInfo = powerInfoList; powerInfo;
powerInfo = powerInfo->_next) {
if (STREQ(powerInfo->key->value, virtualMachine->obj->value)) {
- if (STRCASEEQ(powerInfo->startAction, "powerOn")) {
+ if (STRCASEEQ(powerInfo->startAction, "powerOn"))
*autostart = 1;
- }
break;
}
@@ -3475,9 +3378,8 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
esxVI_AutoStartPowerInfo *powerInfo = NULL;
esxVI_AutoStartPowerInfo *newPowerInfo = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupVirtualMachineByUuid(priv->primary, domain->uuid,
NULL, &virtualMachine,
@@ -3493,9 +3395,8 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
* autostart. If it's enabled then the autostart behavior depends on
* the per-domain autostart config.
*/
- if (esxVI_LookupAutoStartDefaults(priv->primary, &defaults) < 0) {
+ if (esxVI_LookupAutoStartDefaults(priv->primary, &defaults) < 0)
goto cleanup;
- }
if (defaults->enabled != esxVI_Boolean_True) {
/*
@@ -3520,9 +3421,8 @@ esxDomainSetAutostart(virDomainPtr domain, int autostart)
}
/* Enable autostart in general */
- if (esxVI_AutoStartDefaults_Alloc(&spec->defaults) < 0) {
+ if (esxVI_AutoStartDefaults_Alloc(&spec->defaults) < 0)
goto cleanup;
- }
spec->defaults->enabled = esxVI_Boolean_True;
}
@@ -3616,9 +3516,8 @@ esxDomainGetSchedulerType(virDomainPtr domain ATTRIBUTE_UNUSED, int
*nparams)
if (VIR_STRDUP(type, "allocation") < 0)
return NULL;
- if (nparams) {
+ if (nparams)
*nparams = 3; /* reservation, limit, shares */
- }
return type;
}
@@ -3641,9 +3540,8 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueListToList(&propertyNameList,
"config.cpuAllocation.reservation\0"
@@ -3775,9 +3673,8 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
NULL) < 0)
return -1;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
(priv->primary, domain->uuid, NULL, &virtualMachine,
@@ -3789,9 +3686,8 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
for (i = 0; i < nparams; ++i) {
if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_RESERVATION)) {
- if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0) {
+ if (esxVI_Long_Alloc(&spec->cpuAllocation->reservation) < 0)
goto cleanup;
- }
if (params[i].value.l < 0) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -3802,9 +3698,8 @@ esxDomainSetSchedulerParametersFlags(virDomainPtr domain,
spec->cpuAllocation->reservation->value = params[i].value.l;
} else if (STREQ(params[i].field, VIR_DOMAIN_SCHEDULER_LIMIT)) {
- if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0) {
+ if (esxVI_Long_Alloc(&spec->cpuAllocation->limit) < 0)
goto cleanup;
- }
if (params[i].value.l < -1) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -3963,9 +3858,8 @@ esxDomainMigratePerform(virDomainPtr domain,
return -1;
}
- if (esxVI_EnsureSession(priv->vCenter) < 0) {
+ if (esxVI_EnsureSession(priv->vCenter) < 0)
return -1;
- }
/* Parse migration URI */
if (!(parsedUri = virURIParse(uri)))
@@ -4094,9 +3988,8 @@ esxNodeGetFreeMemory(virConnectPtr conn)
esxVI_DynamicProperty *dynamicProperty = NULL;
esxVI_ResourcePoolResourceUsage *resourcePoolResourceUsage = NULL;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return 0;
- }
/* Get memory usage of resource pool */
if (esxVI_String_AppendValueToList(&propertyNameList,
@@ -4195,9 +4088,8 @@ esxDomainIsActive(virDomainPtr domain)
esxVI_String *propertyNameList = NULL;
esxVI_VirtualMachinePowerState powerState;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList(&propertyNameList,
"runtime.powerState") < 0 ||
@@ -4299,16 +4191,14 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const char
*xmlDesc,
VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE |
VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA, NULL);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
def = virDomainSnapshotDefParseString(xmlDesc, priv->caps,
priv->xmlopt, 0, 0);
- if (!def) {
+ if (!def)
return NULL;
- }
if (def->ndisks) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -4381,9 +4271,8 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr snapshot,
memset(&def, 0, sizeof(def));
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotList) < 0 ||
@@ -4433,9 +4322,8 @@ esxDomainSnapshotNum(virDomainPtr domain, unsigned int flags)
recurse = (flags & VIR_DOMAIN_SNAPSHOT_LIST_ROOTS) == 0;
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
/* ESX snapshots do not require libvirt to maintain any metadata. */
if (flags & VIR_DOMAIN_SNAPSHOT_LIST_METADATA)
@@ -4478,13 +4366,11 @@ esxDomainSnapshotListNames(virDomainPtr domain, char **names, int
nameslen,
return -1;
}
- if (nameslen == 0 || (flags & VIR_DOMAIN_SNAPSHOT_LIST_METADATA)) {
+ if (nameslen == 0 || (flags & VIR_DOMAIN_SNAPSHOT_LIST_METADATA))
return 0;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, domain->uuid,
&rootSnapshotTreeList) < 0) {
@@ -4518,9 +4404,8 @@ esxDomainSnapshotNumChildren(virDomainSnapshotPtr snapshot, unsigned
int flags)
recurse = (flags & VIR_DOMAIN_SNAPSHOT_LIST_DESCENDANTS) != 0;
leaves = (flags & VIR_DOMAIN_SNAPSHOT_LIST_LEAVES) != 0;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotTreeList) < 0 ||
@@ -4571,13 +4456,11 @@ esxDomainSnapshotListChildrenNames(virDomainSnapshotPtr snapshot,
return -1;
}
- if (nameslen == 0) {
+ if (nameslen == 0)
return 0;
- }
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotTreeList) < 0 ||
@@ -4615,9 +4498,8 @@ esxDomainSnapshotLookupByName(virDomainPtr domain, const char
*name,
virCheckFlags(0, NULL);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, domain->uuid,
&rootSnapshotTreeList) < 0 ||
@@ -4645,9 +4527,8 @@ esxDomainHasCurrentSnapshot(virDomainPtr domain, unsigned int
flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupCurrentSnapshotTree(priv->primary, domain->uuid,
¤tSnapshotTree,
@@ -4676,9 +4557,8 @@ esxDomainSnapshotGetParent(virDomainSnapshotPtr snapshot, unsigned
int flags)
virCheckFlags(0, NULL);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotList) < 0 ||
@@ -4714,9 +4594,8 @@ esxDomainSnapshotCurrent(virDomainPtr domain, unsigned int flags)
virCheckFlags(0, NULL);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return NULL;
- }
if (esxVI_LookupCurrentSnapshotTree(priv->primary, domain->uuid,
¤tSnapshotTree,
@@ -4743,9 +4622,8 @@ esxDomainSnapshotIsCurrent(virDomainSnapshotPtr snapshot, unsigned
int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
/* Check that snapshot exists. */
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
@@ -4781,9 +4659,8 @@ esxDomainSnapshotHasMetadata(virDomainSnapshotPtr snapshot, unsigned
int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
/* Check that snapshot exists. If so, there is no metadata. */
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
@@ -4815,9 +4692,8 @@ esxDomainRevertToSnapshot(virDomainSnapshotPtr snapshot, unsigned
int flags)
virCheckFlags(0, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotList) < 0 ||
@@ -4870,13 +4746,11 @@ esxDomainSnapshotDelete(virDomainSnapshotPtr snapshot, unsigned
int flags)
virCheckFlags(VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN |
VIR_DOMAIN_SNAPSHOT_DELETE_METADATA_ONLY, -1);
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
- if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN) {
+ if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN)
removeChildren = esxVI_Boolean_True;
- }
if (esxVI_LookupRootSnapshotTreeList(priv->primary, snapshot->domain->uuid,
&rootSnapshotList) < 0 ||
@@ -4941,9 +4815,8 @@ esxDomainSetMemoryParameters(virDomainPtr domain,
virTypedParameterPtr params,
NULL) < 0)
return -1;
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_LookupVirtualMachineByUuidAndPrepareForTask
(priv->primary, domain->uuid, NULL, &virtualMachine,
@@ -4955,9 +4828,8 @@ esxDomainSetMemoryParameters(virDomainPtr domain,
virTypedParameterPtr params,
for (i = 0; i < nparams; ++i) {
if (STREQ(params[i].field, VIR_DOMAIN_MEMORY_MIN_GUARANTEE)) {
- if (esxVI_Long_Alloc(&spec->memoryAllocation->reservation) < 0)
{
+ if (esxVI_Long_Alloc(&spec->memoryAllocation->reservation) < 0)
goto cleanup;
- }
spec->memoryAllocation->reservation->value =
VIR_DIV_UP(params[i].value.ul, 1024); /* Scale from kilobytes to megabytes
*/
@@ -5010,9 +4882,8 @@ esxDomainGetMemoryParameters(virDomainPtr domain,
virTypedParameterPtr params,
return 0;
}
- if (esxVI_EnsureSession(priv->primary) < 0) {
+ if (esxVI_EnsureSession(priv->primary) < 0)
return -1;
- }
if (esxVI_String_AppendValueToList
(&propertyNameList, "config.memoryAllocation.reservation") < 0
||
@@ -5249,9 +5120,8 @@ esxConnectListAllDomains(virConnectPtr conn,
cleanup:
if (doms) {
- for (id = 0; id < count; id++) {
+ for (id = 0; id < count; id++)
virDomainFree(doms[id]);
- }
VIR_FREE(doms);
}
--
2.1.3