debuggers.hg

changeset 22785:d839631b6048

xl: save domain config (userdata) under correct domid/uuid

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>
author Ian Jackson <Ian.Jackson@eu.citrix.com>
date Thu Jan 13 00:18:35 2011 +0000 (2011-01-13)
parents 20b0f709153e
children ce208811f540
files tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/xl_cmdimpl.c	Wed Jan 12 14:14:13 2011 +0000
     1.2 +++ b/tools/libxl/xl_cmdimpl.c	Thu Jan 13 00:18:35 2011 +0000
     1.3 @@ -1437,7 +1437,7 @@ static int create_domain(struct domain_c
     1.4          printf_info(-1, &d_config, &d_config.dm_info);
     1.5  
     1.6  start:
     1.7 -    domid = 0;
     1.8 +    domid = -1;
     1.9  
    1.10      rc = acquire_lock();
    1.11      if (rc < 0)
    1.12 @@ -1450,14 +1450,6 @@ start:
    1.13          goto error_out;
    1.14      }
    1.15  
    1.16 -    ret = libxl_userdata_store(&ctx, domid, "xl",
    1.17 -                                    config_data, config_len);
    1.18 -    if (ret) {
    1.19 -        perror("cannot save config file");
    1.20 -        ret = ERROR_FAIL;
    1.21 -        goto error_out;
    1.22 -    }
    1.23 -
    1.24      if ( dom_info->console_autoconnect ) {
    1.25          cb = autoconnect_console;
    1.26      }else{
    1.27 @@ -1475,6 +1467,14 @@ start:
    1.28      if ( ret )
    1.29          goto error_out;
    1.30  
    1.31 +    ret = libxl_userdata_store(&ctx, domid, "xl",
    1.32 +                                    config_data, config_len);
    1.33 +    if (ret) {
    1.34 +        perror("cannot save config file");
    1.35 +        ret = ERROR_FAIL;
    1.36 +        goto error_out;
    1.37 +    }
    1.38 +
    1.39      release_lock();
    1.40  
    1.41      if (!paused)