public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Sharing disks between two kvm guests
@ 2008-06-20  8:57 carlopmart
  2008-06-20 11:04 ` Felix Leimbach
  0 siblings, 1 reply; 9+ messages in thread
From: carlopmart @ 2008-06-20  8:57 UTC (permalink / raw)
  To: kvm

Hi all,

  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 kvm documentation ...

Many thanks.

-- 
CL Martinez
carlopmart {at} gmail {d0t} com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20  8:57 Sharing disks between two kvm guests carlopmart
@ 2008-06-20 11:04 ` Felix Leimbach
  2008-06-20 12:23   ` carlopmart
  0 siblings, 1 reply; 9+ messages in thread
From: Felix Leimbach @ 2008-06-20 11:04 UTC (permalink / raw)
  To: carlopmart; +Cc: kvm


>  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 kvm documentation ...
Have a look at KVM/QEMU's -smb option in 
http://bellard.org/qemu/qemu-doc.html


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 11:04 ` Felix Leimbach
@ 2008-06-20 12:23   ` carlopmart
  2008-06-20 14:07     ` Javier Guerra
  0 siblings, 1 reply; 9+ messages in thread
From: carlopmart @ 2008-06-20 12:23 UTC (permalink / raw)
  To: kvm

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 kvm documentation ...
> Have a look at KVM/QEMU's -smb option in 
> http://bellard.org/qemu/qemu-doc.html
> 
> 
Yes but this option doesn't helps me. I need to simulate a SAN ...

-- 
CL Martinez
carlopmart {at} gmail {d0t} com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 12:23   ` carlopmart
@ 2008-06-20 14:07     ` Javier Guerra
  2008-06-20 16:32       ` Laurent Vivier
  2008-06-20 18:28       ` Avi Kivity
  0 siblings, 2 replies; 9+ messages in thread
From: Javier Guerra @ 2008-06-20 14:07 UTC (permalink / raw)
  To: carlopmart; +Cc: kvm

On Fri, Jun 20, 2008 at 7:23 AM, carlopmart <carlopmart@gmail.com> wrote:
> 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 kvm
>>> documentation ...

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=off' 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=xxx,cache=off on both
KVM instances
- use a cluster filesystem!

-- 
Javier

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 14:07     ` Javier Guerra
@ 2008-06-20 16:32       ` Laurent Vivier
  2008-06-20 16:37         ` Anthony Liguori
  2008-06-20 18:28       ` Avi Kivity
  1 sibling, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2008-06-20 16:32 UTC (permalink / raw)
  To: Javier Guerra; +Cc: carlopmart, kvm

Le vendredi 20 juin 2008 à 09:07 -0500, Javier Guerra a écrit :
> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart <carlopmart@gmail.com> wrote:
> > 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 kvm
> >>> documentation ...
> 
> 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=off' 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=xxx,cache=off on both
> 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 connections
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=nbd: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
-- 
------------- Laurent.Vivier@bull.net  --------------
 "In short: just say NO TO DRUGS and maybe you won't
   end up like the Hurd people." -- Linus Torvald


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 16:32       ` Laurent Vivier
@ 2008-06-20 16:37         ` Anthony Liguori
  2008-06-20 18:54           ` Laurent Vivier
  0 siblings, 1 reply; 9+ messages in thread
From: Anthony Liguori @ 2008-06-20 16:37 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: Javier Guerra, carlopmart, kvm

Laurent Vivier wrote:
> Le vendredi 20 juin 2008 à 09:07 -0500, Javier Guerra a écrit :
>   
>> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart <carlopmart@gmail.com> wrote:
>>     
>>> 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 kvm
>>>>> documentation ...
>>>>>           
>> 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=off' 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=xxx,cache=off on both
>> 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 connections
> 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=nbd:localhost:1024") to connect to the
> server. We can also add some commands to the protocol to manage lock,
> HA, "what else ?" (Hi George).
>   

http://hg.codemonkey.ws/qemu-pq/file/25ca451f2040/block-nbd.diff

Regards,

Anthony Liguori

> Any comments ?
>
> Cheers,
> Laurent
>   


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 14:07     ` Javier Guerra
  2008-06-20 16:32       ` Laurent Vivier
@ 2008-06-20 18:28       ` Avi Kivity
  1 sibling, 0 replies; 9+ messages in thread
From: Avi Kivity @ 2008-06-20 18:28 UTC (permalink / raw)
  To: Javier Guerra; +Cc: carlopmart, kvm

Javier Guerra wrote:
> 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=off' 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=xxx,cache=off on both
> KVM instances
> - use a cluster filesystem!
>   

This won't work with qcow images as metadata and allocation is not 
synchronized.  Use raw images.  cache=off is not strictly required, 
since the Linux pagecache will maintain coherency.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 16:37         ` Anthony Liguori
@ 2008-06-20 18:54           ` Laurent Vivier
  2008-06-20 19:30             ` Anthony Liguori
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Vivier @ 2008-06-20 18:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm

Le vendredi 20 juin 2008 à 11:37 -0500, Anthony Liguori a écrit :
> Laurent Vivier wrote:
> > Le vendredi 20 juin 2008 à 09:07 -0500, Javier Guerra a écrit :
> >   
> >> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart <carlopmart@gmail.com> wrote:
> >>     
> >>> 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 kvm
> >>>>> documentation ...
> >>>>>           
> >> 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=off' 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=xxx,cache=off on both
> >> 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 connections
> > 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=nbd:localhost:1024") to connect to the
> > server. We can also add some commands to the protocol to manage lock,
> > HA, "what else ?" (Hi George).
> >   
> 
> http://hg.codemonkey.ws/qemu-pq/file/25ca451f2040/block-nbd.diff

You're not fun, Anthony.

Perhaps, now, it should be better if you use functions defined in the
(new) file "nbd.c".

Laurent

> Regards,
> 
> Anthony Liguori
> 
> > Any comments ?
> >
> > Cheers,
> > Laurent
> >   
> 
> 
-- 
------------- Laurent.Vivier@bull.net ---------------
"The best way to predict the future is to invent it."
- Alan Kay


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Sharing disks between two kvm guests
  2008-06-20 18:54           ` Laurent Vivier
@ 2008-06-20 19:30             ` Anthony Liguori
  0 siblings, 0 replies; 9+ messages in thread
From: Anthony Liguori @ 2008-06-20 19:30 UTC (permalink / raw)
  To: Laurent Vivier; +Cc: kvm

Laurent Vivier wrote:
> Le vendredi 20 juin 2008 à 11:37 -0500, Anthony Liguori a écrit :
>   
>> Laurent Vivier wrote:
>>     
>>> Le vendredi 20 juin 2008 à 09:07 -0500, Javier Guerra a écrit :
>>>   
>>>       
>>>> On Fri, Jun 20, 2008 at 7:23 AM, carlopmart <carlopmart@gmail.com> wrote:
>>>>     
>>>>         
>>>>> 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 kvm
>>>>>>> documentation ...
>>>>>>>           
>>>>>>>               
>>>> 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=off' 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=xxx,cache=off on both
>>>> 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 connections
>>> 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=nbd:localhost:1024") to connect to the
>>> server. We can also add some commands to the protocol to manage lock,
>>> HA, "what else ?" (Hi George).
>>>   
>>>       
>> http://hg.codemonkey.ws/qemu-pq/file/25ca451f2040/block-nbd.diff
>>     
>
> You're not fun, Anthony.
>
> Perhaps, now, it should be better if you use functions defined in the
> (new) file "nbd.c".
>   

That patch is very old by now.  It needs to be updated/written to use 
the aio infrastructure which will be a little tough since there are some 
assumptions right now that all aio is posix-aio.

Regards,

Anthony Liguori

> Laurent
>
>   
>> Regards,
>>
>> Anthony Liguori
>>
>>     
>>> Any comments ?
>>>
>>> Cheers,
>>> Laurent
>>>   
>>>       
>>     


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-20 19:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20  8:57 Sharing disks between two kvm guests carlopmart
2008-06-20 11:04 ` Felix Leimbach
2008-06-20 12:23   ` carlopmart
2008-06-20 14:07     ` Javier Guerra
2008-06-20 16:32       ` Laurent Vivier
2008-06-20 16:37         ` Anthony Liguori
2008-06-20 18:54           ` Laurent Vivier
2008-06-20 19:30             ` Anthony Liguori
2008-06-20 18:28       ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox