Move libxlDoNodeGetInfo from libxl_driver to libxl_conf
for use by other libxl modules.  For consistency, rename to
libxlDriverNodeGetInfo.

Signed-off-by: Jim Fehlig <jfeh...@suse.com>
---
 src/libxl/libxl_conf.c   | 36 ++++++++++++++++++++++++++++++++++++
 src/libxl/libxl_conf.h   |  4 ++++
 src/libxl/libxl_driver.c | 41 ++---------------------------------------
 3 files changed, 42 insertions(+), 39 deletions(-)

diff --git a/src/libxl/libxl_conf.c b/src/libxl/libxl_conf.c
index 8ba3ce3..f6a63e6 100644
--- a/src/libxl/libxl_conf.c
+++ b/src/libxl/libxl_conf.c
@@ -1207,6 +1207,42 @@ error:
     return -1;
 }
 
+int
+libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
+{
+    libxl_physinfo phy_info;
+    virArch hostarch = virArchFromHost();
+    libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
+    int ret = -1;
+
+    if (libxl_get_physinfo(cfg->ctx, &phy_info)) {
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("libxl_get_physinfo_info failed"));
+        goto cleanup;
+    }
+
+    if (virStrcpyStatic(info->model, virArchToString(hostarch)) == NULL) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("machine type %s too big for destination"),
+                       virArchToString(hostarch));
+        goto cleanup;
+    }
+
+    info->memory = phy_info.total_pages * (cfg->verInfo->pagesize / 1024);
+    info->cpus = phy_info.nr_cpus;
+    info->nodes = phy_info.nr_nodes;
+    info->cores = phy_info.cores_per_socket;
+    info->threads = phy_info.threads_per_core;
+    info->sockets = 1;
+    info->mhz = phy_info.cpu_khz / 1000;
+
+    ret = 0;
+
+cleanup:
+    virObjectUnref(cfg);
+    return ret;
+}
+
 virCapsPtr
 libxlMakeCapabilities(libxl_ctx *ctx)
 {
diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h
index 4f6f7ce..5a340b9 100644
--- a/src/libxl/libxl_conf.h
+++ b/src/libxl/libxl_conf.h
@@ -138,6 +138,10 @@ libxlDriverConfigNew(void);
 libxlDriverConfigPtr
 libxlDriverConfigGet(libxlDriverPrivatePtr driver);
 
+int
+libxlDriverNodeGetInfo(libxlDriverPrivatePtr driver,
+                       virNodeInfoPtr info);
+
 virCapsPtr
 libxlMakeCapabilities(libxl_ctx *ctx);
 
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 033d678c..36e3e25 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -128,43 +128,6 @@ cleanup:
     return ret;
 }
 
-static int
-libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
-{
-    libxl_physinfo phy_info;
-    virArch hostarch = virArchFromHost();
-    libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver);
-    int ret = -1;
-
-    if (libxl_get_physinfo(cfg->ctx, &phy_info)) {
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("libxl_get_physinfo_info failed"));
-        goto cleanup;
-    }
-
-    if (virStrcpyStatic(info->model, virArchToString(hostarch)) == NULL) {
-        virReportError(VIR_ERR_INTERNAL_ERROR,
-                       _("machine type %s too big for destination"),
-                       virArchToString(hostarch));
-        goto cleanup;
-    }
-
-    info->memory = phy_info.total_pages * (cfg->verInfo->pagesize / 1024);
-    info->cpus = phy_info.nr_cpus;
-    info->nodes = phy_info.nr_nodes;
-    info->cores = phy_info.cores_per_socket;
-    info->threads = phy_info.threads_per_core;
-    info->sockets = 1;
-    info->mhz = phy_info.cpu_khz / 1000;
-
-    ret = 0;
-
-cleanup:
-    virObjectUnref(cfg);
-    return ret;
-}
-
-
 /*
  * Handle previously registered event notification from libxenlight.
  *
@@ -358,7 +321,7 @@ libxlDomainSetVcpuAffinities(libxlDriverPrivatePtr driver, 
virDomainObjPtr vm)
     size_t i;
     int ret = -1;
 
-    if (libxlDoNodeGetInfo(driver, &nodeinfo) < 0)
+    if (libxlDriverNodeGetInfo(driver, &nodeinfo) < 0)
         goto cleanup;
 
     cpumaplen = VIR_CPU_MAPLEN(VIR_NODEINFO_MAXCPUS(nodeinfo));
@@ -1061,7 +1024,7 @@ libxlNodeGetInfo(virConnectPtr conn, virNodeInfoPtr info)
     if (virNodeGetInfoEnsureACL(conn) < 0)
         return -1;
 
-    return libxlDoNodeGetInfo(conn->privateData, info);
+    return libxlDriverNodeGetInfo(conn->privateData, info);
 }
 
 static char *
-- 
1.8.1.4

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

Reply via email to