[PATCH 15/24] conf: numa: Always allocate the NUMA config

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

 



Since our formatter now handles well if the config is allocated and not
filled and the parser always frees the definition before parsing we can
safely always-allocate the NUMA config.

This will help in later patches as the parser will be refactored to just
fill the data.
---
 src/conf/domain_conf.c   | 10 +++++++++-
 src/conf/numa_conf.c     | 11 +++++++++++
 src/conf/numa_conf.h     |  1 +
 src/libvirt_private.syms |  1 +
 4 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 6dea109..83c5fd9 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2319,9 +2319,17 @@ virDomainDefNew(void)
 {
     virDomainDefPtr ret;

-    ignore_value(VIR_ALLOC(ret));
+    if (VIR_ALLOC(ret) < 0)
+        return NULL;
+
+    if (!(ret->numa = virDomainNumaNew()))
+        goto error;

     return ret;
+
+ error:
+    virDomainDefFree(ret);
+    return NULL;
 }


diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c
index 359bdff..2a5fb3c 100644
--- a/src/conf/numa_conf.c
+++ b/src/conf/numa_conf.c
@@ -827,3 +827,14 @@ virDomainNumaGetCPUCountTotal(virCPUDefPtr numa)

     return ret;
 }
+
+
+virDomainNumaPtr
+virDomainNumaNew(void)
+{
+    virDomainNumaPtr ret = NULL;
+
+    ignore_value(VIR_ALLOC(ret));
+
+    return ret;
+}
diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h
index fa6b89b..e69489d 100644
--- a/src/conf/numa_conf.h
+++ b/src/conf/numa_conf.h
@@ -56,6 +56,7 @@ typedef enum {

 VIR_ENUM_DECL(virNumaMemAccess)

+virDomainNumaPtr virDomainNumaNew(void);
 void virDomainNumaFree(virDomainNumaPtr numa);

 /*
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4ba2142..6a746cf 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -629,6 +629,7 @@ virNodeDeviceObjUnlock;
 # conf/numa_conf.h
 virDomainNumaEquals;
 virDomainNumaFree;
+virDomainNumaNew;
 virDomainNumatuneFormatNodeset;
 virDomainNumatuneFormatXML;
 virDomainNumatuneGetMode;
-- 
2.2.2

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