From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Hajnoczi Subject: Re: KVM Block Device Driver Date: Wed, 14 Aug 2013 12:05:07 +0200 Message-ID: <20130814100507.GD14914@stefanha-thinkpad.redhat.com> References: <20130814024006.GA28585@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "Spensky, Chad - 0559 - MITLL" , "kvm@vger.kernel.org" To: Fam Zheng Return-path: Received: from mail-ea0-f173.google.com ([209.85.215.173]:49056 "EHLO mail-ea0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759357Ab3HNKFN (ORCPT ); Wed, 14 Aug 2013 06:05:13 -0400 Received: by mail-ea0-f173.google.com with SMTP id g10so4686529eak.32 for ; Wed, 14 Aug 2013 03:05:12 -0700 (PDT) Content-Disposition: inline In-Reply-To: <20130814024006.GA28585@localhost.localdomain> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Aug 14, 2013 at 10:40:06AM +0800, Fam Zheng wrote: > On Tue, 08/13 16:13, Spensky, Chad - 0559 - MITLL wrote: > > Hi All, > > > > I'm working with some disk introspection on KVM, and we trying to create > > a shadow image of the disk. We've hooked the functions in block.c, in > > particular bdrv_aio_writev. However we are seeing writes go through, > > pausing the VM, and the comparing our shadow image with the actual VM > > image, and they aren't 100% synced up. The first 1-2 sectors appear to be > > always be correct, however, after that, there are sometimes some > > discrepancies. I believe we have exhausted most obvious bugs (malloc > > bugs, incorrect size calculations etc.). Has anyone had any experience > > with this or have any insights? > > > > Our methodology is as follows: > > 1. Boot the VM. > > 2. Pause VM. > > 3. Copy the disk to our shadow image. > > How do you copy the disk, from guest or host? > > > 4. Perform very few reads/writes. > > Did you flush to disk? > > > 5. Pause VM. > > 6. Compare shadow copy with active vm disk. > > > > And this is where we are seeing discrepancies. Any help is much > > appreciated! We are running on Ubuntu 12.04 with a modified Debian build. > > > > - Chad > > > > -- > > Chad S. Spensky > > > > I think drive-backup command does just what you want, it creates a image > and copy-on-write date from guest disk to the target, without pausing > VM. Or perhaps drive-mirror. Maybe Chad can explain what the use case is. There is probably an existing command that does this or that could be extended to do this safely. Stefan