Scripts

Welcome to the Nutanix NEXT community. To get started please read our short welcome post. Thanks!

cancel
Showing results for 
Search instead for 
Did you mean: 

Restoring VM's and Files from Snapshots

Pathfinder

Restoring VM's and Files from Snapshots

Hello Community,

 

I work at a software company and I'm trying to automate all of our integration tests.  Ideally what I'd like to be able to do is setup VM's within Nutanix and have them snapshotted at the place where we'd like the software to be installed and integration tests run.  Within our Build/Release pipeline I'd like to restore the VM's back to their last snapshot and then install our software and run the tests.  I've been looking in the API but can't seem to find the calls for Restoring a VM to a particular snapshot.  Am I missing something?

 

Thanks,


Colter

 

 

Tags (3)
5 REPLIES
Moderator Moderator
Moderator

Re: Restoring VM's and Files from Snapshots

Colter,

You're wanting to do this via a REST API call, right?

 

Also, I'm assuming you'd be running AHV on your system?

 

Side note: Have you seen http://developer.nutanix.com/ ? Pretty slick dev portal that we just launched with our Nutanix AOS 5.0 launch (which went GA today).

 

Anyhow, I'll double check with the API team on how to do this and post back.

Jon Kohler | Principal Architect, Nutanix | Nutanix NPX #003, VCDX #116 | @JonKohler
Please Kudos if useful!
Pathfinder

Re: Restoring VM's and Files from Snapshots

Hey Jon,

 

Thanks for the reply.  Yes I'd like to be able to do this via the REST API / powershell. 

 

Our IS team has an AHV setup within our network and I'm trying to interact with it for automated testing purposes.  Ideally I'd like to have a bunch of VM's that I can restore to their last snapshots and then provision with software and run tests overtop of them.

 

I've already got my provisioning scripts working, I just need to figure out how to revert a vm back to its last snapshot.

Pathfinder

Re: Restoring VM's and Files from Snapshots

Hey Jon

 

So I found a powershell cmdlet to do it.  I'm not sure where it was documented, but it seems to be doing the trick.

 

Restore-NTNXVirtualMachine 

 

Thanks for your help.

Moderator Moderator
Moderator

Re: Restoring VM's and Files from Snapshots

So, I dug into this, and the snapshot restore API for AHV hasn't been rolled up even into the v2 API in AOS 5.0. 

 

This would be in the v0.8 API in AHV, also known as the "MGMT API", which you should be able to see the REST API explorer for that in Prism.

Jon Kohler | Principal Architect, Nutanix | Nutanix NPX #003, VCDX #116 | @JonKohler
Please Kudos if useful!
Wayfarer

Re: Restoring VM's and Files from Snapshots

Hi,

I see there is no document related vm snapshot restore(vms/uuid/restore) using Rest API . Can you kindly confirm if we can do restore of vm snapshots using Rest API v2 for Nutanix CE AHV.