
On 10/21/20 10:46 AM, Matt Coleman wrote:
Co-authored-by: Sri Ramanujam <sramanujam@datto.com> Signed-off-by: Matt Coleman <matt@datto.com> --- src/hyperv/hyperv_driver.c | 38 +++++++++++++++++++++++++++++++++ src/hyperv/hyperv_wmi_classes.h | 1 + 2 files changed, 39 insertions(+)
diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c index 7387be1ab7..4bddc86273 100644 --- a/src/hyperv/hyperv_driver.c +++ b/src/hyperv/hyperv_driver.c @@ -286,6 +286,24 @@ hypervGetMemSDByVSSDInstanceId(hypervPrivate *priv, const char *id, return 0; }
+static int +hypervRequestStateChange(virDomainPtr domain, int state) +{ + int result = -1; + hypervPrivate *priv = domain->conn->privateData; + Msvm_ComputerSystem *computerSystem = NULL; + + if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0) + goto cleanup; +
Should we also check if the domain is running? That is, the same check as hypervDomainSuspend() does with @computerSystem? I can copy the check locally, before pushing.
+ result = hypervInvokeMsvmComputerSystemRequestStateChange(domain, state); + + cleanup: + hypervFreeObject(priv, (hypervObject *)computerSystem); + + return result; +} +
Michal