aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl.c
diff options
context:
space:
mode:
authorIan Campbell <ian.campbell@citrix.com>2012-07-23 13:09:43 +0100
committerIan Campbell <ian.campbell@citrix.com>2012-07-23 13:09:43 +0100
commita97def2ebbb36191e34cd7d19b94011e8a23b189 (patch)
treef6ac42eab9d89c035b2611a5bdf9b8cd6bf0509d /tools/libxl/libxl.c
parent925a783ab52af794a55670ba75d8cafe3048c728 (diff)
downloadxen-a97def2ebbb36191e34cd7d19b94011e8a23b189.tar.gz
xen-a97def2ebbb36191e34cd7d19b94011e8a23b189.tar.bz2
xen-a97def2ebbb36191e34cd7d19b94011e8a23b189.zip
libxl: rename stubdomain when renaming domain.
Otherwise after a localhost migrate of an HVM domain with a stubdomain we end up with domains called "FOO" and "FOO--incoming-dm". This because we initially create the domains as "FOO--incoming" and then rename to "FOO" inorder to maintain the uniqueness of domain names on a host. In this state a second attempt to migrate will fail upon attempting to create a new domain named "FOO--incoming-dm" Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl.c')
-rw-r--r--tools/libxl/libxl.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index 0600ce43f3..7e8bf45cf5 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -276,6 +276,8 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
char *got_old_name;
unsigned int got_old_len;
xs_transaction_t our_trans = 0;
+ uint32_t stub_dm_domid;
+ const char *stub_dm_old_name = NULL, *stub_dm_new_name = NULL;
int rc;
dom_path = libxl__xs_get_dompath(gc, domid);
@@ -284,6 +286,12 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
name_path= libxl__sprintf(gc, "%s/name", dom_path);
if (!name_path) goto x_nomem;
+ stub_dm_domid = libxl_get_stubdom_id(CTX, domid);
+ if (stub_dm_domid) {
+ stub_dm_old_name = libxl__stub_dm_name(gc, old_name);
+ stub_dm_new_name = libxl__stub_dm_name(gc, new_name);
+ }
+
retry_transaction:
if (!trans) {
trans = our_trans = xs_transaction_start(ctx->xsh);
@@ -341,6 +349,17 @@ int libxl__domain_rename(libxl__gc *gc, uint32_t domid,
goto x_fail;
}
+ if (stub_dm_domid) {
+ rc = libxl__domain_rename(gc, stub_dm_domid,
+ stub_dm_old_name,
+ stub_dm_new_name,
+ trans);
+ if (rc) {
+ LOGE(ERROR, "unable to rename stub-domain");
+ goto x_rc;
+ }
+ }
+
if (our_trans) {
if (!xs_transaction_end(ctx->xsh, our_trans, 0)) {
trans = our_trans = 0;