From: Laurent Vivier Subject: Re: Sharing disks between two kvm guests Date: Fri, 20 Jun 2008 18:32:11 +0200 Message-ID: <1213979531.15996.28.camel@frecb07144> References: <485B70E4.5030904@gmail.com> <485B8EAB.606@gmx.net> <485BA15D.3080309@gmail.com> <90eb1dc70806200707k4e08c4d7s41708fc9f84c2a3c@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: carlopmart , kvm@vger.kernel.org To: Javier Guerra Return-path: Received: from ecfrec.frec.bull.fr ([129.183.4.8]:47874 "EHLO ecfrec.frec.bull.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752010AbYFTQcO (ORCPT ); Fri, 20 Jun 2008 12:32:14 -0400 In-Reply-To: <90eb1dc70806200707k4e08c4d7s41708fc9f84c2a3c@mail.gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: Le vendredi 20 juin 2008 =C3=A0 09:07 -0500, Javier Guerra a =C3=A9crit= : > On Fri, Jun 20, 2008 at 7:23 AM, carlopmart wr= ote: > > Felix Leimbach wrote: > >> > >>> 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 some > userspace cache on each QEMU instance. but the -drive option has a > 'cache=3Doff' setting that should be enough. >=20 > 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 b= oth > KVM instances > - use a cluster filesystem! 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 connection= s 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/nbd1" Of course the filesystem must know how to share the access to the disk with others (-> "cluster filesystem") II- in a second step, we can include directly the nbd protocol in qemu (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). Any comments ? Cheers, Laurent --=20 ------------- Laurent.Vivier@bull.net -------------- "In short: just say NO TO DRUGS and maybe you won't end up like the Hurd people." -- Linus Torvald