[PATCH 4/4] cputune_event: queue the event for cputune updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
---
 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);
     }
 
     return 0;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5d21080..e2fedaf 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -4461,6 +4461,7 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
     virBitmapPtr pcpumap = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
+    virObjectEventPtr event = NULL;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -4568,6 +4569,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
 
         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
             goto cleanup;
+
+        event = virDomainEventCputuneNewFromDom(dom, vm->def->cputune);
     }
 
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -4603,6 +4606,8 @@ qemuDomainPinVcpuFlags(virDomainPtr dom,
         virCgroupFree(&cgroup_vcpu);
     if (vm)
         virObjectUnlock(vm);
+    if (event)
+        qemuDomainEventQueue(driver, event);
     virBitmapFree(pcpumap);
     virObjectUnref(caps);
     virObjectUnref(cfg);
@@ -4727,6 +4732,7 @@ qemuDomainPinEmulator(virDomainPtr dom,
     virBitmapPtr pcpumap = NULL;
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
+    virObjectEventPtr event = NULL;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -4832,6 +4838,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
 
         if (virDomainSaveStatus(driver->xmlopt, cfg->stateDir, vm) < 0)
             goto cleanup;
+
+        event = virDomainEventCputuneNewFromDom(dom, vm->def->cputune);
     }
 
     if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -4861,6 +4869,8 @@ qemuDomainPinEmulator(virDomainPtr dom,
  cleanup:
     if (cgroup_emulator)
         virCgroupFree(&cgroup_emulator);
+    if (event)
+        qemuDomainEventQueue(driver, event);
     virBitmapFree(pcpumap);
     virObjectUnref(caps);
     if (vm)
@@ -9053,6 +9063,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
     virQEMUDriverConfigPtr cfg = NULL;
     virCapsPtr caps = NULL;
     qemuDomainObjPrivatePtr priv;
+    virObjectEventPtr event = NULL;
+    bool emitEvent = false;
 
     virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
                   VIR_DOMAIN_AFFECT_CONFIG, -1);
@@ -9123,6 +9135,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
 
                 vm->def->cputune.shares = val;
                 vm->def->cputune.sharesSpecified = true;
+
+                emitEvent = true;
             }
 
             if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
@@ -9140,6 +9154,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                     goto cleanup;
 
                 vm->def->cputune.period = value_ul;
+
+                emitEvent = true;
             }
 
             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9154,6 +9170,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                     goto cleanup;
 
                 vm->def->cputune.quota = value_l;
+
+                emitEvent = true;
             }
 
             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9169,6 +9187,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                     goto cleanup;
 
                 vm->def->cputune.emulator_period = value_ul;
+
+                emitEvent = true;
             }
 
             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9184,6 +9204,8 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
                     goto cleanup;
 
                 vm->def->cputune.emulator_quota = value_l;
+
+                emitEvent = true;
             }
 
             if (flags & VIR_DOMAIN_AFFECT_CONFIG)
@@ -9204,12 +9226,17 @@ qemuDomainSetSchedulerParametersFlags(virDomainPtr dom,
         vmdef = NULL;
     }
 
+
     ret = 0;
 
  cleanup:
     virDomainDefFree(vmdef);
     if (vm)
         virObjectUnlock(vm);
+    if (emitEvent)
+        event = virDomainEventCputuneNewFromDom(dom, vm->def->cputune);
+    if (event)
+        qemuDomainEventQueue(driver, event);
     virObjectUnref(caps);
     virObjectUnref(cfg);
     return ret;
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]