[libvirt] [PATCH 16/16] Init host cache info in drivers

Martin Kletzander mkletzan at redhat.com
Thu Mar 30 14:03:48 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 1803aa53b744..abf05a5b8771 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 f51141b99062..2ae8c816d64d 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -1105,6 +1105,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 871653c5a64c..2be849a6c160 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 b71506ae5dc3..aef62e6d7e3a 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 88f1960eb178..4fef9411048c 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