debuggers.hg

changeset 22853:787af706dadc

libxl: Check a domain exists before destroying it

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Gianni Tedesco <gianni.tedesco@citrix.com>
date Tue Jan 25 17:02:47 2011 +0000 (2011-01-25)
parents eefb8e971be5
children 6ec61438713a
files tools/libxl/libxl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Tue Jan 25 16:59:47 2011 +0000
     1.2 +++ b/tools/libxl/libxl.c	Tue Jan 25 17:02:47 2011 +0000
     1.3 @@ -662,10 +662,21 @@ int libxl_event_get_disk_eject_info(libx
     1.4  int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
     1.5  {
     1.6      libxl__gc gc = LIBXL_INIT_GC(ctx);
     1.7 +    libxl_dominfo dominfo;
     1.8      char *dom_path;
     1.9      char *vm_path;
    1.10      int rc, dm_present;
    1.11  
    1.12 +    rc = libxl_domain_info(ctx, &dominfo, domid);
    1.13 +    switch(rc) {
    1.14 +    case 0:
    1.15 +        break;
    1.16 +    case ERROR_INVAL:
    1.17 +        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "non-existant domain %d", domid);
    1.18 +    default:
    1.19 +        return rc;
    1.20 +    }
    1.21 +
    1.22      if (libxl__domain_is_hvm(ctx, domid)) {
    1.23          dm_present = 1;
    1.24      } else {