mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
hyperv: Fix hypervInitConnection error reporting
"%s is not a Hyper-V server" is not a correct generalization of all possible error conditions of hypervEnumAndPull. For example: $ virsh --connect hyperv://localhost/?transport=http Enter username for localhost [administrator]: Enter administrator's password for localhost: <enters incorrect password> error: failed to connect to the hypervisor error: internal error: localhost is not a Hyper-V server This commit removes the general virReportError from hypervInitConnection and also the "Invalid query" virReportError from hypervSerializeEprParam, which does not correctly describe the error either (virBufferCheckError has already set a meaningful error message at that point). The same scenario with the fix: $ virsh --connect hyperv://localhost/?transport=http Enter username for localhost [administrator]: Enter administrator's password for localhost: <enters incorrect password> error: failed to connect to the hypervisor error: internal error: Transport error during enumeration: User, password or similar was not accepted (26) Signed-off-by: Ladi Prosek <lprosek@redhat.com>
This commit is contained in:
parent
441d3eb6d1
commit
bb8c2a76ca
@ -104,12 +104,9 @@ hypervInitConnection(virConnectPtr conn, hypervPrivate *priv,
|
|||||||
/* fall back to V1 namespace (for Hyper-V 2008) */
|
/* fall back to V1 namespace (for Hyper-V 2008) */
|
||||||
priv->wmiVersion = HYPERV_WMI_VERSION_V1;
|
priv->wmiVersion = HYPERV_WMI_VERSION_V1;
|
||||||
|
|
||||||
if (hypervEnumAndPull(priv, &wqlQuery, &computerSystem) < 0) {
|
if (hypervEnumAndPull(priv, &wqlQuery, &computerSystem) < 0)
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
_("%s is not a Hyper-V server"), conn->uri->server);
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
|
@ -514,7 +514,6 @@ hypervSerializeEprParam(hypervParamPtr p, hypervPrivate *priv,
|
|||||||
/* Get query and create filter based on it */
|
/* Get query and create filter based on it */
|
||||||
if (virBufferCheckError(p->epr.query) < 0) {
|
if (virBufferCheckError(p->epr.query) < 0) {
|
||||||
virBufferFreeAndReset(p->epr.query);
|
virBufferFreeAndReset(p->epr.query);
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid query"));
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
query_string = virBufferContentAndReset(p->epr.query);
|
query_string = virBufferContentAndReset(p->epr.query);
|
||||||
|
Loading…
Reference in New Issue
Block a user