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

[libvirt] [PATCH RESENT 04/12] libxl: populate xenstore memory entries at startup



libxl uses some xenstore entries for hints in memory management
(especially when starting new domain). This includes dom0 memory limit
and Xen free memory margin, based on current system state. Entries are
created at first usage, so force such usage at daemon startup, which most
likely will be before any domain startup.
---
 src/libxl/libxl_driver.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index 011edf8..89546a5 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -1115,6 +1115,7 @@ libxlStartup(bool privileged,
     char *log_file = NULL;
     virCommandPtr cmd;
     int status, ret = 0;
+    unsigned int free_mem;
     char ebuf[1024];
 
     /* Disable libxl driver if non-root */
@@ -1240,6 +1241,13 @@ libxlStartup(bool privileged,
         goto error;
     }
 
+    /* This will fill xenstore info about free and dom0 memory - if missing,
+     * should be called before starting first domain */
+    if (libxl_get_free_memory(libxl_driver->ctx, &free_mem)) {
+        VIR_ERROR(_("cannot get free memory info"));
+        goto error;
+    }
+
     if (!(libxl_driver->xmlconf = virDomainXMLConfNew(&libxlDomainXMLPrivateDataCallbacks,
                                                       NULL)))
         goto error;
-- 
1.8.1.4



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