From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asVt2-0004Hp-FH for qemu-devel@nongnu.org; Tue, 19 Apr 2016 09:40:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asVsy-0000qa-20 for qemu-devel@nongnu.org; Tue, 19 Apr 2016 09:40:16 -0400 Date: Tue, 19 Apr 2016 14:40:02 +0100 From: "Richard W.M. Jones" Message-ID: <20160419134002.GJ11600@redhat.com> References: <1460690887-32751-1-git-send-email-famz@redhat.com> <1460690887-32751-6-git-send-email-famz@redhat.com> <20160417192725.GJ19398@redhat.com> <20160418011036.GA18893@ad-mail.usersys.redhat.com> <20160418080419.GC11600@redhat.com> <20160419133430.GB538@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160419133430.GB538@redhat.com> Subject: Re: [Qemu-devel] [PATCH for-2.7 v2 05/17] raw-posix: Implement .bdrv_lockf List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" Cc: Fam Zheng , Kevin Wolf , qemu-block@nongnu.org, Markus Armbruster , Jeff Cody , qemu-devel@nongnu.org, Max Reitz , pbonzini@redhat.com, den@openvz.org, John Snow On Tue, Apr 19, 2016 at 02:34:30PM +0100, Daniel P. Berrange wrote: > Have you ever considered integration with the QEMU NBD server. We > don't have APIs for enabling it explicitly in libvirt, but it strikes > me that it could be ideally suited for your needs. > > eg a hypothetical libvirt command to export a disk via NBD: > > virsh dom-export-disk myguest --readonly vda1 localhost 9000 > qemu-img create -f qcow2 -b nbd:localhost:9000 tmp-overlay.img > ...do stuff... > virsh dom-unexport-disk myguest vda1 > > Or to make cleanup easier, perhaps there's a way to tell QEMU > to close its NBD server after it has had 1 client connection. > > With this approach, you wouldn't need to take any lock on the > underlying real image. It's been on my todo list for a long time, but this does require libvirt to be involved, and libvirt is not the default for upstream libguestfs. Even with the libvirt backend, there are still uses cases like: virt-df -a /mnt/vms/disk.img -h virt-inspector -a /mnt/vms/disk.img | grep some_insecure_software for f in /mnt/vms/*; do virt-alignment-scan -a $f; done and so on. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org