]> xenbits.xensource.com Git - libvirt.git/commitdiff
hyperv: provide a more detailed error message for WSMan faults
authorMatt Coleman <mcoleman@datto.com>
Tue, 2 Feb 2021 00:48:47 +0000 (19:48 -0500)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 2 Feb 2021 08:36:35 +0000 (09:36 +0100)
Signed-off-by: Matt Coleman <matt@datto.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/hyperv/hyperv_wmi.c

index 4c1bd5e0d2a97840b7515b97b5e5a063147eeedf..c14ff0e64a2efeba114f60a6c61b92f5babe7960 100644 (file)
@@ -789,9 +789,18 @@ hypervInvokeMethod(hypervPrivate *priv,
 
     returnValue = ws_xml_get_xpath_value(response, returnValue_xpath);
     if (!returnValue) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("Could not get return value for %s invocation"),
-                       params->method);
+        g_autofree char *faultReason_xpath = g_strdup("/s:Envelope/s:Body/s:Fault/s:Reason/s:Text");
+        g_autofree char *faultReason = ws_xml_get_xpath_value(response, faultReason_xpath);
+
+        if (faultReason)
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("WS-Management fault during %s invocation: %s"),
+                           params->method, faultReason);
+        else
+            virReportError(VIR_ERR_INTERNAL_ERROR,
+                           _("Could not get return value for %s invocation"),
+                           params->method);
+
         return -1;
     }