xl: resume the domain on suspend failure
authorBastian Blank <waldi@debian.org>
Tue, 25 Sep 2012 10:03:51 +0000 (11:03 +0100)
committerBastian Blank <waldi@debian.org>
Tue, 25 Sep 2012 10:03:51 +0000 (11:03 +0100)
The MUST macro calls exit(3) on failure but we need to cleanup and
resume.

Signed-off-by: Bastian Blank <waldi@debian.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/libxl/xl_cmdimpl.c

index 1627cacfe339d1bd37c73594163d80fba1e0125c..1d77bb4c5096ed04d04cd2d9bc585bb87036e22c 100644 (file)
@@ -2992,15 +2992,18 @@ static int save_domain(uint32_t domid, const char *filename, int checkpoint,
 
     save_domain_core_writeconfig(fd, filename, config_data, config_len);
 
-    MUST(libxl_domain_suspend(ctx, domid, fd, 0, NULL));
+    int rc = libxl_domain_suspend(ctx, domid, fd, 0, NULL);
     close(fd);
 
-    if (checkpoint)
+    if (rc < 0)
+        fprintf(stderr, "Failed to save domain, resuming domain\n");
+
+    if (checkpoint || rc < 0)
         libxl_domain_resume(ctx, domid, 1, 0);
     else
         libxl_domain_destroy(ctx, domid, 0);
 
-    exit(0);
+    exit(rc < 0 ? 1 : 0);
 }
 
 static pid_t create_migration_child(const char *rune, int *send_fd,