mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
esx: Report an error for acceptable URI schemes with a transport
Before, URIs such as esx+ssh:// have been declined by the ESX driver resulting in the remote driver trying to connect to an non-existing libvirtd. Now such URIs trigger an error in the ESX driver suggesting to try again without the transport part in the scheme.
This commit is contained in:
parent
c7d1f5980b
commit
3d308f75c1
@ -938,20 +938,41 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth,
|
|||||||
unsigned int flags)
|
unsigned int flags)
|
||||||
{
|
{
|
||||||
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
virDrvOpenStatus result = VIR_DRV_OPEN_ERROR;
|
||||||
|
char *plus;
|
||||||
esxPrivate *priv = NULL;
|
esxPrivate *priv = NULL;
|
||||||
char *potentialVCenterIpAddress = NULL;
|
char *potentialVCenterIpAddress = NULL;
|
||||||
char vCenterIpAddress[NI_MAXHOST] = "";
|
char vCenterIpAddress[NI_MAXHOST] = "";
|
||||||
|
|
||||||
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
|
||||||
|
|
||||||
/* Decline if the URI is NULL or the scheme is not one of {vpx|esx|gsx} */
|
/* Decline if the URI is NULL or the scheme is NULL */
|
||||||
if (conn->uri == NULL || conn->uri->scheme == NULL ||
|
if (conn->uri == NULL || conn->uri->scheme == NULL) {
|
||||||
(STRCASENEQ(conn->uri->scheme, "vpx") &&
|
|
||||||
STRCASENEQ(conn->uri->scheme, "esx") &&
|
|
||||||
STRCASENEQ(conn->uri->scheme, "gsx"))) {
|
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Decline if the scheme is not one of {vpx|esx|gsx} */
|
||||||
|
plus = strchr(conn->uri->scheme, '+');
|
||||||
|
|
||||||
|
if (plus == NULL) {
|
||||||
|
if (STRCASENEQ(conn->uri->scheme, "vpx") &&
|
||||||
|
STRCASENEQ(conn->uri->scheme, "esx") &&
|
||||||
|
STRCASENEQ(conn->uri->scheme, "gsx")) {
|
||||||
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (plus - conn->uri->scheme != 3 ||
|
||||||
|
(STRCASENEQLEN(conn->uri->scheme, "vpx", 3) &&
|
||||||
|
STRCASENEQLEN(conn->uri->scheme, "esx", 3) &&
|
||||||
|
STRCASENEQLEN(conn->uri->scheme, "gsx", 3))) {
|
||||||
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX_ERROR(VIR_ERR_INVALID_ARG,
|
||||||
|
_("Transport '%s' in URI scheme is not supported, try again "
|
||||||
|
"without the transport part"), plus + 1);
|
||||||
|
return VIR_DRV_OPEN_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
/* Require server part */
|
/* Require server part */
|
||||||
if (conn->uri->server == NULL) {
|
if (conn->uri->server == NULL) {
|
||||||
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
ESX_ERROR(VIR_ERR_INVALID_ARG, "%s",
|
||||||
|
Loading…
Reference in New Issue
Block a user