Signed-off-by: Matt Coleman <matt(a)datto.com>
---
src/hyperv/hyperv_driver.c | 8 ++++++--
src/hyperv/hyperv_wmi_classes.h | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
index aeee5b2b9f..fb46f42631 100644
--- a/src/hyperv/hyperv_driver.c
+++ b/src/hyperv/hyperv_driver.c
@@ -1644,6 +1644,10 @@ hypervDomainManagedSave(virDomainPtr domain, unsigned int flags)
hypervPrivate *priv = domain->conn->privateData;
Msvm_ComputerSystem *computerSystem = NULL;
bool in_transition = false;
+ int requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_SUSPENDED;
+
+ if (priv->wmiVersion == HYPERV_WMI_VERSION_V2)
+ requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_ENABLED_BUT_OFFLINE;
virCheckFlags(0, -1);
@@ -1657,8 +1661,8 @@ 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..a5213901c8 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_ENABLED_BUT_OFFLINE = 6,
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE = 9,
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_REBOOT = 10,
MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_RESET = 11,
--
2.27.0