[libvirt PATCH 3/6] test: allocate numa cells separately from driver

Daniel P. Berrangé berrange at redhat.com
Tue May 19 17:41:28 UTC 2020


GObject has an arbitrary limit on the object struct size of 0xffff
bytes. It is expected that any large fields be separately allocated.

Signed-off-by: Daniel P. Berrangé <berrange at redhat.com>
---
 src/test/test_driver.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 3a085003e2..e8bfcd78d2 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -92,7 +92,8 @@ struct _testAuth {
 typedef struct _testAuth testAuth;
 typedef struct _testAuth *testAuthPtr;
 
-struct _testDriver {
+struct _testDriver
+{
     virObjectLockable parent;
 
     virNodeInfo nodeInfo;
@@ -102,7 +103,7 @@ struct _testDriver {
     virStoragePoolObjListPtr pools;
     virNodeDeviceObjListPtr devs;
     int numCells;
-    testCell cells[MAX_CELLS];
+    testCell *cells;
     size_t numAuths;
     testAuthPtr auths;
 
@@ -171,6 +172,7 @@ testDriverDispose(void *obj)
         g_free(driver->auths[i].username);
         g_free(driver->auths[i].password);
     }
+    g_free(driver->cells);
     g_free(driver->auths);
 
     testDriverDisposed = true;
@@ -1353,6 +1355,7 @@ testOpenDefault(virConnectPtr conn)
 
     /* Numa setup */
     privconn->numCells = 2;
+    privconn->cells = g_new0(testCell, privconn->numCells);
     for (i = 0; i < privconn->numCells; i++) {
         privconn->cells[i].numCpus = 8;
         privconn->cells[i].mem = (i + 1) * 2048 * 1024;
-- 
2.24.1




More information about the libvir-list mailing list