Snapshots unusable on CEPH

Hello,

I have trouble using snapshots on my ONe cluster with CEPH. Are snapshots supported at all? Here is the list of problems I ran into:

Trying to make snapshot of a non-persistent image finishes successfully, but snapshot is not created, and no error message is logged:

# onevm disk-snapshot-create 727 0 'test snapshot'
Thu Jan 5 17:49:56 2017 [Z0][VM][I]: New state is ACTIVE
Thu Jan 5 17:49:56 2017 [Z0][VM][I]: New LCM state is DISK_SNAPSHOT
Thu Jan 5 17:49:58 2017 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_snap_create_live.
Thu Jan 5 17:49:58 2017 [Z0][VMM][I]: VM disk snapshot successfully created.
Thu Jan 5 17:49:58 2017 [Z0][VM][I]: New LCM state is RUNNING
Thu Jan 5 17:49:58 2017 [Z0][LCM][I]: VM disk snapshot operation completed.

I could not figure out how to revert to an older snapshot: I have created a new empty persistent datablock image, attached it to the VM, created a filesystem, put some files on it, created a snapshot, mounted it again, put some more files on it, unmounted, and now I want to figure out how to revert to the previously created snapshot:

  • when I open the Storage tab in a given VM, click on the down arrow on the left of the image id, select the snapshot and click on Revert, I get the error “wrong state RUNNING” (the error here is probably that the Revert button should not be active for running VMs at all).
  • when I open the Storage tab in a given VM, click on the image name, open the Snapshots tab, select the snapshot and click on Revert, the error is “Cannot revert to snapshot in state USED”.
  • when I detach the image from the VM, open the image in Storage->Images, select the snapshot and click on Revert, I get the error “Snapshot is already the active one”.
  • when I detach the image from the VM, and try to revert the snapshot under OpenNebula’s hands using “rbd --pool one snap revert one-345@0”, and attach the image to the VM again, the snapshot is correctly rolled back. So the underlying datastore definitely supports rolling back snapshots.

I did not figure out how to create a snapshot of the image which is not curretnly used by a VM, or which is used by a VM in SHUTDOWN or UNDEPLOYED state (on a related topic, I could not figure out how to attach a disk to the VM in these states as well).

I did not figure out how to create a new image out of a snapshot in OpenNebula, even though “rbd copy” and “rbd clone” work as expected. When I open Storage->Images, click on an image, and then on “Clone”, I get the error “Cannot clone images with snapshots”.

To sum it up, for any basic tasks like daily “backup” snapshots or reverting to the known-working state, the snapshots in OpenNebula are not usable. Did I overlook something?

This topic is also related to the following older thread and backlog request:

Thanks!

-Yenya

Hello Yenya,

I just tried to create a snapshot of a non-persistent image on our cluster. From my point of view this is working correctly on our side.
Example: (VM 73 is running at the moment)

onevm disk-snapshot-create 73 0 'snapshot-from-console'
onevm show 73
[...]
VM DISK SNAPSHOTS                                                               
AC  ID DISK PARENT            DATE SIZE         NAME                            
=>   0    0     -1  01/06 11:21:37 -/128G       snapshot-from-console
[...]

The next thing you asked was “how to revert to an older snapshot?”. If you shut down a VM you can revert to another snapshot.
Example: (VM 73 is running at the moment)

onevm disk-snapshot-revert 73 2 3
[VirtualMachineDiskSnapshotRevert] Could not revert to disk snapshot for VM 73, wrong state RUNNING.
onevm poweroff 73
onevm disk-snapshot-revert 73 2 3
onevm resume 73
onevm show 73
[...]
VM DISK SNAPSHOTS                                                               
AC  ID DISK PARENT            DATE SIZE         NAME                            
=>   0    0     -1  01/06 11:21:37 -/128G       snapshot-from-console
     0    2     -1  01/05 18:56:12 -/1000G      Snap1
     2    2      0  01/06 10:59:00 -/1000G      snap2
     3    2      0  01/06 11:00:12 -/1000G      snap3
=>   4    2      3  01/06 11:14:29 -/1000G      snap4
[...]

After that you will see the contents of snapshot 3 for disk 2.

You also asked if you can do image snapshots of VMs in state UNDEPLOYED. This seems not to be possible on our cluster too. But this makes sense to me. You still can do image snapshots of VMs in state POWEROFF
Example:

onevm poweroff 73
onevm disk-snapshot-create 73 0 'snapshot-from-console-while-powered-off'

Also the creation of a new image out of a snapshot is possible:
Example: (VM 73 is running at the moment)

[root@osc09 one]# onevm disk-saveas -v -s 1 73 0 'new-image-from-snapshot-1'
Image ID: 27
VM 73: disk 0 snapshot 1 prepared to be saved in the image new-image-from-snapshot-1

Now a completely new image exists (in the same rbd pool).

Using those snapshots for (disaster recovery) backup purposes is not a good idea in my eyes. Maybe someone else can provide its input about that point.

Best regards,

Bernhard J. M. Grün

Bernhard,

thanks for your reply. I have upgraded to 5.2.1, and now I am able to do snapshots of non-persistent VM disks. Maybe I did something wrong last time, or maybe something got fixed between 5.2.0 and 5.2.1.

However, I don’t want to use POWEROFF at all - for CEPH, UNDEPLOYED is almost the same as POWEROFF, except that POWEROFF counts the VM RAM and CPU as used on the particular host on which the VM is deployed (even though it is not really used by the powered off VM). So I disabled POWEROFF in Sunstone in favor of UNDEPLOY, as discussed here:

Also disk-saveas does not work for UNDEPLOYED VMs for some reason, as well as revert, or snapshot delete.

-Yenya