mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 22:55:23 +00:00
qemu-dbus: register DBus bus to the VM cgroup
External devices are started before cgroup is created. Add the DBus daemon to the VM cgroup with the rest of the external devices. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
5f56cb8bc8
commit
8e1ac0d384
@ -156,6 +156,30 @@ qemuDBusStop(virQEMUDriverPtr driver,
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
qemuDBusSetupCgroup(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
{
|
||||
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
|
||||
qemuDomainObjPrivatePtr priv = vm->privateData;
|
||||
g_autofree char *shortName = NULL;
|
||||
g_autofree char *pidfile = NULL;
|
||||
pid_t cpid = -1;
|
||||
|
||||
if (!priv->dbusDaemonRunning)
|
||||
return 0;
|
||||
|
||||
if (!(shortName = virDomainDefGetShortName(vm->def)))
|
||||
return -1;
|
||||
pidfile = qemuDBusCreatePidFilename(cfg, shortName);
|
||||
if (virPidFileReadPath(pidfile, &cpid) < 0) {
|
||||
VIR_WARN("Unable to get DBus PID");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return virCgroupAddProcess(priv->cgroup, cpid);
|
||||
}
|
||||
|
||||
int
|
||||
qemuDBusStart(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm)
|
||||
|
@ -35,3 +35,6 @@ void qemuDBusStop(virQEMUDriverPtr driver,
|
||||
int qemuDBusVMStateAdd(virDomainObjPtr vm, const char *id);
|
||||
|
||||
void qemuDBusVMStateRemove(virDomainObjPtr vm, const char *id);
|
||||
|
||||
int qemuDBusSetupCgroup(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm);
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "qemu_command.h"
|
||||
#include "qemu_extdevice.h"
|
||||
#include "qemu_vhost_user_gpu.h"
|
||||
#include "qemu_dbus.h"
|
||||
#include "qemu_domain.h"
|
||||
#include "qemu_tpm.h"
|
||||
#include "qemu_slirp.h"
|
||||
@ -276,6 +277,9 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver,
|
||||
virDomainDefPtr def = vm->def;
|
||||
size_t i;
|
||||
|
||||
if (qemuDBusSetupCgroup(driver, vm) < 0)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < def->nvideos; i++) {
|
||||
virDomainVideoDefPtr video = def->videos[i];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user