mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
virt-ssh-helper: Accept ?mode= in connection URI
When split daemons were introduced, we also made connection URI accept new parameter: mode={auto,legacy,direct} so that a client can force connecting to either old, monolithic daemon, or to split daemon (see v5.7.0-rc1~257 for more info). Now, the change was done to the remote driver, but not to virt-ssh-helper. True, our remote driver code still does not pass the 'mode' parameter, but that will be addressed in next commits. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
16d0425fbe
commit
8275a06182
@ -354,6 +354,8 @@ int main(int argc, char **argv)
|
||||
g_autoptr(virURI) uri = NULL;
|
||||
g_autofree char *driver = NULL;
|
||||
remoteDriverTransport transport;
|
||||
int mode = REMOTE_DRIVER_MODE_AUTO;
|
||||
const char *mode_str = NULL;
|
||||
gboolean version = false;
|
||||
gboolean readonly = false;
|
||||
g_autofree char *sock_path = NULL;
|
||||
@ -367,6 +369,7 @@ int main(int argc, char **argv)
|
||||
{ NULL, '\0', 0, 0, NULL, NULL, NULL }
|
||||
};
|
||||
unsigned int flags;
|
||||
size_t i;
|
||||
|
||||
context = g_option_context_new("URI - libvirt socket proxy");
|
||||
g_option_context_set_summary(context,
|
||||
@ -429,8 +432,23 @@ int main(int argc, char **argv)
|
||||
if (readonly)
|
||||
flags |= REMOTE_DRIVER_OPEN_RO;
|
||||
|
||||
for (i = 0; i < uri->paramsCount; i++) {
|
||||
virURIParam *var = &uri->params[i];
|
||||
|
||||
if (STRCASEEQ(var->name, "mode")) {
|
||||
mode_str = var->value;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode_str &&
|
||||
(mode = remoteDriverModeTypeFromString(mode_str)) < 0) {
|
||||
g_printerr(_("%s: unknown remote mode '%s'"), argv[0], mode_str);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sock_path = remoteGetUNIXSocket(transport,
|
||||
REMOTE_DRIVER_MODE_AUTO,
|
||||
mode,
|
||||
driver,
|
||||
flags,
|
||||
&daemon_path);
|
||||
|
Loading…
x
Reference in New Issue
Block a user