How do I use the web service SDK (I'm using the java variety) to delete a snapshot that is not the current snapshot of a VM.
RemoveSnapshot_Task seems to delete only a VMs current snapshot, so how do I delete a 'named' snapshot?
(Similarly, how do I revert to a snapshot that is not the current snapshot but somewhere else in the VM's snapshot management tree)
- JT
If you take a look at the vSphere API documentation, you'll see the following:
RemoveSnapshot_Task does not delete the current snapshot, it requires that you pass in a reference to one of the snapshots, so you can delete (commit) a specific snapshot. This requires that you go through the snapshot tree for a given VM (recursively) and locate the snapshot that you're interested in.
RevertToSnapshot_Task is what you'll want to use to "Go To" a specific snapshot and again, it also requires you to specify the snapshot that you're interested in.
If you want some sample to take a look at, check out vSphere SDK for Perl Utilities which has a utility called snapshotmanager.pl where these methods are implemented.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
Right, yes, sorry, I see that removeSnapshot_Task is actually a part of VirtualMachineSnapshot and I was confusing it a little with removeAllSnapshots from the VirtualMachine managedEntity. I guess I just asked the wrong question,so here goes, take 2...
Given a VirtualMachine managedEntity how do I get its 'snapshot tree' using java SDK web services (so that I can traverse it and look for a 'named' snapshot')
- JT
Take a look at the rootSnapshotList which is an array of snapshots, you'll need to recursively traverse it to locate the snapshot in question.
=========================================================================
William Lam
VMware vExpert 2009,2010
VMware scripts and resources at:
Getting Started with the vMA (tips/tricks)
Getting Started with the vSphere SDK for Perl
VMware Code Central - Scripts/Sample code for Developers and Administrators
If you find this information useful, please award points for "correct" or "helpful".
great, thanks, I'll have a look.
- JT