On 09/04/2014 01:51 AM, John Ferlan wrote:
On 08/28/2014 02:38 PM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina(a)redhat.com>
> ---
> src/qemu/qemu_cgroup.c | 6 ++++++
> src/qemu/qemu_driver.c | 27 +++++++++++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
> diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
> index 43d14d4..95cc4d4 100644
> --- a/src/qemu/qemu_cgroup.c
> +++ b/src/qemu/qemu_cgroup.c
> @@ -676,6 +676,7 @@ static int
> qemuSetupCpuCgroup(virDomainObjPtr vm)
> {
> qemuDomainObjPrivatePtr priv = vm->privateData;
> + virObjectEventPtr event;
>
> if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPU)) {
> if (vm->def->cputune.sharesSpecified) {
> @@ -695,6 +696,11 @@ qemuSetupCpuCgroup(virDomainObjPtr vm)
> if (virCgroupGetCpuShares(priv->cgroup, &val) < 0)
> return -1;
> vm->def->cputune.shares = val;
> +
> + event = virDomainEventCputuneNewFromObj(vm, vm->def->cputune);
> +
> + if (event)
> + qemuDomainEventQueue(vm->privateData, event);
So this is triggered during qemuProcessStart() and only when there's
cputune.sharesSpecified is set and before any cgroups are set up or
virProcessSetAffinity() is called. This is fairly specific, but does not
include when the vcpu or emulator is initially setup. Since you're
triggering events when emulatorpin/vcpupin are called - I would think
similarly the qemuSetupCgroupForVcpu() and qemuSetupCgroupForEmulator()
would/could be places for events since that's when they are created.
Also, should there be a similar event during qemuProcessReconnect().
IOW: When should this event be triggered and naturally - is that
documented properly or enough?
John
That's a good question, probably I should have explain that in the
commit message. The reason for triggering the event during
qemuProcessStart() is because cgroups could change the cputune.shares
and therefor we should trigger the cputune event to let the management
application know that the value from domain configuration is no longer
valid.
Pavel
[..]