Signed-off-by: Matt Coleman <matt@xxxxxxxxx> --- src/hyperv/hyperv_driver.c | 13 +++++++++++-- src/hyperv/hyperv_wmi_classes.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 4c70af6496..a077146e35 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -1643,6 +1643,16 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags) hypervPrivate *priv = domain->conn->privateData; Msvm_ComputerSystem *computerSystem = NULL; bool in_transition = false; + int requestedState; + + switch (priv->wmiVersion) { + case HYPERV_WMI_VERSION_V1: + requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_SUSPENDED; + break; + case HYPERV_WMI_VERSION_V2: + requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_OFFLINE; + break; + } virCheckFlags(0, -1); @@ -1656,8 +1666,7 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags) goto cleanup; } - result = hypervInvokeMsvmComputerSystemRequestStateChange - (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_SUSPENDED); + result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, requestedState); cleanup: hypervFreeObject(priv, (hypervObject *)computerSystem); diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h index 0074d8889e..b9d8dfcf38 100644 --- a/src/hyperv/hyperv_wmi_classes.h +++ b/src/hyperv/hyperv_wmi_classes.h @@ -73,6 +73,7 @@ enum _Msvm_ComputerSystem_EnabledState { enum _Msvm_ComputerSystem_RequestedState { MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED = 2, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_DISABLED = 3, + MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_OFFLINE = 6, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE = 9, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_REBOOT = 10, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_RESET = 11, -- 2.27.0