When connecting to a non-root libvirt driver, the remote libvirt will
attempt to perform autostart of the libvirtd daemon. This is not always
desirable, particularly in test scripts where you don't want the daemon
autostarted every time it crashes - you want a clear failure
Daniel
src/remote_internal.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/remote_internal.c b/src/remote_internal.c
index 6df0282..77b4810 100644
--- a/src/remote_internal.c
+++ b/src/remote_internal.c
@@ -972,6 +972,7 @@ remoteOpen (virConnectPtr conn,
{
struct private_data *priv;
int ret, rflags = 0;
+ const char *autostart = getenv("LIBVIRT_AUTOSTART");
if (inside_daemon)
return VIR_DRV_OPEN_DECLINED;
@@ -998,7 +999,9 @@ remoteOpen (virConnectPtr conn,
getuid() > 0) {
DEBUG0("Auto-spawn user daemon instance");
rflags |= VIR_DRV_OPEN_REMOTE_USER;
- rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
+ if (!autostart ||
+ STRNEQ(autostart, "0"))
+ rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
}
/*
@@ -1013,7 +1016,9 @@ remoteOpen (virConnectPtr conn,
if (getuid() > 0) {
DEBUG0("Auto-spawn user daemon instance");
rflags |= VIR_DRV_OPEN_REMOTE_USER;
- rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
+ if (!autostart ||
+ STRNEQ(autostart, "0"))
+ rflags |= VIR_DRV_OPEN_REMOTE_AUTOSTART;
}
#endif
}
--
1.6.2.5
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|