[PATCH 1/7] hyperv: implement domainSetAutostart

Pino Toscano ptoscano at redhat.com
Fri Oct 9 08:58:34 UTC 2020


On Friday, 9 October 2020 10:31:50 CEST Matt Coleman wrote:
> +static int
> +hypervDomainSetAutostart(virDomainPtr domain, int autostart)
> +{
> +    int result = -1;
> +    char uuid_string[VIR_UUID_STRING_BUFLEN];
> +    hypervPrivate *priv = domain->conn->privateData;
> +    Msvm_VirtualSystemSettingData *vssd = NULL;
> +    hypervInvokeParamsListPtr params = NULL;
> +    g_auto(virBuffer) eprQuery = VIR_BUFFER_INITIALIZER;
> +    virHashTablePtr autostartParam = NULL;
> +    hypervWmiClassInfoListPtr embeddedParamClass = NULL;
> +    const char *methodName = NULL, *embeddedParamName = NULL;
> +    g_autofree char *enabledValue = NULL, *disabledValue = NULL;
> +
> +    if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
> +        methodName = "ModifyVirtualSystem";
> +        embeddedParamName = "SystemSettingData";
> +        embeddedParamClass = Msvm_VirtualSystemGlobalSettingData_WmiInfo;
> +        enabledValue = g_strdup("2");
> +        disabledValue = g_strdup("0");
> +    } else if (priv->wmiVersion == HYPERV_WMI_VERSION_V2) {
> +        methodName = "ModifySystemSettings";
> +        embeddedParamName = "SystemSettings";
> +        embeddedParamClass = Msvm_VirtualSystemSettingData_WmiInfo;
> +        enabledValue = g_strdup("4");
> +        disabledValue = g_strdup("2");
> +    }

It looks like 'enabledValue' and 'disabledValue' can be static strings
(like 'methodName' and 'embeddedParamName').

-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20201009/d594cb8f/attachment-0001.sig>


More information about the libvir-list mailing list