From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:47199) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXRzo-0000TI-Va for qemu-devel@nongnu.org; Fri, 17 Jun 2011 01:53:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXRzo-0002BG-0S for qemu-devel@nongnu.org; Fri, 17 Jun 2011 01:53:32 -0400 Received: from mail-yw0-f45.google.com ([209.85.213.45]:33610) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXRzn-0002BC-UG for qemu-devel@nongnu.org; Fri, 17 Jun 2011 01:53:31 -0400 Received: by ywb3 with SMTP id 3so552549ywb.4 for ; Thu, 16 Jun 2011 22:53:31 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: Date: Fri, 17 Jun 2011 06:53:31 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Image streaming gives live block copy for free (and vice versa) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel Cc: Kevin Wolf , Jes Sorensen , Marcelo Tosatti , Avi Kivity Perhaps someone has been saying this all along but I want to spell it out that image streaming and live block copy are equivalent in theory. I just realized this last night. =A0In practice we might choose one implementation or two different ones for performance reasons. If any of these are unclear please let me know and I'll try to post diagram= s. Live block copy using image streaming ------------------------------------- 1. Create the destination image file and use the source image as the backing file. 2. Quiesce I/O and pause VM. 3. Switch to destination image. 4. Resume VM. 5. Start streaming destination image in order to copy source image data into destination file. 6. Streaming completes and disables the backing file, leaving the live copied destination image that no longer depends on the source image. There is no need for dirty block tracking because image streaming will only copy over unallocated clusters. =A0There are no phases to the copy process because the guest is writing to the destination file already and does not dirty the source file. Implementing live block copy without switch is also possible using the block-mirror driver to update both the source image and the destination image. =A0This would require making the backing file writable though. Image streaming using live block copy ------------------------------------- 1. Create destination image. 2. Start a live block copy to copy the source image data into destination f= ile. 3. When live block copy reaches switch state, quiesce I/O and pause VM. 4. Switch to destination image, which now contains the flattened source ima= ge. 5. Resume VM. 7. Delete source image. This approach copies the contents of the source image (and its backing file) into the destination file. =A0You need to have two times the disk space, since towards the end of live block copy you have two copies of the image. =A0The QED image streaming patches I posted do not need twice the disk space because they work in-place. Call now! =A0We'll give you live snapshot merge using image streaming for F= REE ---------------------------------------------------------------------------= - 1. Quiesce I/O and pause VM. 2. Free clusters in the snapshot that are allocated in the copy-on-write delta file. 3. Make the copy-on-write delta file the backing file of the snapshot. (Now the snapshot image has most clusters allocated except those which were COWed due to a write after the snapshot was taken) 4. Resume VM. 5. Start streaming the snapshot image in order to copy the COW data back into the snapshot file. 6. Streaming completes and disables the backing file, leaving the merged snapshot. 7. Delete the COW file. This approach is much more handwavy. =A0We needed to invert the backing file relationship between snapshot and COW file, as well as freeing clusters in order to make image streaming copy the data backing into the snapshot file. Stefan