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

[libvirt] [PATCH 3/3] qemuDomainGetResctrlMonData: Switch to switch()



This way it is obvious when adding a new resource control type
that stats helper func needs to be updated too.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
---
 src/qemu/qemu_driver.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 25b6653e38..5606639482 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -20743,10 +20743,14 @@ qemuDomainGetResctrlMonData(virQEMUDriverPtr driver,
 
     caps = virQEMUDriverGetCapabilities(driver, false);
 
-    if (tag == VIR_RESCTRL_MONITOR_TYPE_CACHE) {
+    switch (tag) {
+    case VIR_RESCTRL_MONITOR_TYPE_CACHE:
         if (caps->host.cache.monitor)
             features = caps->host.cache.monitor->features;
-    } else {
+        break;
+    case VIR_RESCTRL_MONITOR_TYPE_MEMBW:
+    case VIR_RESCTRL_MONITOR_TYPE_UNSUPPORT:
+    case VIR_RESCTRL_MONITOR_TYPE_LAST:
         virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
                        _("Unsupported resctrl monitor type"));
         return -1;
-- 
2.21.0


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