[PATCH 1/4] rename qemuGetNumadAdvice to virDomainGetNumadAdvice

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

 



qemuGetNumadAdvice will be used by LXC driver,rename
it to virDomainGetNumaAdvice and move it to domain_conf.c

Signed-off-by: Gao feng <gaofeng@xxxxxxxxxxxxxx>
---
 src/conf/domain_conf.c   | 31 +++++++++++++++++++++++++++++++
 src/conf/domain_conf.h   |  2 ++
 src/libvirt_private.syms |  1 +
 src/qemu/qemu_process.c  | 32 +-------------------------------
 4 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index f2887c6..e4ebdd5 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -40,6 +40,7 @@
 #include "viruuid.h"
 #include "virutil.h"
 #include "virbuffer.h"
+#include "vircommand.h"
 #include "virlog.h"
 #include "nwfilter_conf.h"
 #include "virstoragefile.h"
@@ -16342,3 +16343,33 @@ no_memory:
     virSecurityDeviceLabelDefFree(seclabel);
     return NULL;
 }
+
+
+#if HAVE_NUMAD
+char *virDomainGetNumadAdvice(virDomainDefPtr def)
+{
+    virCommandPtr cmd = NULL;
+    char *output = NULL;
+
+    cmd = virCommandNewArgList(NUMAD, "-w", NULL);
+    virCommandAddArgFormat(cmd, "%d:%llu", def->vcpus,
+                           VIR_DIV_UP(def->mem.cur_balloon, 1024));
+
+    virCommandSetOutputBuffer(cmd, &output);
+
+    if (virCommandRun(cmd, NULL) < 0)
+        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("Failed to query numad for the "
+                         "advisory nodeset"));
+
+    virCommandFree(cmd);
+    return output;
+}
+#else
+char *virDomainGetNumadAdvice(virDomainDefPtr def ATTRIBUTE_UNUSED)
+{
+    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+                   _("numad is not available on this host"));
+    return NULL;
+}
+#endif
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 4ffa4aa..59061e4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2248,6 +2248,8 @@ virDomainDiskDefAddSecurityLabelDef(virDomainDiskDefPtr def, const char *model);
 typedef const char* (*virEventActionToStringFunc)(int type);
 typedef int (*virEventActionFromStringFunc)(const char *type);
 
+char *virDomainGetNumadAdvice(virDomainDefPtr def);
+
 VIR_ENUM_DECL(virDomainTaint)
 
 VIR_ENUM_DECL(virDomainVirt)
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index f399871..18e6cf7 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -341,6 +341,7 @@ virDomainWatchdogActionTypeFromString;
 virDomainWatchdogActionTypeToString;
 virDomainWatchdogModelTypeFromString;
 virDomainWatchdogModelTypeToString;
+virDomainGetNumadAdvice;
 
 
 # conf/domain_event.h
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 476e3ed..6103874 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1981,36 +1981,6 @@ qemuProcessInitNumaMemoryPolicy(virDomainObjPtr vm,
 }
 #endif
 
-#if HAVE_NUMAD
-static char *
-qemuGetNumadAdvice(virDomainDefPtr def)
-{
-    virCommandPtr cmd = NULL;
-    char *output = NULL;
-
-    cmd = virCommandNewArgList(NUMAD, "-w", NULL);
-    virCommandAddArgFormat(cmd, "%d:%llu", def->vcpus,
-                           VIR_DIV_UP(def->mem.cur_balloon, 1024));
-
-    virCommandSetOutputBuffer(cmd, &output);
-
-    if (virCommandRun(cmd, NULL) < 0)
-        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("Failed to query numad for the "
-                         "advisory nodeset"));
-
-    virCommandFree(cmd);
-    return output;
-}
-#else
-static char *
-qemuGetNumadAdvice(virDomainDefPtr def ATTRIBUTE_UNUSED)
-{
-    virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
-                   _("numad is not available on this host"));
-    return NULL;
-}
-#endif
 
 /* Helper to prepare cpumap for affinity setting, convert
  * NUMA nodeset into cpuset if @nodemask is not NULL, otherwise
@@ -3717,7 +3687,7 @@ int qemuProcessStart(virConnectPtr conn,
          VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) ||
         (vm->def->numatune.memory.placement_mode ==
          VIR_DOMAIN_NUMATUNE_MEM_PLACEMENT_MODE_AUTO)) {
-        nodeset = qemuGetNumadAdvice(vm->def);
+        nodeset = virDomainGetNumadAdvice(vm->def);
         if (!nodeset)
             goto cleanup;
 
-- 
1.7.11.7

--
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]