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

[Xen-devel] [PATCH V5 31/32] libxl: update domain configuration when updating memory targets



Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl.c |   36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index b578a5c..f93096b 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -3529,6 +3529,25 @@ out:
 
 
/******************************************************************************/
 
+/* Macro to load / store domain configuration. They must use in pair.
+ * Load macro defines d_config that can be used by other code. Store
+ * macro will dispose d_config.
+ */
+#define LOAD_DOMAIN_CONFIG(domid)                                       \
+    libxl_domain_config d_config;                                       \
+    libxl_domain_config_init(&d_config);                                \
+    rc = libxl_load_domain_configuration(CTX, (domid), &d_config);      \
+    if (rc)                                                             \
+        goto out;                                                       \
+
+#define STORE_DOMAIN_CONFIG(domid)                                      \
+    rc = libxl_store_domain_configuration(CTX, (domid), &d_config);     \
+    if (rc) {                                                           \
+        libxl_domain_config_dispose(&d_config);                         \
+        goto out;                                                       \
+    }                                                                   \
+    libxl_domain_config_dispose(&d_config);                             \
+
 /* Macro for defining device remove/destroy functions in a compact way */
 /* The following functions are defined:
  * libxl_device_disk_remove
@@ -4005,6 +4024,14 @@ int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t 
domid, uint32_t max_memkb)
         goto out;
     }
 
+    {
+        LOAD_DOMAIN_CONFIG(domid);
+
+        d_config.b_info.max_memkb = max_memkb;
+
+        STORE_DOMAIN_CONFIG(domid);
+    }
+
     rc = 0;
 out:
     GC_FREE;
@@ -4241,6 +4268,15 @@ out:
         if (errno == EAGAIN)
             goto retry_transaction;
 
+    /* Currently Dom0 information is not yet managed by libxl */
+    if (!rc && domid) {
+        LOAD_DOMAIN_CONFIG(domid);
+
+        d_config.b_info.target_memkb = new_target_memkb;
+
+        STORE_DOMAIN_CONFIG(domid);
+    }
+
 out_no_transaction:
     GC_FREE;
     return rc;
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.