[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] libxl: Check a domain exists before destroying it



# HG changeset patch
# User Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
# Date 1295974967 0
# Node ID 787af706dadcdc445347c6cb9739af6ba497cbb2
# Parent  eefb8e971be53eb0bd9f1d7337141866d9adbd1d
libxl: Check a domain exists before destroying it

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl.c |   11 +++++++++++
 1 files changed, 11 insertions(+)

diff -r eefb8e971be5 -r 787af706dadc tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Jan 25 16:59:47 2011 +0000
+++ b/tools/libxl/libxl.c       Tue Jan 25 17:02:47 2011 +0000
@@ -662,9 +662,20 @@ int libxl_domain_destroy(libxl_ctx *ctx,
 int libxl_domain_destroy(libxl_ctx *ctx, uint32_t domid, int force)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl_dominfo dominfo;
     char *dom_path;
     char *vm_path;
     int rc, dm_present;
+
+    rc = libxl_domain_info(ctx, &dominfo, domid);
+    switch(rc) {
+    case 0:
+        break;
+    case ERROR_INVAL:
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "non-existant domain %d", domid);
+    default:
+        return rc;
+    }
 
     if (libxl__domain_is_hvm(ctx, domid)) {
         dm_present = 1;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.