debuggers.hg

changeset 22215:ea47cb5d5755

libxl: Clear device-model info when destroying an HVM domain with stubdom.

Signed-off-by: Jun Zhu <Jun.Zhu@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Jun Zhu <Jun.Zhu@citrix.com>
date Thu Sep 16 17:49:43 2010 +0100 (2010-09-16)
parents a8026ce8fa38
children 4e47a7db9711
files tools/libxl/libxl.c
line diff
     1.1 --- a/tools/libxl/libxl.c	Thu Sep 16 17:39:33 2010 +0100
     1.2 +++ b/tools/libxl/libxl.c	Thu Sep 16 17:49:43 2010 +0100
     1.3 @@ -899,21 +899,25 @@ static int libxl_destroy_device_model(li
     1.4          }
     1.5          LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device model is a stubdom, domid=%d\n", stubdomid);
     1.6          ret = libxl_domain_destroy(ctx, stubdomid, 0);
     1.7 -        goto out;
     1.8 +        if (ret)
     1.9 +            goto out;
    1.10 +    } else {
    1.11 +        ret = kill(atoi(pid), SIGHUP);
    1.12 +        if (ret < 0 && errno == ESRCH) {
    1.13 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
    1.14 +            ret = 0;
    1.15 +        } else if (ret == 0) {
    1.16 +            LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
    1.17 +            ret = 0;
    1.18 +        } else {
    1.19 +            LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
    1.20 +                    atoi(pid));
    1.21 +            ret = ERROR_FAIL;
    1.22 +            goto out;
    1.23 +        }
    1.24      }
    1.25      xs_rm(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "/local/domain/0/device-model/%d", domid));
    1.26  
    1.27 -    ret = kill(atoi(pid), SIGHUP);
    1.28 -    if (ret < 0 && errno == ESRCH) {
    1.29 -        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model already exited");
    1.30 -        ret = 0;
    1.31 -    } else if (ret == 0) {
    1.32 -        LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Device Model signaled");
    1.33 -        ret = 0;
    1.34 -    } else {
    1.35 -        LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "failed to kill Device Model [%d]",
    1.36 -                     atoi(pid));
    1.37 -    }
    1.38  out:
    1.39      libxl__free_all(&gc);
    1.40      return ret;