Re: [PATCH 5/7] hyperv: fix domainSuspend and domainResume on Hyper-V V2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 09, 2020 at 04:31:54AM -0400, Matt Coleman wrote:
> Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
> ---
>  src/hyperv/hyperv_driver.c      | 15 +++++++++++----
>  src/hyperv/hyperv_wmi_classes.h |  1 +
>  2 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
> index 0b28c1e94b..89840f7ac4 100644
> --- a/src/hyperv/hyperv_driver.c
> +++ b/src/hyperv/hyperv_driver.c
> @@ -867,6 +867,10 @@ hypervDomainSuspend(virDomainPtr domain)
>      int result = -1;
>      hypervPrivate *priv = domain->conn->privateData;
>      Msvm_ComputerSystem *computerSystem = NULL;
> +    int requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_PAUSED;
> +
> +    if (priv->wmiVersion == HYPERV_WMI_VERSION_V2)
> +        requestedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE;

Is quiesce really what we want here ?

The libvirt  Suspend/Resume APIs are specifically about pausing
execution of the guest CPUs.

IIUC, quiesce usually just refers to suspending I/O processing,
in order to allow snapshots to be taken, but CPUs stay running.

>  
>      if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
>          goto cleanup;
> @@ -878,8 +882,8 @@ hypervDomainSuspend(virDomainPtr domain)
>          goto cleanup;
>      }
>  
> -    result = hypervInvokeMsvmComputerSystemRequestStateChange
> -               (domain, MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_PAUSED);
> +    result = hypervInvokeMsvmComputerSystemRequestStateChange(domain,
> +                                                              requestedState);
>  
>   cleanup:
>      hypervFreeObject(priv, (hypervObject *)computerSystem);
> @@ -895,12 +899,15 @@ hypervDomainResume(virDomainPtr domain)
>      int result = -1;
>      hypervPrivate *priv = domain->conn->privateData;
>      Msvm_ComputerSystem *computerSystem = NULL;
> +    int expectedState = MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED;
> +
> +    if (priv->wmiVersion == HYPERV_WMI_VERSION_V2)
> +        expectedState = MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_QUIESCE;
>  
>      if (hypervMsvmComputerSystemFromDomain(domain, &computerSystem) < 0)
>          goto cleanup;
>  
> -    if (computerSystem->data.common->EnabledState !=
> -        MSVM_COMPUTERSYSTEM_ENABLEDSTATE_PAUSED) {
> +    if (computerSystem->data.common->EnabledState != expectedState) {
>          virReportError(VIR_ERR_OPERATION_INVALID, "%s",
>                         _("Domain is not paused"));
>          goto cleanup;
> diff --git a/src/hyperv/hyperv_wmi_classes.h b/src/hyperv/hyperv_wmi_classes.h
> index 7f4159dd8e..0074d8889e 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_QUIESCE = 9,
>      MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_REBOOT = 10,
>      MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_RESET = 11,
>      MSVM_COMPUTERSYSTEM_REQUESTEDSTATE_PAUSED = 32768,
> -- 
> 2.27.0
> 
> 

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux