From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastian Blank Subject: Re: Saving domain in xl does not have proper cleanup Date: Sun, 16 Sep 2012 17:36:49 +0200 Message-ID: <20120916153649.GC22987@wavehammer.waldi.eu.org> References: <20120916145830.GB22987@wavehammer.waldi.eu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20120916145830.GB22987@wavehammer.waldi.eu.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Sun, Sep 16, 2012 at 04:58:30PM +0200, Bastian Blank wrote: > Saving a domain without enough available space with xl in 4.2-rc5 fails > to cleanup completely. The domain informations remains in Xenstore, > the domain itself seems to remain in a suspended state and there is not > xl process for it anymore. This patch fixes this bug. It resumes the domain in case of errors in the save process. Bastian Signed-off-by: Bastian Blank diff -r 4027d31caeb0 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Sep 13 12:21:09 2012 +0100 +++ b/tools/libxl/xl_cmdimpl.c Sun Sep 16 17:33:25 2012 +0200 @@ -2990,15 +2990,18 @@ 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, -- There are certain things men must do to remain men. -- Kirk, "The Ultimate Computer", stardate 4929.4