I recently wanted to do some testing scenarios where if the change didn't go according to plan I would be able to rollback to that original image. I haven't found any ProfitBricks documentation that had the information or answer I was looking for.
My current process is to take a Snapshot of the HDD storage, once complete, make the change in the VM and have a go/no go decision. If this fails, what I've done is attached a HDD Storage with the Snapshot from above, make it the boot storage, detach the now "broken" VM, provision the changes and repeat the process.
Is there an easier way to revert to snapshots?
Hello,
You could put together a script to make calls against the Cloud API that could potentially automate the snapshot creation and restoration process a bit.
That will return a list of volumes and their details (appending ?depth=2 does this) so we can pick out the relevant volumeId. Use that volumeId to create a snapshot.
That API call will return a status URL (in the headers) that can be checked periodically until it shows the snapshot is ready. (Changes from RUNNING to DONE.)
If we want to revert to the snapshot, then encode the snapshotId (example: 25b30e97-c646-4435-a681-b49527374810) and make the request to restore-snapshot like this:
There will be another status URL, in the returned headers, that can be checked to see when the restore-snapshot operation has completed.
I'm not currently aware of which, if any, of the available ProfitBricks Tools could be leveraged to address snapshot creation and restoration. Perhaps somebody else in the community has another solution and will chime in.
Thanks Eric for the detailed response! I agree that using the API / PowerShell / Command line method would be the most repeatable process and will have to give that a try.
Would be a "Nice to have" feature to have in the DCD itself that Storage objects knew that they had SnapShot available to revert to. I guess it's more of a specific scenario based situation for me where we're using one Datacenter as a lab area for testing and need to do this regularly.
Thanks Eric for the detailed response! I agree that using the API / PowerShell / Command line method would be the most repeatable process and will have to give that a try.
Would be a "Nice to have" feature to have in the DCD itself that Storage objects knew that they had SnapShot available to revert to. I guess it's more of a specific scenario based situation for me where we're using one Datacenter as a lab area for testing and need to do this regularly.
Much appreciate the suggestion and answer!