From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: Sharing disks between two kvm guests Date: Fri, 20 Jun 2008 11:37:56 -0500 Message-ID: <485BDCE4.9070401@codemonkey.ws> References: <485B70E4.5030904@gmail.com> <485B8EAB.606@gmx.net> <485BA15D.3080309@gmail.com> <90eb1dc70806200707k4e08c4d7s41708fc9f84c2a3c@mail.gmail.com> <1213979531.15996.28.camel@frecb07144> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Javier Guerra , carlopmart , kvm@vger.kernel.org To: Laurent Vivier Return-path: Received: from an-out-0708.google.com ([209.85.132.241]:12330 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752955AbYFTQik (ORCPT ); Fri, 20 Jun 2008 12:38:40 -0400 Received: by an-out-0708.google.com with SMTP id d40so300134and.103 for ; Fri, 20 Jun 2008 09:38:39 -0700 (PDT) In-Reply-To: <1213979531.15996.28.camel@frecb07144> Sender: kvm-owner@vger.kernel.org List-ID: Laurent Vivier wrote: > Le vendredi 20 juin 2008 =C3=A0 09:07 -0500, Javier Guerra a =C3=A9cr= it : > =20 >> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart w= rote: >> =20 >>> Felix Leimbach wrote: >>> =20 >>>>> This is my first post to this list. I have already installed kvm= -70 >>>>> under rhel5.2. My intention is to share on disk image betwwen two= rhel5.2 >>>>> kvm guests. Is it possible to accomplish this in kvm like xen or = vmware >>>>> does?? How can I do?? I didn't find any reference abou this on kv= m >>>>> documentation ... >>>>> =20 >> i tried this looong ago and didn't really work because there was som= e >> userspace cache on each QEMU instance. but the -drive option has a >> 'cache=3Doff' setting that should be enough. >> >> in theory (i haven't tested, but Avi 'blessed' it): >> - create a new image with qemu-img >> - add it to the command line using -drive file=3Dxxx,cache=3Doff on = both >> KVM instances >> - use a cluster filesystem! >> =20 > > RFC: > > Well, well, perhaps it is delusions of a sick mind but since the > introduction of qemu-nbd I think we can develop easily something to > share a disk between several virtual hosts: > > I- in a first step, we can modify qemu-nbd to accept several connecti= ons > for one disk image, for instance: > > # qemu-nbd my-disk.qcow2 > # nbd-client localhost 1024 /dev/nbd0 > # nbd-client localhost 1024 /dev/nbd1 > > and start two virtual hosts: > > "qemu -hda v1.img -hdb /dev/nbd0" and "qemu -hda v2.img -hdb /dev/nbd= 1" > > Of course the filesystem must know how to share the access to the dis= k > with others (-> "cluster filesystem") > > II- in a second step, we can include directly the nbd protocol in qem= u > (block-nbd.c, "-drive file=3Dnbd:localhost:1024") to connect to the > server. We can also add some commands to the protocol to manage lock, > HA, "what else ?" (Hi George). > =20 http://hg.codemonkey.ws/qemu-pq/file/25ca451f2040/block-nbd.diff Regards, Anthony Liguori > Any comments ? > > Cheers, > Laurent > =20