Create VM from Snapshot

I have been able to clone a VM using the API '/api/nutanix/v0.8/vms/[vmId]/clone'.

The notes in the Rest API Explorer for this API also indicate that it is possible to clone a VM from a snapshot: "Clone a Virtual Machine from a snapshot or Virtual Machine." However, I do not see any parameters to set the snapshot ID to clone from.

I have been able to succesfully create a snapshot of my VM using the API '/api/nutanix/v0.8/snapshots/'. Now I would like to be able to create a new VM from that snapshot. Does anyone know if this is possible and how to do it? Thanks in advance.

5 replies

Architect, marine biologist, importer-exporter, and latex salesman, and now API Guru. I admire your career sir.

Anyhow, looks like [post] /vms in the v1 API takes a VmCreateDTO as part of the request. Querying the snapshot in the v0.8 mgmt API returns snapshot data which includes a fully populated VmCreateDTO to use when creating a VM from the snapshot.

Note: We're unifiying the v1 and v0.8 API's in AOS 5.0, which will have a v2 API. Worth checking out. AOS 5.0 is right around the corner.

I do see the VmCreateDTO in the snapshot response, and that does work as a request on the [post] /vms API call. However, it seems like it always clones the current state of the VM, not the state at the time the snapshot was taken. For example, I took a snapshot, then logged onto the VM and edited some files, then took another snapshot. When I look at the VMCreateDTO in the snapshot response for the 2 different snapshots, they are identical. And when I use the original snapshot in the request to create a new VM, the new VM has the latest data. I would expect it to create a VM with the data on the disk at the time the snapshot was taken. Am I misunderstanding the snapshot functionality?

Thanks again for your help, and I wish you a very happy Festivus season ; )

Cookie policy

Cookie settings

We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.