Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Trashing

When deleting a disk, either on its own or during deletion of a VM, the disk image on Ceph is not immediately removed, but moved to Ceph trash instead, where it could be recovered from later.

By default a disk is scheduled to be in trash for 14 days before it is purged and lost forever. Warren admin can configure the number of days, the configuration applies at the moment disk is deleted, disks that are already in trash keep their previous purge schedule.

Short lived disks are removed immediately on delete, instead of trashing. These disks most probably do not contain any useful data, so to preserve Ceph space they are not kept in trash. By default, “short lived” means disks younger than 4 hours, this too can be configured by Warren admins.

Do note that all snapshots and backups are not retained when disk is moved to trash, so snapshots and backups are not recoverable.

Restoring data from a deleted VM

Finding the data

First find the VM in admin UI, set Status filter to show Deleted VMs, use other filters to find the desired VM, then open its details view.

From details view, find the disk or disks that need to be recovered and copy their UUID. Also get the VM UUID, this will be needed later.

Actually restoring the Disk

Now admin API can be used to try and recover the disk from Ceph trash.

https://documenter.getpostman.com/view/2599901/RznLEagg?version=latest#abf9b9d8-822b-4db6-802d-86113c5b0c66

Call the disk restore API endpoint with the disk UUID.

curl --request PUT \
  'https://{{api_domain}}/v1/{{location_slug}}/storage/admin/disks/09e66ce4-5e29-480a-ad21-65f2b406e187/restore' \
  --header 'apikey: meowmeowmeow'

If the disk has already been purged from trash then 404 Not Found and this error message is returned:

{
    "message": "Disk image does not exist and cannot be found in trash either, cannot restore"
}

However, if the disk was in trash and recovery was successful then the disk JSON is returned:

{
    "uuid": "09e66ce4-5e29-480a-ad21-65f2b406e187",
    "status": "Active",
    "snapshots": [],
    "user_id": 35,
    "billing_account_id": 129124,
    "size_gb": 20,
    "source_image_type": "OS_BASE",
    "source_image": "centos_8.2",
    "image_path": "vm-disk-images/09e66ce4-5e29-480a-ad21-65f2b406e187.img",
    "created_at": "2023-07-13T02:12:18.919+0000",
    "updated_at": "2023-07-13T09:21:12.994+0000",
    "acting_user_id": 35,
    "storage_pool_name": "vm-disk-images"
}

The next step is to make the disk available to the user.

  • No labels