mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-23 20:02:21 +00:00
remote: move proxy/mode defaults after URI parsing
Currently the defaults for the proxy/mode settings are set before parsing URI parameters. A following commit will introduce a dependancy on the URI parsing for the defaults, so they need to move. Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
c171589089
commit
d968b4b85c
@ -780,20 +780,6 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
size_t i;
|
size_t i;
|
||||||
int proxy;
|
int proxy;
|
||||||
|
|
||||||
if (inside_daemon && !conn->uri->server) {
|
|
||||||
mode = REMOTE_DRIVER_MODE_DIRECT;
|
|
||||||
} else {
|
|
||||||
mode = REMOTE_DRIVER_MODE_AUTO;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Historically we didn't allow ssh tunnel with session mode,
|
|
||||||
* since we can't construct the accurate path remotely,
|
|
||||||
* so we can default to modern virt-ssh-helper */
|
|
||||||
if (flags & VIR_DRV_OPEN_REMOTE_USER)
|
|
||||||
proxy = VIR_NET_CLIENT_PROXY_NATIVE;
|
|
||||||
else
|
|
||||||
proxy = VIR_NET_CLIENT_PROXY_AUTO;
|
|
||||||
|
|
||||||
/* We handle *ALL* URIs here. The caller has rejected any
|
/* We handle *ALL* URIs here. The caller has rejected any
|
||||||
* URIs we don't care about */
|
* URIs we don't care about */
|
||||||
|
|
||||||
@ -880,23 +866,39 @@ doRemoteOpen(virConnectPtr conn,
|
|||||||
virConfGetValueString(conf, "remote_mode", &mode_str) < 0)
|
virConfGetValueString(conf, "remote_mode", &mode_str) < 0)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
if (mode_str &&
|
if (mode_str) {
|
||||||
(mode = remoteDriverModeTypeFromString(mode_str)) < 0) {
|
if ((mode = remoteDriverModeTypeFromString(mode_str)) < 0) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Unknown remote mode '%s'"), mode_str);
|
_("Unknown remote mode '%s'"), mode_str);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (inside_daemon && !conn->uri->server) {
|
||||||
|
mode = REMOTE_DRIVER_MODE_DIRECT;
|
||||||
|
} else {
|
||||||
|
mode = REMOTE_DRIVER_MODE_AUTO;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (conf && !proxy_str &&
|
if (conf && !proxy_str &&
|
||||||
virConfGetValueString(conf, "remote_proxy", &proxy_str) < 0)
|
virConfGetValueString(conf, "remote_proxy", &proxy_str) < 0)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
if (proxy_str &&
|
if (proxy_str) {
|
||||||
(proxy = virNetClientProxyTypeFromString(proxy_str)) < 0) {
|
if ((proxy = virNetClientProxyTypeFromString(proxy_str)) < 0) {
|
||||||
virReportError(VIR_ERR_INVALID_ARG,
|
virReportError(VIR_ERR_INVALID_ARG,
|
||||||
_("Unnkown proxy type '%s'"), proxy_str);
|
_("Unnkown proxy type '%s'"), proxy_str);
|
||||||
goto failed;
|
goto failed;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
/* Historically we didn't allow ssh tunnel with session mode,
|
||||||
|
* since we can't construct the accurate path remotely,
|
||||||
|
* so we can default to modern virt-ssh-helper */
|
||||||
|
if (flags & VIR_DRV_OPEN_REMOTE_USER)
|
||||||
|
proxy = VIR_NET_CLIENT_PROXY_NATIVE;
|
||||||
|
else
|
||||||
|
proxy = VIR_NET_CLIENT_PROXY_AUTO;
|
||||||
|
}
|
||||||
|
|
||||||
/* Sanity check that nothing requested !direct mode by mistake */
|
/* Sanity check that nothing requested !direct mode by mistake */
|
||||||
if (inside_daemon && !conn->uri->server && mode != REMOTE_DRIVER_MODE_DIRECT) {
|
if (inside_daemon && !conn->uri->server && mode != REMOTE_DRIVER_MODE_DIRECT) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user