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

[Xen-devel] [PATCH 1/2] libxl: modify domain config when moving domain to another cpupool



Today the domain config info contains the cpupool name the domain was
started in only if the cpupool was specified at domain creation. Moving
the domain to another cpupool later won't change that information.

Correct that by modifying the domain config accordingly.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 tools/libxl/libxl_cpupool.c | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_cpupool.c b/tools/libxl/libxl_cpupool.c
index 85b06882db..92cf29bc6b 100644
--- a/tools/libxl/libxl_cpupool.c
+++ b/tools/libxl/libxl_cpupool.c
@@ -430,17 +430,39 @@ out:
 int libxl_cpupool_movedomain(libxl_ctx *ctx, uint32_t poolid, uint32_t domid)
 {
     GC_INIT(ctx);
+    libxl_domain_config d_config;
+    libxl__domain_userdata_lock *lock = NULL;
     int rc;
 
+    libxl_domain_config_init(&d_config);
+
     rc = xc_cpupool_movedomain(ctx->xch, poolid, domid);
     if (rc) {
         LOGEVD(ERROR, rc, domid, "Error moving domain to cpupool");
-        GC_FREE;
-        return ERROR_FAIL;
+        rc = ERROR_FAIL;
+        goto out;
+    }
+
+    lock = libxl__lock_domain_userdata(gc, domid);
+    if (!lock) {
+        rc = ERROR_LOCK_FAIL;
+        goto out;
     }
 
+    rc = libxl__get_domain_configuration(gc, domid, &d_config);
+    if (rc)
+        goto out;
+
+    free(d_config.c_info.pool_name);
+    d_config.c_info.pool_name = libxl_cpupoolid_to_name(ctx, poolid);
+
+    rc = libxl__set_domain_configuration(gc, domid, &d_config);
+
+out:
+    if (lock) libxl__unlock_domain_userdata(lock);
+    libxl_domain_config_dispose(&d_config);
     GC_FREE;
-    return 0;
+    return rc;
 }
 
 /*
-- 
2.16.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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