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