Shareable disk image between VMs

Hi,

I want to share a persistent image between two VMs to set up a GFS2 cluster.
Im on opennebula 4.10.2-1, centos 7, libvirt 1.1.1, ceph datastore.
Can anyone help me with this?

Thanks

By design you can not use the same persistent image in more than one VM.

Hi Javi Fontán,
I’m using UpenNebula 4.12.1 with Block LVM datastore and I have a similar problem.
I want to share a persistent image between two VMs to set up an Oracle Cluster Filesitem 2.
BTW libvirt support option <shareable/>, for example, a piece of xml config below.

<disk type='block' device='disk'>
      <driver name='qemu' type='raw' cache='writeback'/>
      <source dev='/var/lib/one//datastores/0/77/disk.1'/>
      <target dev='vdb' bus='virtio'/>
      <shareable/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x04' function='0x0'/>
    </disk>

How I can hack the current OpenNebula version for use option <shareable/> for image?
Maybe possible to add some custom Attributes to image or some other solution?

I tried to edit the libvirt xml config, file: /var/lib/one/vms/<VM_ID>/deployment.0, but after each stop and restarting VM, generates new configs deployment.1, deployment.2 and etc., so that it does not work.

Really for me it is only one way one persistent image with OCFS2 between two VMs.

http://dev.opennebula.org/issues/3901

http://dev.opennebula.org/issues/2659

Eugene,

You may look into RAW Data to inject that information. But i afraid, as per the design ONE will not allow you to attach same persistent image to another VM.

As a trick, you try register 2 image but point both to the same RDB. Not sure whether this will work or not, just an idea suddenly came to my mind

We also have a the PERSISTENT_TYPE. You can define a disk as INMMUTABLE, it will be handled as a persistent one, but read-only and can be attached to multiple VMs.

http://docs.opennebula.org/4.12/user/references/img_template.html#template-attributes

Also I’ve closed 3901 as duplicated, there is a previous request to add the sharable flag.

Cheers

Ruben

Sorry to dig up this old topic.

If we have an image set in PERSISTENT=yes and PERSISTENT_TYPE=IMMUTABLE we can’t attach it to multiple VM. So we set the image to PERSISTENT=no and PERSISTENT_TYPE=IMMUTABLE. Then we can attach it to multiple VM. This is great, very efficient since each VM just has a link to the image. But how do we update data inside this image ?

Is there a way to share an image with multiple VM like the IMMUTABLE PERSISTENT_TYPE, but allowing just 1 to write on the image ? We’d like to share data between VM, but some times we need to update this data. How can we do that ? Or even all VM in read/write and we deal with the fact that only one must write to prevent data corruption.

Best regards,
Edouard

Hi,

IMO it is a responsibility to the layer above the block device in the VM to support and guarantee the integrity and synchronisation of the data. OCFS2 in the VMs could be used for example.

Best Regards,
Anton Todorov

Hi Anton,

I forgot to mention that we don’t want to impact the configuration inside the VM. With libvirt we can share a qcow2 disk between VMs. How can we achieve that with OpenNebula ? Why can’t we force READONLY to no for 1 IMMUTABLE devicce ?

I forgot to mention that we don’t want to impact the configuration inside the VM. With libvirt we can share a qcow2 disk between VMs. How can we achieve that with OpenNebula ? Why can’t we force READONLY to no for 1 IMMUTABLE devicce ?

AFAIK the IMMUTABLE flag in OpenNebula is used to mark the CDROM images which are read only by definition so you could attach them to multiple VMs.

I think you should test a proof-of-concept setup and fill a feature request following the contribution guidelines after figuring out what is needed from OpenNebula.

You should take in account that from the VMs point of view this is a raw block device and the VM’s OS (kernel, filesystem, userland tool, whatever…) should know how to deal with the changes.

Best Regards,
Anton Todorov