hyperv: Use hypervRequestStateChange() in hypervDomainSuspend()
A few commits ago, hypervRequestStateChange() helper was introduced which has exactly the same code as a part of hypervDomainSuspend(). Deduplicate by calling the helper. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Matt Coleman <matt@datto.com>
This commit is contained in:
parent
458e2d6fc5
commit
864d79e452
@ -893,9 +893,7 @@ hypervDomainLookupByName(virConnectPtr conn, const char *name)
|
|||||||
static int
|
static int
|
||||||
hypervDomainSuspend(virDomainPtr domain)
|
hypervDomainSuspend(virDomainPtr domain)
|
||||||
{
|
{
|
||||||
int result = -1;
|
|
||||||
hypervPrivate *priv = domain->conn->privateData;
|
hypervPrivate *priv = domain->conn->privateData;
|
||||||
Msvm_ComputerSystem *computerSystem = NULL;
|
|
||||||
int requestedState = -1;
|
int requestedState = -1;
|
||||||
|
|
||||||
switch (priv->wmiVersion) {
|
switch (priv->wmiVersion) {
|
||||||
@ -907,20 +905,7 @@ hypervDomainSuspend(virDomainPtr domain)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
|
return hypervRequestStateChange(domain, requestedState);
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (computerSystem->data.common->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_ENABLED) {
|
|
||||||
virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not active"));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, requestedState);
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
hypervFreeObject(priv, (hypervObject *)computerSystem);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user