On 10.04.2013 12:08, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Instead of calling virCgroupForDomain every time we need > the virCgrouPtr instance, just do it once at Vm startup > and cache a reference to the object in qemuDomainObjPrivatePtr > until shutdown of the VM. Removing the virCgroupPtr from > the QEMU driver state also means we don't have stale mount > info, if someone mounts the cgroups filesystem after libvirtd > has been started > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/qemu/qemu_cgroup.c | 283 +++++++++++++++------------------ > src/qemu/qemu_cgroup.h | 22 +-- > src/qemu/qemu_conf.h | 4 - > src/qemu/qemu_domain.c | 1 + > src/qemu/qemu_domain.h | 3 + > src/qemu/qemu_driver.c | 397 +++++++++++++++------------------------------- > src/qemu/qemu_hotplug.c | 53 +------ > src/qemu/qemu_migration.c | 25 +-- > src/qemu/qemu_process.c | 13 +- > 9 files changed, 291 insertions(+), 510 deletions(-) > > diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c > index 5aa9416..019aa2e 100644 > --- a/src/qemu/qemu_cgroup.c > +++ b/src/qemu/qemu_cgroup.c > @@ -220,13 +265,13 @@ int qemuSetupCgroup(virQEMUDriverPtr driver, > } > > for (i = 0; i < vm->def->ndisks ; i++) { > - if (qemuSetupDiskCgroup(vm, cgroup, vm->def->disks[i]) < 0) > + if (qemuSetupDiskCgroup(vm,vm->def->disks[i]) < 0) s/,/, / > goto cleanup; > } > > - rc = virCgroupAllowDeviceMajor(cgroup, 'c', DEVICE_PTY_MAJOR, > + rc = virCgroupAllowDeviceMajor(priv->cgroup, 'c', DEVICE_PTY_MAJOR, > VIR_CGROUP_DEVICE_RW); > - virDomainAuditCgroupMajor(vm, cgroup, "allow", DEVICE_PTY_MAJOR, > + virDomainAuditCgroupMajor(vm, priv->cgroup, "allow", DEVICE_PTY_MAJOR, > "pty", "rw", rc == 0); > if (rc != 0) { > virReportSystemError(-rc, "%s", ACK Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list