static int hypervDomainDestroyFlags(virDomainPtr domain, unsigned int flags) { int result = -1; hypervPrivate *priv = domain->conn->privateData; Msvm_ComputerSystem *computerSystem = NULL; bool in_transition = false; virCheckFlags(0, -1); if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) { goto cleanup; } if (!hypervIsMsvmComputerSystemActive(computerSystem, &in_transition) || in_transition) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not active or is in state transition")); goto cleanup; } result = hypervInvokeMsvmComputerSystemRequestStateChange (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED); cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); return result; }
static int hypervDomainManagedSaveRemove(virDomainPtr domain, unsigned int flags) { int result = -1; hypervPrivate *priv = domain->conn->privateData; Msvm_ComputerSystem *computerSystem = NULL; virCheckFlags(0, -1); if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) { goto cleanup; } if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_SUSPENDED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain has no managed save image")); goto cleanup; } result = hypervInvokeMsvmComputerSystemRequestStateChange (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED); cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); return result; }
static int hypervDomainResume(virDomainPtr domain) { int result = -1; hypervPrivate *priv = domain->conn->privateData; Msvm_ComputerSystem *computerSystem = NULL; if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) { goto cleanup; } if (computerSystem->data->EnabledState != MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) { virReportError(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is not paused")); goto cleanup; } result = hypervInvokeMsvmComputerSystemRequestStateChange (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED); cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); return result; }
static int hypervDomainCreateWithFlags(virDomainPtr domain, unsigned int flags) { int result = -1; hypervPrivate *priv = domain->conn->privateData; Msvm_ComputerSystem *computerSystem = NULL; virCheckFlags(0, -1); if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) { goto cleanup; } if (hypervIsMsvmComputerSystemActive(computerSystem, NULL)) { HYPERV_ERROR(VIR_ERR_OPERATION_INVALID, "%s", _("Domain is already active or is in state transition")); goto cleanup; } result = hypervInvokeMsvmComputerSystemRequestStateChange (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED); cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); return result; }