Re: [PATCH v2 09/10] hyperv: implement domainGetAutostart

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

 



On Mon, Oct 5, 2020 at 12:21 PM Matt Coleman <mcoleman@xxxxxxxxx> wrote:
>
> Co-authored-by: Sri Ramanujam <sramanujam@xxxxxxxxx>
> Signed-off-by: Matt Coleman <matt@xxxxxxxxx>
> ---
>  src/hyperv/hyperv_driver.c | 40 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/src/hyperv/hyperv_driver.c b/src/hyperv/hyperv_driver.c
> index 528c826e16..dcde469442 100644
> --- a/src/hyperv/hyperv_driver.c
> +++ b/src/hyperv/hyperv_driver.c
> @@ -1274,6 +1274,45 @@ hypervDomainCreate(virDomainPtr domain)
>
>
>
> +static int
> +hypervDomainGetAutostart(virDomainPtr domain, int *autostart)
> +{
> +    int result = -1;
> +    char uuid_string[VIR_UUID_STRING_BUFLEN];
> +    hypervPrivate *priv = domain->conn->privateData;
> +    g_auto(virBuffer) query = VIR_BUFFER_INITIALIZER;
> +    Msvm_VirtualSystemGlobalSettingData *vsgsd = NULL;
> +    Msvm_VirtualSystemSettingData *vssd = NULL;
> +
> +    virUUIDFormat(domain->uuid, uuid_string);
> +
> +    if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
> +        virBufferEscapeSQL(&query,
> +                           MSVM_VIRTUALSYSTEMGLOBALSETTINGDATA_WQL_SELECT
> +                           "WHERE SystemName = \"%s\"", uuid_string);
> +
> +        if (hypervGetWmiClass(Msvm_VirtualSystemGlobalSettingData, &vsgsd) < 0)
> +            goto cleanup;
> +
> +        *autostart = vsgsd->data.common->AutomaticStartupAction == 2;
> +        result = 0;
> +    } else {
> +        if (hypervGetVSSDFromUUID(priv, uuid_string, &vssd) < 0)
> +            goto cleanup;
> +
> +        *autostart = vssd->data.v2->AutomaticStartupAction == 4;
> +        result = 0;
> +    }
> +
> +    cleanup:
> +    hypervFreeObject(priv, (hypervObject *) vsgsd);
> +    hypervFreeObject(priv, (hypervObject *) vssd);
> +
> +    return result;
> +}
> +
> +
> +
>  static int
>  hypervConnectIsEncrypted(virConnectPtr conn)
>  {
> @@ -1824,6 +1863,7 @@ static virHypervisorDriver hypervHypervisorDriver = {
>      .connectNumOfDefinedDomains = hypervConnectNumOfDefinedDomains, /* 0.9.5 */
>      .domainCreate = hypervDomainCreate, /* 0.9.5 */
>      .domainCreateWithFlags = hypervDomainCreateWithFlags, /* 0.9.5 */
> +    .domainGetAutostart = hypervDomainGetAutostart, /* 6.9.0 */
>      .connectIsEncrypted = hypervConnectIsEncrypted, /* 0.9.5 */
>      .connectIsSecure = hypervConnectIsSecure, /* 0.9.5 */
>      .domainIsActive = hypervDomainIsActive, /* 0.9.5 */
> --
> 2.27.0
>
>

Reviewed-by: Neal Gompa <ngompa13@xxxxxxxxx>


-- 
真実はいつも一つ!/ Always, there's only one truth!





[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