mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
Remove unnecessary curly brackets in src/hyperv/
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
7b9710f818
commit
f9674bf277
@ -40,9 +40,8 @@ hypervNodeDeviceOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -49,9 +49,8 @@ VIR_LOG_INIT("hyperv.hyperv_driver");
|
|||||||
static void
|
static void
|
||||||
hypervFreePrivate(hypervPrivate **priv)
|
hypervFreePrivate(hypervPrivate **priv)
|
||||||
{
|
{
|
||||||
if (priv == NULL || *priv == NULL) {
|
if (priv == NULL || *priv == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if ((*priv)->client != NULL) {
|
if ((*priv)->client != NULL) {
|
||||||
/* FIXME: This leaks memory due to bugs in openwsman <= 2.2.6 */
|
/* FIXME: This leaks memory due to bugs in openwsman <= 2.2.6 */
|
||||||
@ -78,17 +77,15 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
|
|||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
/* Decline if the URI is NULL or the scheme is NULL */
|
/* Decline if the URI is NULL or the scheme is NULL */
|
||||||
if (conn->uri == NULL || conn->uri->scheme == NULL) {
|
if (conn->uri == NULL || conn->uri->scheme == NULL)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
/* Decline if the scheme is not hyperv */
|
/* Decline if the scheme is not hyperv */
|
||||||
plus = strchr(conn->uri->scheme, '+');
|
plus = strchr(conn->uri->scheme, '+');
|
||||||
|
|
||||||
if (plus == NULL) {
|
if (plus == NULL) {
|
||||||
if (STRCASENEQ(conn->uri->scheme, "hyperv")) {
|
if (STRCASENEQ(conn->uri->scheme, "hyperv"))
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (plus - conn->uri->scheme != 6 ||
|
if (plus - conn->uri->scheme != 6 ||
|
||||||
STRCASENEQLEN(conn->uri->scheme, "hyperv", 6)) {
|
STRCASENEQLEN(conn->uri->scheme, "hyperv", 6)) {
|
||||||
@ -119,9 +116,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
|
|||||||
if (VIR_ALLOC(priv) < 0)
|
if (VIR_ALLOC(priv) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0) {
|
if (hypervParseUri(&priv->parsedUri, conn->uri) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Set the port dependent on the transport protocol if no port is
|
/* Set the port dependent on the transport protocol if no port is
|
||||||
* specified. This allows us to rely on the port parameter being
|
* specified. This allows us to rely on the port parameter being
|
||||||
@ -182,9 +178,8 @@ hypervConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int flags
|
|||||||
virBufferAddLit(&query, "where ");
|
virBufferAddLit(&query, "where ");
|
||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_PHYSICAL);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_PHYSICAL);
|
||||||
|
|
||||||
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -239,9 +234,8 @@ hypervConnectGetHostname(virConnectPtr conn)
|
|||||||
|
|
||||||
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
|
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
|
||||||
|
|
||||||
if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -276,9 +270,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
|||||||
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
|
virBufferAddLit(&query, WIN32_COMPUTERSYSTEM_WQL_SELECT);
|
||||||
|
|
||||||
/* Get Win32_ComputerSystem */
|
/* Get Win32_ComputerSystem */
|
||||||
if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetWin32ComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -295,9 +288,8 @@ hypervNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
|
|||||||
"ResultClass = Win32_Processor",
|
"ResultClass = Win32_Processor",
|
||||||
computerSystem->data->Name);
|
computerSystem->data->Name);
|
||||||
|
|
||||||
if (hypervGetWin32ProcessorList(priv, &query, &processorList) < 0) {
|
if (hypervGetWin32ProcessorList(priv, &query, &processorList) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (processorList == NULL) {
|
if (processorList == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -368,9 +360,8 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
|||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
Msvm_ComputerSystem *computerSystem = NULL;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (maxids == 0) {
|
if (maxids == 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
|
||||||
virBufferAddLit(&query, "where ");
|
virBufferAddLit(&query, "where ");
|
||||||
@ -387,9 +378,8 @@ hypervConnectListDomains(virConnectPtr conn, int *ids, int maxids)
|
|||||||
computerSystem = computerSystem->next) {
|
computerSystem = computerSystem->next) {
|
||||||
ids[count++] = computerSystem->data->ProcessID;
|
ids[count++] = computerSystem->data->ProcessID;
|
||||||
|
|
||||||
if (count >= maxids) {
|
if (count >= maxids)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
@ -451,9 +441,8 @@ hypervDomainLookupByID(virConnectPtr conn, int id)
|
|||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
||||||
virBufferAsprintf(&query, "and ProcessID = %d", id);
|
virBufferAsprintf(&query, "and ProcessID = %d", id);
|
||||||
|
|
||||||
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
|
virReportError(VIR_ERR_NO_DOMAIN, _("No domain with ID %d"), id);
|
||||||
@ -486,9 +475,8 @@ hypervDomainLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
|
|||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
||||||
virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);
|
virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);
|
||||||
|
|
||||||
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN,
|
virReportError(VIR_ERR_NO_DOMAIN,
|
||||||
@ -519,9 +507,8 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
||||||
virBufferAsprintf(&query, "and ElementName = \"%s\"", name);
|
virBufferAsprintf(&query, "and ElementName = \"%s\"", name);
|
||||||
|
|
||||||
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0) {
|
if (hypervGetMsvmComputerSystemList(priv, &query, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem == NULL) {
|
if (computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN,
|
virReportError(VIR_ERR_NO_DOMAIN,
|
||||||
@ -546,9 +533,8 @@ hypervDomainSuspend(virDomainPtr domain)
|
|||||||
hypervPrivate *priv = domain->conn->privateData;
|
hypervPrivate *priv = domain->conn->privateData;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
Msvm_ComputerSystem *computerSystem = NULL;
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem->data->EnabledState !=
|
if (computerSystem->data->EnabledState !=
|
||||||
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
|
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
|
||||||
@ -575,9 +561,8 @@ hypervDomainResume(virDomainPtr domain)
|
|||||||
hypervPrivate *priv = domain->conn->privateData;
|
hypervPrivate *priv = domain->conn->privateData;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
Msvm_ComputerSystem *computerSystem = NULL;
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem->data->EnabledState !=
|
if (computerSystem->data->EnabledState !=
|
||||||
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) {
|
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) {
|
||||||
@ -607,9 +592,8 @@ hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
|
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
|
||||||
in_transition) {
|
in_transition) {
|
||||||
@ -665,9 +649,8 @@ hypervDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info)
|
|||||||
virUUIDFormat(domain->uuid, uuid_string);
|
virUUIDFormat(domain->uuid, uuid_string);
|
||||||
|
|
||||||
/* Get Msvm_ComputerSystem */
|
/* Get Msvm_ComputerSystem */
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get Msvm_VirtualSystemSettingData */
|
/* Get Msvm_VirtualSystemSettingData */
|
||||||
virBufferAsprintf(&query,
|
virBufferAsprintf(&query,
|
||||||
@ -764,15 +747,13 @@ hypervDomainGetState(virDomainPtr domain, int *state, int *reason,
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
*state = hypervMsvmComputerSystemEnabledStateToDomainState(computerSystem);
|
*state = hypervMsvmComputerSystemEnabledStateToDomainState(computerSystem);
|
||||||
|
|
||||||
if (reason != NULL) {
|
if (reason != NULL)
|
||||||
*reason = 0;
|
*reason = 0;
|
||||||
}
|
|
||||||
|
|
||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
@ -805,9 +786,8 @@ hypervDomainGetXMLDesc(virDomainPtr domain, unsigned int flags)
|
|||||||
virUUIDFormat(domain->uuid, uuid_string);
|
virUUIDFormat(domain->uuid, uuid_string);
|
||||||
|
|
||||||
/* Get Msvm_ComputerSystem */
|
/* Get Msvm_ComputerSystem */
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Get Msvm_VirtualSystemSettingData */
|
/* Get Msvm_VirtualSystemSettingData */
|
||||||
virBufferAsprintf(&query,
|
virBufferAsprintf(&query,
|
||||||
@ -932,9 +912,8 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
if (maxnames == 0) {
|
if (maxnames == 0)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_SELECT);
|
||||||
virBufferAddLit(&query, "where ");
|
virBufferAddLit(&query, "where ");
|
||||||
@ -954,18 +933,16 @@ hypervConnectListDefinedDomains(virConnectPtr conn, char **const names, int maxn
|
|||||||
|
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
if (count >= maxnames) {
|
if (count >= maxnames)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (!success) {
|
if (!success) {
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i)
|
||||||
VIR_FREE(names[i]);
|
VIR_FREE(names[i]);
|
||||||
}
|
|
||||||
|
|
||||||
count = -1;
|
count = -1;
|
||||||
}
|
}
|
||||||
@ -1022,9 +999,8 @@ hypervDomainCreateWithFlags(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
|
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
|
||||||
@ -1103,9 +1079,8 @@ hypervDomainIsActive(virDomainPtr domain)
|
|||||||
hypervPrivate *priv = domain->conn->privateData;
|
hypervPrivate *priv = domain->conn->privateData;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
Msvm_ComputerSystem *computerSystem = NULL;
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
|
result = hypervIsMsvmComputerSystemActive(computerSystem, NULL) ? 1 : 0;
|
||||||
|
|
||||||
@ -1144,9 +1119,8 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
|
if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) ||
|
||||||
in_transition) {
|
in_transition) {
|
||||||
@ -1175,9 +1149,8 @@ hypervDomainHasManagedSaveImage(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
result = computerSystem->data->EnabledState ==
|
result = computerSystem->data->EnabledState ==
|
||||||
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0;
|
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED ? 1 : 0;
|
||||||
@ -1199,9 +1172,8 @@ hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags)
|
|||||||
|
|
||||||
virCheckFlags(0, -1);
|
virCheckFlags(0, -1);
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) {
|
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (computerSystem->data->EnabledState !=
|
if (computerSystem->data->EnabledState !=
|
||||||
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
|
MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) {
|
||||||
@ -1338,9 +1310,8 @@ hypervConnectListAllDomains(virConnectPtr conn,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (doms) {
|
if (doms) {
|
||||||
for (i = 0; i < count; ++i) {
|
for (i = 0; i < count; ++i)
|
||||||
virDomainFree(doms[i]);
|
virDomainFree(doms[i]);
|
||||||
}
|
|
||||||
|
|
||||||
VIR_FREE(doms);
|
VIR_FREE(doms);
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ hypervInterfaceOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ hypervNetworkOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ hypervNWFilterOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ hypervSecretOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,8 @@ hypervStorageOpen(virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
if (conn->driver->no != VIR_DRV_HYPERV) {
|
if (conn->driver->no != VIR_DRV_HYPERV)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
|
||||||
|
|
||||||
return VIR_DRV_OPEN_SUCCESS;
|
return VIR_DRV_OPEN_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -78,9 +78,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (result < 0) {
|
if (result < 0)
|
||||||
hypervFreeParsedUri(parsedUri);
|
hypervFreeParsedUri(parsedUri);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -90,9 +89,8 @@ hypervParseUri(hypervParsedUri **parsedUri, virURIPtr uri)
|
|||||||
void
|
void
|
||||||
hypervFreeParsedUri(hypervParsedUri **parsedUri)
|
hypervFreeParsedUri(hypervParsedUri **parsedUri)
|
||||||
{
|
{
|
||||||
if (parsedUri == NULL || *parsedUri == NULL) {
|
if (parsedUri == NULL || *parsedUri == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
VIR_FREE((*parsedUri)->transport);
|
VIR_FREE((*parsedUri)->transport);
|
||||||
|
|
||||||
|
@ -157,9 +157,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
|
|
||||||
response = wsmc_action_enumerate(priv->client, root, options, filter);
|
response = wsmc_action_enumerate(priv->client, root, options, filter);
|
||||||
|
|
||||||
if (hyperyVerifyResponse(priv->client, response, "enumeration") < 0) {
|
if (hyperyVerifyResponse(priv->client, response, "enumeration") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
enumContext = wsmc_get_enum_context(response);
|
enumContext = wsmc_get_enum_context(response);
|
||||||
|
|
||||||
@ -170,9 +169,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
response = wsmc_action_pull(priv->client, resourceUri, options,
|
response = wsmc_action_pull(priv->client, resourceUri, options,
|
||||||
filter, enumContext);
|
filter, enumContext);
|
||||||
|
|
||||||
if (hyperyVerifyResponse(priv->client, response, "pull") < 0) {
|
if (hyperyVerifyResponse(priv->client, response, "pull") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
node = ws_xml_get_soap_body(response);
|
node = ws_xml_get_soap_body(response);
|
||||||
|
|
||||||
@ -198,9 +196,8 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ws_xml_get_child(node, 0, resourceUri, className) == NULL) {
|
if (ws_xml_get_child(node, 0, resourceUri, className) == NULL)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
data = ws_deserialize(serializerContext, node, serializerInfo,
|
data = ws_deserialize(serializerContext, node, serializerInfo,
|
||||||
className, resourceUri, NULL, 0, 0);
|
className, resourceUri, NULL, 0, 0);
|
||||||
@ -240,13 +237,11 @@ hypervEnumAndPull(hypervPrivate *priv, virBufferPtr query, const char *root,
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (options != NULL) {
|
if (options != NULL)
|
||||||
wsmc_options_destroy(options);
|
wsmc_options_destroy(options);
|
||||||
}
|
|
||||||
|
|
||||||
if (filter != NULL) {
|
if (filter != NULL)
|
||||||
filter_destroy(filter);
|
filter_destroy(filter);
|
||||||
}
|
|
||||||
|
|
||||||
if (data != NULL) {
|
if (data != NULL) {
|
||||||
#if WS_SERIALIZER_FREE_MEM_WORKS
|
#if WS_SERIALIZER_FREE_MEM_WORKS
|
||||||
@ -275,9 +270,8 @@ hypervFreeObject(hypervPrivate *priv ATTRIBUTE_UNUSED, hypervObject *object)
|
|||||||
WsSerializerContextH serializerContext;
|
WsSerializerContextH serializerContext;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (object == NULL) {
|
if (object == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
#if WS_SERIALIZER_FREE_MEM_WORKS
|
#if WS_SERIALIZER_FREE_MEM_WORKS
|
||||||
serializerContext = wsmc_get_serialization_context(priv->client);
|
serializerContext = wsmc_get_serialization_context(priv->client);
|
||||||
@ -431,9 +425,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
|
|||||||
response = wsmc_action_invoke(priv->client, MSVM_COMPUTERSYSTEM_RESOURCE_URI,
|
response = wsmc_action_invoke(priv->client, MSVM_COMPUTERSYSTEM_RESOURCE_URI,
|
||||||
options, "RequestStateChange", NULL);
|
options, "RequestStateChange", NULL);
|
||||||
|
|
||||||
if (hyperyVerifyResponse(priv->client, response, "invocation") < 0) {
|
if (hyperyVerifyResponse(priv->client, response, "invocation") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
/* Check return value */
|
/* Check return value */
|
||||||
returnValue = ws_xml_get_xpath_value(response, (char *)"/s:Envelope/s:Body/p:RequestStateChange_OUTPUT/p:ReturnValue");
|
returnValue = ws_xml_get_xpath_value(response, (char *)"/s:Envelope/s:Body/p:RequestStateChange_OUTPUT/p:ReturnValue");
|
||||||
@ -468,9 +461,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
|
|||||||
virBufferAddLit(&query, MSVM_CONCRETEJOB_WQL_SELECT);
|
virBufferAddLit(&query, MSVM_CONCRETEJOB_WQL_SELECT);
|
||||||
virBufferAsprintf(&query, "where InstanceID = \"%s\"", instanceID);
|
virBufferAsprintf(&query, "where InstanceID = \"%s\"", instanceID);
|
||||||
|
|
||||||
if (hypervGetMsvmConcreteJobList(priv, &query, &concreteJob) < 0) {
|
if (hypervGetMsvmConcreteJobList(priv, &query, &concreteJob) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
|
||||||
|
|
||||||
if (concreteJob == NULL) {
|
if (concreteJob == NULL) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
@ -521,9 +513,8 @@ hypervInvokeMsvmComputerSystemRequestStateChange(virDomainPtr domain,
|
|||||||
result = 0;
|
result = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
if (options != NULL) {
|
if (options != NULL)
|
||||||
wsmc_options_destroy(options);
|
wsmc_options_destroy(options);
|
||||||
}
|
|
||||||
|
|
||||||
ws_xml_destroy_doc(response);
|
ws_xml_destroy_doc(response);
|
||||||
VIR_FREE(selector);
|
VIR_FREE(selector);
|
||||||
@ -576,9 +567,8 @@ bool
|
|||||||
hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *computerSystem,
|
hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *computerSystem,
|
||||||
bool *in_transition)
|
bool *in_transition)
|
||||||
{
|
{
|
||||||
if (in_transition != NULL) {
|
if (in_transition != NULL)
|
||||||
*in_transition = false;
|
*in_transition = false;
|
||||||
}
|
|
||||||
|
|
||||||
switch (computerSystem->data->EnabledState) {
|
switch (computerSystem->data->EnabledState) {
|
||||||
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_UNKNOWN:
|
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_UNKNOWN:
|
||||||
@ -602,9 +592,8 @@ hypervIsMsvmComputerSystemActive(Msvm_ComputerSystem *computerSystem,
|
|||||||
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_STOPPING:
|
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_STOPPING:
|
||||||
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSING:
|
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSING:
|
||||||
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_RESUMING:
|
case MSVM_COMPUTERSYSTEM_ENABLEDSTATE_RESUMING:
|
||||||
if (in_transition != NULL) {
|
if (in_transition != NULL)
|
||||||
*in_transition = true;
|
*in_transition = true;
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -634,9 +623,8 @@ hypervMsvmComputerSystemToDomain(virConnectPtr conn,
|
|||||||
|
|
||||||
*domain = virGetDomain(conn, computerSystem->data->ElementName, uuid);
|
*domain = virGetDomain(conn, computerSystem->data->ElementName, uuid);
|
||||||
|
|
||||||
if (*domain == NULL) {
|
if (*domain == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
|
if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) {
|
||||||
(*domain)->id = computerSystem->data->ProcessID;
|
(*domain)->id = computerSystem->data->ProcessID;
|
||||||
@ -667,9 +655,8 @@ hypervMsvmComputerSystemFromDomain(virDomainPtr domain,
|
|||||||
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
virBufferAddLit(&query, MSVM_COMPUTERSYSTEM_WQL_VIRTUAL);
|
||||||
virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);
|
virBufferAsprintf(&query, "and Name = \"%s\"", uuid_string);
|
||||||
|
|
||||||
if (hypervGetMsvmComputerSystemList(priv, &query, computerSystem) < 0) {
|
if (hypervGetMsvmComputerSystemList(priv, &query, computerSystem) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
|
|
||||||
if (*computerSystem == NULL) {
|
if (*computerSystem == NULL) {
|
||||||
virReportError(VIR_ERR_NO_DOMAIN,
|
virReportError(VIR_ERR_NO_DOMAIN,
|
||||||
|
Loading…
Reference in New Issue
Block a user