[5.2.1] Ceph, snapshots woes

(Yuri) #1

Hi there.

I need to back up my ONe VMS, and I’m running 5.2.1 for now, with Ceph datastore for images.
So what I did basically is:

  • Created a snapshot from VM’s ‘Storage’ tab
  • Found out that I couldn’t delete it, because ONe said, ‘Cannot delete active snapshot’
  • Got frustrated, manually deleted snapshot using rbd (yes, I know that was dumb)

How can I now alter ONe’s database so that it doesn’t show a non-existent snapshot?
Can I just create rbd snapshots without touching ONe and back up them, then delete?

(Vlastimil Holer) #2

Hi Yuri,

the best option is to recreate a deleted snapshot via rbd with same parameters, e.g., for the snapshot with ID 3 on some disk:

rbd --id oneadmin snap create one/one-xx-yy-zz@3

The other option is to start hacking the VM object metadata. Few can be done via CLI, but for the rest, you’ll have to go directly to the database. First, inspect the XML /VM/SNAPSHOTS metadata via onevm. Example for VM with ID 17:

onevm show 17 --xml

Now, you can use onedb change-body to change the content. Don’t forget to backup the database before:

onedb change-body vm --id 17 '/VM/SNAPSHOTS/SNAPSHOT[ID=3]' --delete --dry
onedb change-body vm --id 17 '/VM/SNAPSHOTS/SNAPSHOT[ID=3]' --delete

From now on you have to stop the OpenNebula daemons and start hacking the database, table vm_pool, and append ACTIVE=YES element to the latest snapshot and fix the ??parent/children?? references. But, without warranties…

Hope it helps a little.

Best regards,
Vlastimil Holer