Re: [PATCH 09/16] hyperv: add domain shutdown function

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

 




On 08/09/2016 08:39 AM, Jason Miesionczek wrote:
> ---
>  src/hyperv/hyperv_driver.c | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
> index 4c094e7..2623916 100644
> --- a/src/hyperv/hyperv_driver.c
> +++ b/src/hyperv/hyperv_driver.c
> @@ -1704,6 +1704,39 @@ hypervDomainGetAutostart(virDomainPtr domain, int *autostart)
>      return result;
>  }
>  
> +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;
> +}

Beyond the long lines - it strikes me that shouldn't a DomainShutdown do
some sort of shutdown?  From just the name, it would seem that
hypervInvokeMsvmComputerSystemRequestStateChange doesn't do that
shutdown, but rather inhibits changing state.

Functionally, it's just not clear this is doing all it needs to do.

> +
> +static int
> +hypervDomainShutdown(virDomainPtr dom)
> +{
> +    return hypervDomainShutdownFlags(dom, 0);
> +}
> +
>  static virHypervisorDriver hypervHypervisorDriver = {
>      .name = "Hyper-V",
>      .connectOpen = hypervConnectOpen, /* 0.9.5 */
> @@ -1747,6 +1780,8 @@ static virHypervisorDriver hypervHypervisorDriver = {
>      .domainGetVcpus = hypervDomainGetVcpus, /* 1.2.10 */
>      .domainSetAutostart = hypervDomainSetAutostart, /* 1.2.10 */
>      .domainGetAutostart = hypervDomainGetAutostart, /* 1.2.10 */
> +    .domainShutdownFlags = hypervDomainShutdownFlags, /* 1.2.10 */
> +    .domainShutdown = hypervDomainShutdown, /* 1.2.10 */

2.3.0 at the earliest

John

>  };
>  
>  /* Retrieves host system UUID  */
> 

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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]