[libvirt] [PATCH v3 6/8] Init host cache info in drivers

Martin Kletzander mkletzan at redhat.com
Tue Apr 25 11:10:30 UTC 2017


Added only in drivers that were already calling
virCapabilitiesInitNUMA().  Instead of refactoring all the callers to
behave the same way in case of error, just follow what the callers are
doing for all the functions.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/lxc/lxc_conf.c           | 3 +++
 src/openvz/openvz_conf.c     | 3 +++
 src/phyp/phyp_driver.c       | 3 +++
 src/qemu/qemu_capabilities.c | 3 +++
 src/uml/uml_conf.c           | 3 +++
 src/vbox/vbox_common.c       | 3 +++
 src/vmware/vmware_conf.c     | 3 +++
 src/vz/vz_driver.c           | 2 ++
 8 files changed, 23 insertions(+)

diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index e47b667f582a..508b98ba21b3 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -81,6 +81,9 @@ virCapsPtr virLXCDriverCapsInit(virLXCDriverPtr driver)
         VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities");
     }

+    if (virCapabilitiesInitCaches(caps) < 0)
+        VIR_WARN("Failed to get host CPU cache info");
+
     /* Only probe for power management capabilities in the driver,
      * not in the emulator */
     if (driver && virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 196fefb8de19..23a02d749e8b 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -168,6 +168,9 @@ virCapsPtr openvzCapsInit(void)
     if (virCapabilitiesInitNUMA(caps) < 0)
         goto no_memory;

+    if (virCapabilitiesInitCaches(caps) < 0)
+        goto no_memory;
+
     if ((guest = virCapabilitiesAddGuest(caps,
                                          VIR_DOMAIN_OSTYPE_EXE,
                                          caps->host.arch,
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 2123784f70da..0cc288f36d8e 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -340,6 +340,9 @@ phypCapsInit(void)
             ("Failed to query host NUMA topology, disabling NUMA capabilities");
     }

+    if (virCapabilitiesInitCaches(caps) < 0)
+        VIR_WARN("Failed to get host CPU cache info");
+
     if ((guest = virCapabilitiesAddGuest(caps,
                                          VIR_DOMAIN_OSTYPE_LINUX,
                                          caps->host.arch,
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index cc3e1f808471..3f7f67f35719 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1121,6 +1121,9 @@ virCapsPtr virQEMUCapsInit(virQEMUCapsCachePtr cache)
         VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities");
     }

+    if (virCapabilitiesInitCaches(caps) < 0)
+        VIR_WARN("Failed to get host CPU cache info");
+
     if (!(caps->host.cpu = virCPUProbeHost(caps->host.arch)))
         VIR_WARN("Failed to get host CPU");

diff --git a/src/uml/uml_conf.c b/src/uml/uml_conf.c
index bdef78324385..b01e5ee92bb3 100644
--- a/src/uml/uml_conf.c
+++ b/src/uml/uml_conf.c
@@ -69,6 +69,9 @@ virCapsPtr umlCapsInit(void)
         VIR_WARN("Failed to query host NUMA topology, disabling NUMA capabilities");
     }

+    if (virCapabilitiesInitCaches(caps) < 0)
+        VIR_WARN("Failed to get host CPU cache info");
+
     if (virNodeSuspendGetTargetMask(&caps->host.powerMgmt) < 0)
         VIR_WARN("Failed to get host power management capabilities");

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index d2b36ac0dfed..d6d363e456a7 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -79,6 +79,9 @@ vboxCapsInit(void)
     if (virCapabilitiesInitNUMA(caps) < 0)
         goto no_memory;

+    if (virCapabilitiesInitCaches(caps) < 0)
+        goto no_memory;
+
     if ((guest = virCapabilitiesAddGuest(caps,
                                          VIR_DOMAIN_OSTYPE_HVM,
                                          caps->host.arch,
diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
index bf4597c4748a..891d9a47f0b4 100644
--- a/src/vmware/vmware_conf.c
+++ b/src/vmware/vmware_conf.c
@@ -68,6 +68,9 @@ vmwareCapsInit(void)
     if (virCapabilitiesInitNUMA(caps) < 0)
         goto error;

+    if (virCapabilitiesInitCaches(caps) < 0)
+        goto error;
+
     /* i686 guests are always supported */
     if ((guest = virCapabilitiesAddGuest(caps,
                                          VIR_DOMAIN_OSTYPE_HVM,
diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c
index 059e7c9f4d4e..9a429f495ed8 100644
--- a/src/vz/vz_driver.c
+++ b/src/vz/vz_driver.c
@@ -118,6 +118,8 @@ vzBuildCapabilities(void)
     if (virCapabilitiesInitNUMA(caps) < 0)
         goto error;

+    if (virCapabilitiesInitCaches(caps) < 0)
+        goto error;

     verify(ARRAY_CARDINALITY(archs) == ARRAY_CARDINALITY(emulators));

-- 
2.12.2




More information about the libvir-list mailing list