On 4/14/26 4:12 AM, Peter Krempa wrote:
On Fri, Apr 10, 2026 at 14:20:00 -0500, Jonathon Jongsma via Devel wrote:
When invoking a method in WMI, it can either return synchronously or asynchronously (with return value 4096). In the latter case, the output parameters of the method are not present in the method response xml document. We have to fetch the output parameters via associations with the Job object that is returned in the method response.
the hypervInvokeMethod() function already partially handles the async case by polling the job until it fails, completes successfully, or times out. This patch adds a utility function to fetch a named output parameter from a given method response xml document. It handles both synchronous and asynchronous cases.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com> ---
[...]
+ if (job_node) + job_id = hypervOutputParamReferenceId(job_node); + + if (!job_id) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Could not find Job ID in async method response")); + return -1; + } + VIR_DEBUG("Method response was asynchronous. Job ID = %1$s", job_id); + virBufferEscapeSQL(&query, + "ASSOCIATORS OF {Msvm_ConcreteJob.InstanceID='%s'} ", + job_id); + virBufferAsprintf(&query, + "WHERE AssocClass = Msvm_AffectedJobElement " + "ResultClass = %s", + paramClassInfo->name);
These don't need this weird alignment at all.
+ } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected return code %1$d in method response"), + return_code); + return -1; + } + + hypervGetWmiClassList(priv, paramClassInfo, &query, outParam);
No error handling? Didn't you want to do a return hypervGet..? here?
Yes of course. Thanks for catching. I'll fix this and the minor formatting issues before pushing. Jonathon
+ return 0; +}
Reviewed-by: Peter Krempa <pkrempa@redhat.com>