1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-23 21:34:54 +03:00

hyperv: Don't overwrite errors from hypervCreateInvokeParamsList()

The hypervCreateInvokeParamsList() function sets an error on a
failure, therefore there is no need to report another error in
callers.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Matt Coleman <matt@datto.com>
This commit is contained in:
Michal Privoznik 2020-10-21 14:25:37 +02:00
parent 4505f11d65
commit 458e2d6fc5

View File

@ -1004,6 +1004,8 @@ hypervDomainShutdownFlags(virDomainPtr domain, unsigned int flags)
params = hypervCreateInvokeParamsList(priv, "InitiateShutdown", selector,
Msvm_ShutdownComponent_WmiInfo);
if (!params)
goto cleanup;
hypervAddSimpleParam(params, "Force", "False");
@ -1484,10 +1486,8 @@ hypervDomainSetAutostart(virDomainPtr domain, int autostart)
MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR,
Msvm_VirtualSystemManagementService_WmiInfo);
if (!params) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create params"));
if (!params)
goto cleanup;
}
if (priv->wmiVersion == HYPERV_WMI_VERSION_V1) {
virBufferEscapeSQL(&eprQuery,
@ -1917,10 +1917,8 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int codeset,
params = hypervCreateInvokeParamsList(priv, "PressKey", selector,
Msvm_Keyboard_WmiInfo);
if (!params) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create param"));
if (!params)
goto cleanup;
}
if (hypervAddSimpleParam(params, "keyCode", keycodeStr) < 0)
goto cleanup;
@ -1942,10 +1940,8 @@ hypervDomainSendKey(virDomainPtr domain, unsigned int codeset,
params = hypervCreateInvokeParamsList(priv, "ReleaseKey", selector,
Msvm_Keyboard_WmiInfo);
if (!params) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create param"));
if (!params)
goto cleanup;
}
if (hypervAddSimpleParam(params, "keyCode", keycodeStr) < 0)
goto cleanup;
@ -2001,10 +1997,8 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR,
Msvm_VirtualSystemManagementService_WmiInfo);
if (!params) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create params"));
if (!params)
goto cleanup;
}
virBufferAddLit(&eprQuery, MSVM_COMPUTERSYSTEM_WQL_SELECT);
virBufferEscapeSQL(&eprQuery, "where Name = \"%s\"", uuid_string);
@ -2017,11 +2011,9 @@ hypervDomainSetMemoryFlags(virDomainPtr domain, unsigned long memory,
MSVM_VIRTUALSYSTEMMANAGEMENTSERVICE_SELECTOR,
Msvm_VirtualSystemManagementService_WmiInfo);
if (!params) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Could not create params"));
if (!params)
goto cleanup;
}
}
memResource = hypervCreateEmbeddedParam(priv, Msvm_MemorySettingData_WmiInfo);
if (!memResource)