Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LPHFS-0001fk-KT for qemu-devel@nongnu.org; Tue, 20 Jan 2009 09:06:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LPHFS-0001fL-8L for qemu-devel@nongnu.org; Tue, 20 Jan 2009 09:06:34 -0500 Received: from [199.232.76.173] (port=49102 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LPHFR-0001f8-Va for qemu-devel@nongnu.org; Tue, 20 Jan 2009 09:06:33 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:62510) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LPHFR-0004Fd-Ga for qemu-devel@nongnu.org; Tue, 20 Jan 2009 09:06:33 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18805.55909.715098.596076@mariner.uk.xensource.com> Date: Tue, 20 Jan 2009 14:06:29 +0000 Subject: Re: [Qemu-devel] [PATCH] migration: adding migration to/from a file In-Reply-To: <4975AFE3.4050708@redhat.com> References: <1232324325-25060-1-git-send-email-uril@redhat.com> <200901190055.57922.paul@codesourcery.com> <4975AFE3.4050708@redhat.com> From: Ian Jackson Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paul Brook Uri Lublin writes ("Re: [Qemu-devel] [PATCH] migration: adding migration to/from a file"): > Paul Brook wrote: > > Wouldn't it be better to just implement savevm to file? > > It sure is simpler. In the Xen tree we already have an alternatively implementation of savevm which does not depend on or interact with the cow snapshots. See below. This is a bit of a mess and it would be nice to have some functionality in upstream that did the same thing. NB that since we want to retain compatibility with previous savefiles the exact syntax of the data saved to the file is important. FYI in the Xen case we don't need the live migration support that qemu upstream and kvm have, because the RAM live migration is handled by the Xen toolstack, and the remaining qemu saved state is small enough to do all in one go. But that doesn't mean that it's a bad idea. Ian. void do_savevm(const char *name) { QEMUFile *f; int saved_vm_running, ret; f = qemu_fopen(name, "wb"); /* ??? Should this occur after vm_stop? */ qemu_aio_flush(); saved_vm_running = vm_running; vm_stop(0); if (!f) { fprintf(logfile, "Failed to open savevm file '%s'\n", name); goto the_end; } ret = qemu_savevm_state(f); qemu_fclose(f); if (ret < 0) fprintf(logfile, "Error %d while writing VM to savevm file '%s'\n", ret, name); the_end: if (saved_vm_running) vm_start(); return; }