VMware Cloud Community
SlingBlade20111
Contributor
Contributor

How to pull Snapshot ID from current snapshot?

Hello,

I have a workflow that our server admins can use to take a snapshot.  The workflow creates a task behind the scenes to automatically commit the snapshot in 3 days per our policy.  It is working beautifully, but we ran into a special situation where a user created two snapshots within a 3 day period.  The problem I am having is that when I commit the original snapshot I'm committing ALL snapshots.  I now need to modify the workflow so that it only commits the snapshot that was created at that time rather than ALL of them on the VM.

My question is how can I pull the Snapshot ID, drop it into an attribute, and specifically commit that snapshot at the end of 3 days?  The canned workflows allow you to commit all snapshots, size, age, or by number.  I don't see anything that commits a specific snapshot based on snapshot ID.  Maybe this isn't possible, but I thought I'd shout out and see if somebody has done something similar.

I have tried using the Action (getPropertiesForSnapshotTask) to get snapshot properties but it returns useless information (string= "Properties: some random number that changes each time I run it") 

Forgive me, but my scripting is limited so if this needs to be scripted please let me know the syntax.

Reply
0 Kudos
1 Reply
Burke-
VMware Employee
VMware Employee

When using vCO to create the snapshot, you end up with a VC:VirtualMachineSnapshot object. Immediately after creating, it would be good for you to simply store the .id property of that snapshot for later use in the commit operation. For further information/example, I recommend opening up the "Remove old snapshots" library workflow and looking at the "Get snapshots" scriptable task in it - there is some interesting code there that may be of use Smiley Wink Aside from that, the API Explorer is quite informative for the various object types you can work with.

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you! Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
Reply
0 Kudos