]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/commitdiff
xl: save domain config (userdata) under correct domid/uuid
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 13 Jan 2011 00:18:35 +0000 (00:18 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 13 Jan 2011 00:18:35 +0000 (00:18 +0000)
Recent changes caused the domain config file to be saved under dom0's
filename in /var/lib/xen.  This was due to the config file being saved
before the domain was created and thus before the domid and uuid were
known.

Fix this by moving the saving code to after creation.

Also, change the "default" initialisation of domid in
xl_cmdimpl.c:create_domain to be domid=-1.  That provides a more
obviously wrong value than 0 (which refers to dom0) so that other bugs
of this kind would be more likely to show up.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Tested-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/xl_cmdimpl.c

index e7abbc18ee87e6940525df75a2f749b5fba5143c..d29d661a0fc139a9afe91cc2afe249c21aefde0f 100644 (file)
@@ -1437,7 +1437,7 @@ static int create_domain(struct domain_create *dom_info)
         printf_info(-1, &d_config, &d_config.dm_info);
 
 start:
-    domid = 0;
+    domid = -1;
 
     rc = acquire_lock();
     if (rc < 0)
@@ -1450,14 +1450,6 @@ start:
         goto error_out;
     }
 
-    ret = libxl_userdata_store(&ctx, domid, "xl",
-                                    config_data, config_len);
-    if (ret) {
-        perror("cannot save config file");
-        ret = ERROR_FAIL;
-        goto error_out;
-    }
-
     if ( dom_info->console_autoconnect ) {
         cb = autoconnect_console;
     }else{
@@ -1475,6 +1467,14 @@ start:
     if ( ret )
         goto error_out;
 
+    ret = libxl_userdata_store(&ctx, domid, "xl",
+                                    config_data, config_len);
+    if (ret) {
+        perror("cannot save config file");
+        ret = ERROR_FAIL;
+        goto error_out;
+    }
+
     release_lock();
 
     if (!paused)