mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
qemu: Find dbus-daemon at runtime
Don't bother looking at /usr/libexec, since every distro ships dbus-daemon in $PATH. Note that it's still possible for the administrator to prevent this lookup and use an arbitrary binary by setting the appropriate key in qemu.conf. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
db91bf2ba3
commit
769de39f50
@ -175,6 +175,7 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||||
qemuDomainObjPrivate *priv = vm->privateData;
|
qemuDomainObjPrivate *priv = vm->privateData;
|
||||||
g_autoptr(virCommand) cmd = NULL;
|
g_autoptr(virCommand) cmd = NULL;
|
||||||
|
g_autofree char *dbusDaemonPath = NULL;
|
||||||
g_autofree char *shortName = NULL;
|
g_autofree char *shortName = NULL;
|
||||||
g_autofree char *pidfile = NULL;
|
g_autofree char *pidfile = NULL;
|
||||||
g_autofree char *configfile = NULL;
|
g_autofree char *configfile = NULL;
|
||||||
@ -188,13 +189,16 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
if (priv->dbusDaemonRunning)
|
if (priv->dbusDaemonRunning)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!virFileIsExecutable(cfg->dbusDaemonName)) {
|
dbusDaemonPath = virFindFileInPath(cfg->dbusDaemonName);
|
||||||
|
if (!dbusDaemonPath) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("'%1$s' is not a suitable dbus-daemon"),
|
_("'%1$s' is not a suitable dbus-daemon"),
|
||||||
cfg->dbusDaemonName);
|
cfg->dbusDaemonName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VIR_DEBUG("Using dbus-daemon: %s", dbusDaemonPath);
|
||||||
|
|
||||||
if (!(shortName = virDomainDefGetShortName(vm->def)))
|
if (!(shortName = virDomainDefGetShortName(vm->def)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -210,7 +214,7 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
if (qemuSecurityDomainSetPathLabel(driver, vm, configfile, false) < 0)
|
if (qemuSecurityDomainSetPathLabel(driver, vm, configfile, false) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
cmd = virCommandNew(cfg->dbusDaemonName);
|
cmd = virCommandNew(dbusDaemonPath);
|
||||||
virCommandClearCaps(cmd);
|
virCommandClearCaps(cmd);
|
||||||
virCommandSetPidFile(cmd, pidfile);
|
virCommandSetPidFile(cmd, pidfile);
|
||||||
virCommandSetErrorFD(cmd, &errfd);
|
virCommandSetErrorFD(cmd, &errfd);
|
||||||
@ -223,7 +227,7 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
if (virPidFileReadPath(pidfile, &cpid) < 0) {
|
if (virPidFileReadPath(pidfile, &cpid) < 0) {
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("dbus-daemon %1$s didn't show up"),
|
_("dbus-daemon %1$s didn't show up"),
|
||||||
cfg->dbusDaemonName);
|
dbusDaemonPath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,7 +245,7 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
if (saferead(errfd, errbuf, sizeof(errbuf) - 1) < 0) {
|
if (saferead(errfd, errbuf, sizeof(errbuf) - 1) < 0) {
|
||||||
virReportSystemError(errno,
|
virReportSystemError(errno,
|
||||||
_("dbus-daemon %1$s died unexpectedly"),
|
_("dbus-daemon %1$s died unexpectedly"),
|
||||||
cfg->dbusDaemonName);
|
dbusDaemonPath);
|
||||||
} else {
|
} else {
|
||||||
virReportError(VIR_ERR_OPERATION_FAILED,
|
virReportError(VIR_ERR_OPERATION_FAILED,
|
||||||
_("dbus-daemon died and reported: %1$s"), errbuf);
|
_("dbus-daemon died and reported: %1$s"), errbuf);
|
||||||
@ -253,7 +257,7 @@ qemuDBusStart(virQEMUDriver *driver,
|
|||||||
if (!virFileExists(sockpath)) {
|
if (!virFileExists(sockpath)) {
|
||||||
virReportError(VIR_ERR_OPERATION_TIMEOUT,
|
virReportError(VIR_ERR_OPERATION_TIMEOUT,
|
||||||
_("dbus-daemon %1$s didn't show up"),
|
_("dbus-daemon %1$s didn't show up"),
|
||||||
cfg->dbusDaemonName);
|
dbusDaemonPath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user