Skip to contentSkip to conversation

Sharing disks between two kvm guests

DISCUSSION carlopmart 6 participants 9 messages Jun 20, 2008 KVM

lore
Share & tools
lore

carlopmart

author
#0 lore raw

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.

Signature · 2 lines
CL Martinez
carlopmart {at} gmail {d0t} com
#1 lore raw
Quoted 3 lines

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

author
#2 lore raw
Quoted 6 lines · Felix Leimbach
Quoted 3 lines

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

Signature · 2 lines
CL Martinez
carlopmart {at} gmail {d0t} com
#3 lore raw
Quoted 7 lines · carlopmart
Quoted 6 lines · Felix Leimbach
Quoted 6 lines

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!

Signature · 1 line
Javier
#4 lore raw
Quoted 13 lines · Javier Guerra
Quoted 7 lines · carlopmart
Quoted 6 lines · Felix Leimbach
Quoted 6 lines

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.

Quoted 5 lines

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

Signature · 3 lines
------------- [email protected]  --------------
 "In short: just say NO TO DRUGS and maybe you won't
   end up like the Hurd people." -- Linus Torvald
#5 lore raw
Quoted 40 lines · Laurent Vivier
Quoted 14 lines · Javier Guerra
Quoted 8 lines · carlopmart
Quoted 6 lines · Felix Leimbach
Quoted 6 lines

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.

Quoted 6 lines

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"

Quoted 8 lines

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

Quoted 5 lines

Any comments ?

Cheers,
Laurent

#6 lore raw
Quoted 44 lines · Anthony Liguori
Quoted 43 lines · Laurent Vivier
Quoted 14 lines · Javier Guerra
Quoted 8 lines · carlopmart
Quoted 6 lines · Felix Leimbach
Quoted 6 lines

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.

Quoted 6 lines

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")

Quoted 7 lines
Quoted 5 lines

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

Quoted 11 lines

Regards,

Anthony Liguori

Quoted 5 lines

Any comments ?

Cheers,
Laurent

Signature · 3 lines
------------- [email protected] ---------------
"The best way to predict the future is to invent it."
- Alan Kay
#7 lore raw
Quoted 57 lines · Laurent Vivier
Quoted 55 lines · Anthony Liguori
Quoted 53 lines · Laurent Vivier
Quoted 17 lines · Javier Guerra
Quoted 10 lines · carlopmart
Quoted 7 lines · Felix Leimbach
Quoted 7 lines

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.

Quoted 7 lines

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).

Quoted 8 lines
Quoted 2 lines

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

Quoted 15 lines

Laurent

Quoted 12 lines

Regards,

Anthony Liguori

Quoted 6 lines

Any comments ?

Cheers,
Laurent

#8 lore raw
In reply to Javier Guerra
Quoted 10 lines · Javier Guerra

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.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.