All other helper processes are moved to cgroup with QEMU emulator
thread as we keep the root VM cgroup without any processes. This
assumption is validated in qemuRestoreCgroupState() which is called
when libvirtd is restarted and reconnected to all running VMs.
Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
---
src/qemu/qemu_dbus.c | 5 +++--
src/qemu/qemu_dbus.h | 3 ++-
src/qemu/qemu_extdevice.c | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_dbus.c b/src/qemu/qemu_dbus.c
index a0567e55a3..ffcf83e5da 100644
--- a/src/qemu/qemu_dbus.c
+++ b/src/qemu/qemu_dbus.c
@@ -148,7 +148,8 @@ qemuDBusStop(virQEMUDriverPtr driver,
int
qemuDBusSetupCgroup(virQEMUDriverPtr driver,
- virDomainObjPtr vm)
+ virDomainObjPtr vm,
+ virCgroupPtr cgroup)
{
g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -167,7 +168,7 @@ qemuDBusSetupCgroup(virQEMUDriverPtr driver,
return -1;
}
- return virCgroupAddProcess(priv->cgroup, cpid);
+ return virCgroupAddProcess(cgroup, cpid);
}
int
diff --git a/src/qemu/qemu_dbus.h b/src/qemu/qemu_dbus.h
index 3c2145a223..e3ce1330fd 100644
--- a/src/qemu/qemu_dbus.h
+++ b/src/qemu/qemu_dbus.h
@@ -35,4 +35,5 @@ int qemuDBusVMStateAdd(virDomainObjPtr vm, const char *id);
void qemuDBusVMStateRemove(virDomainObjPtr vm, const char *id);
int qemuDBusSetupCgroup(virQEMUDriverPtr driver,
- virDomainObjPtr vm);
+ virDomainObjPtr vm,
+ virCgroupPtr cgroup);
diff --git a/src/qemu/qemu_extdevice.c b/src/qemu/qemu_extdevice.c
index 2fb71dd334..8fe7ceaa10 100644
--- a/src/qemu/qemu_extdevice.c
+++ b/src/qemu/qemu_extdevice.c
@@ -280,7 +280,7 @@ qemuExtDevicesSetupCgroup(virQEMUDriverPtr driver,
virDomainDefPtr def = vm->def;
size_t i;
- if (qemuDBusSetupCgroup(driver, vm) < 0)
+ if (qemuDBusSetupCgroup(driver, vm, cgroup) < 0)
return -1;
for (i = 0; i < def->nvideos; i++) {
--
2.26.2