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 14:30:23 -0500 Message-ID: <485C054F.2020004@codemonkey.ws> References: <485B70E4.5030904@gmail.com> <485B8EAB.606@gmx.net> <485BA15D.3080309@gmail.com> <90eb1dc70806200707k4e08c4d7s41708fc9f84c2a3c@mail.gmail.com> <1213979531.15996.28.camel@frecb07144> <485BDCE4.9070401@codemonkey.ws> <1213988077.3858.4.camel@frecb07144> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Laurent Vivier Return-path: Received: from an-out-0708.google.com ([209.85.132.249]:20465 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751391AbYFTTaw (ORCPT ); Fri, 20 Jun 2008 15:30:52 -0400 Received: by an-out-0708.google.com with SMTP id d40so314024and.103 for ; Fri, 20 Jun 2008 12:30:49 -0700 (PDT) In-Reply-To: <1213988077.3858.4.camel@frecb07144> Sender: kvm-owner@vger.kernel.org List-ID: Laurent Vivier wrote: > Le vendredi 20 juin 2008 =C3=A0 11:37 -0500, Anthony Liguori a =C3=A9= crit : > =20 >> Laurent Vivier wrote: >> =20 >>> Le vendredi 20 juin 2008 =C3=A0 09:07 -0500, Javier Guerra a =C3=A9= crit : >>> =20 >>> =20 >>>> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart = wrote: >>>> =20 >>>> =20 >>>>> Felix Leimbach wrote: >>>>> =20 >>>>> =20 >>>>>>> This is my first post to this list. I have already installed k= vm-70 >>>>>>> under rhel5.2. My intention is to share on disk image betwwen t= wo rhel5.2 >>>>>>> kvm guests. Is it possible to accomplish this in kvm like xen o= r vmware >>>>>>> does?? How can I do?? I didn't find any reference abou this on = kvm >>>>>>> documentation ... >>>>>>> =20 >>>>>>> =20 >>>> i tried this looong ago and didn't really work because there was s= ome >>>> 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 o= n both >>>> KVM instances >>>> - use a cluster filesystem! >>>> =20 >>>> =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 connec= tions >>> 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/n= bd1" >>> >>> Of course the filesystem must know how to share the access to the d= isk >>> with others (-> "cluster filesystem") >>> >>> II- in a second step, we can include directly the nbd protocol in q= emu >>> (block-nbd.c, "-drive file=3Dnbd:localhost:1024") to connect to the >>> server. We can also add some commands to the protocol to manage loc= k, >>> HA, "what else ?" (Hi George). >>> =20 >>> =20 >> http://hg.codemonkey.ws/qemu-pq/file/25ca451f2040/block-nbd.diff >> =20 > > You're not fun, Anthony. > > Perhaps, now, it should be better if you use functions defined in the > (new) file "nbd.c". > =20 That patch is very old by now. It needs to be updated/written to use=20 the aio infrastructure which will be a little tough since there are som= e=20 assumptions right now that all aio is posix-aio. Regards, Anthony Liguori > Laurent > > =20 >> Regards, >> >> Anthony Liguori >> >> =20 >>> Any comments ? >>> >>> Cheers, >>> Laurent >>> =20 >>> =20 >> =20