From: Wei Liu Subject: [PATCH v2] libxl: clean up qemu-save and qemu-resume files Date: Wed, 3 Jun 2015 11:44:50 +0100 Message-ID: <1433328290-5507-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Z06Pk-0002mF-Uw for xen-devel@lists.xenproject.org; Wed, 03 Jun 2015 11:00:53 +0000 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 Cc: Wei Liu , Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org These files are leaked when using qemu-trad stubdom. They are intermediate files created by libxc. Unfortunately they don't fit well in our userdata scheme. Clean them up after we destroy all userdata, we're sure they are not useful anymore at that point. Signed-off-by: Wei Liu --- v2: delete those files in parent process --- tools/libxl/libxl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 9117b01..d86ea62 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -1678,6 +1678,16 @@ static void devices_destroy_cb(libxl__egc *egc, libxl__unlock_domain_userdata(lock); + /* Clean up qemu-save and qemu-resume files. They are + * intermediate files created by libxc. Unfortunately they + * don't fit in existing userdata scheme very well. + */ + rc = libxl__remove_file(gc, libxl__device_model_savefile(gc, domid)); + if (rc < 0) goto out; + rc = libxl__remove_file(gc, + GCSPRINTF(XC_DEVICE_MODEL_RESTORE_FILE".%u", domid)); + if (rc < 0) goto out; + rc = libxl__ev_child_fork(gc, &dis->destroyer, domain_destroy_domid_cb); if (rc < 0) goto out; if (!rc) { /* child */ -- 1.9.1