From: yvinter <yves.vinter@xxxxxxxx> --- src/hyperv/hyperv_driver.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 191c7dd..aadadb1 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1745,6 +1745,43 @@ hypervNodeGetFreeMemory(virConnectPtr conn) +static int +hypervDomainShutdownFlags(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 +hypervDomainShutdown(virDomainPtr dom) +{ + return hypervDomainShutdownFlags(dom, 0); +} + + + static virDriver hypervDriver = { .no = VIR_DRV_HYPERV, .name = "Hyper-V", @@ -1787,6 +1824,8 @@ static virDriver hypervDriver = { .domainGetVcpusFlags = hypervDomainGetVcpusFlags, /* 1.2.10 */ .domainGetVcpus = hypervDomainGetVcpus, /* 1.2.10 */ .nodeGetFreeMemory = hypervNodeGetFreeMemory, /* 1.2.10 */ + .domainShutdownFlags = hypervDomainShutdownFlags, /* 1.2.10 */ + .domainShutdown = hypervDomainShutdown, /* 1.2.10 */ }; -- 1.9.1 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list