mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
Allow autostart of libvirtd to be disabled with LIBVIRT_AUTOSTART=0
* src/remote_internal.c: Disable libvirtd autostart if the LIBVIRT_AUTOSTART=0 env variable is set * src/libvirt.c: Document environment variables can impact the virConnectOpen API
This commit is contained in:
parent
788c315165
commit
89c5ce4dcd
@ -1118,6 +1118,17 @@ failed:
|
|||||||
*
|
*
|
||||||
* Returns a pointer to the hypervisor connection or NULL in case of error
|
* Returns a pointer to the hypervisor connection or NULL in case of error
|
||||||
*
|
*
|
||||||
|
* If @name is NULL then probing will be done to determine a suitable
|
||||||
|
* default driver to activate. This involves trying each hypervisor
|
||||||
|
* in turn until one successfully opens. If the LIBVIRT_DEFAULT_URI
|
||||||
|
* environment variable is set, then it will be used in preference
|
||||||
|
* to probing for a driver.
|
||||||
|
*
|
||||||
|
* If connecting to an unprivileged hypervisor driver which requires
|
||||||
|
* the libvirtd daemon to be active, it will automatically be launched
|
||||||
|
* if not already running. This can be prevented by setting the
|
||||||
|
* environment variable LIBVIRT_AUTOSTART=0
|
||||||
|
*
|
||||||
* URIs are documented at http://libvirt.org/uri.html
|
* URIs are documented at http://libvirt.org/uri.html
|
||||||
*/
|
*/
|
||||||
virConnectPtr
|
virConnectPtr
|
||||||
@ -1139,6 +1150,9 @@ virConnectOpen (const char *name)
|
|||||||
* library functionalities. The set of APIs usable are then restricted
|
* library functionalities. The set of APIs usable are then restricted
|
||||||
* on the available methods to control the domains.
|
* on the available methods to control the domains.
|
||||||
*
|
*
|
||||||
|
* See virConnectOpen for notes about environment variables which can
|
||||||
|
* have an effect on opening drivers
|
||||||
|
*
|
||||||
* Returns a pointer to the hypervisor connection or NULL in case of error
|
* Returns a pointer to the hypervisor connection or NULL in case of error
|
||||||
*
|
*
|
||||||
* URIs are documented at http://libvirt.org/uri.html
|
* URIs are documented at http://libvirt.org/uri.html
|
||||||
@ -1164,6 +1178,9 @@ virConnectOpenReadOnly(const char *name)
|
|||||||
* Hypervisor. If necessary, authentication will be performed fetching
|
* Hypervisor. If necessary, authentication will be performed fetching
|
||||||
* credentials via the callback
|
* credentials via the callback
|
||||||
*
|
*
|
||||||
|
* See virConnectOpen for notes about environment variables which can
|
||||||
|
* have an effect on opening drivers
|
||||||
|
*
|
||||||
* Returns a pointer to the hypervisor connection or NULL in case of error
|
* Returns a pointer to the hypervisor connection or NULL in case of error
|
||||||
*
|
*
|
||||||
* URIs are documented at http://libvirt.org/uri.html
|
* URIs are documented at http://libvirt.org/uri.html
|
||||||
|
@ -972,6 +972,7 @@ remoteOpen (virConnectPtr conn,
|
|||||||
{
|
{
|
||||||
struct private_data *priv;
|
struct private_data *priv;
|
||||||
int ret, rflags = 0;
|
int ret, rflags = 0;
|
||||||
|
const char *autostart = getenv("LIBVIRT_AUTOSTART");
|
||||||
|
|
||||||
if (inside_daemon)
|
if (inside_daemon)
|
||||||
return VIR_DRV_OPEN_DECLINED;
|
return VIR_DRV_OPEN_DECLINED;
|
||||||
@ -999,7 +1000,9 @@ remoteOpen (virConnectPtr conn,
|
|||||||
getuid() > 0) {
|
getuid() > 0) {
|
||||||
DEBUG0("Auto-spawn user daemon instance");
|
DEBUG0("Auto-spawn user daemon instance");
|
||||||
rflags |= VIR_DRV_OPEN_REMOTE_USER;
|
rflags |= VIR_DRV_OPEN_REMOTE_USER;
|
||||||
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
|
if (!autostart ||
|
||||||
|
STRNEQ(autostart, "0"))
|
||||||
|
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1014,7 +1017,9 @@ remoteOpen (virConnectPtr conn,
|
|||||||
if (getuid() > 0) {
|
if (getuid() > 0) {
|
||||||
DEBUG0("Auto-spawn user daemon instance");
|
DEBUG0("Auto-spawn user daemon instance");
|
||||||
rflags |= VIR_DRV_OPEN_REMOTE_USER;
|
rflags |= VIR_DRV_OPEN_REMOTE_USER;
|
||||||
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
|
if (!autostart ||
|
||||||
|
STRNEQ(autostart, "0"))
|
||||||
|
rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user