Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 246801

Re: vCloud plugin 5.1 manage snapshots

$
0
0

Copying / Pasting internal thread. Credits go to Ivaylo Fizief.

 

 

The snapshot API is not exposed completely.

You can list all VM / vApp snapshots by using this code:

 

 

var snapshotSections = vm.section.find(new VclSnapshotSection());
System.log(snapshotSections.length + " snapshots found") ;for each (var snapshotSection in snapshotSections) {
 var snapshot = snapshotSection.snapshot;if (snapshot != null) {   System.log(snapshot.size);}} //To create a snapshot you can use this work around: 
var params = new VclCreateSnapshotParams();
params.name = "name";
params.description = "description"// ... 
var taskXml = vm.getHost().post(vm.href + "/action/createSnapshot",
 params.toXml(),"application/vnd.vmware.vcloud.createSnapshotParams+xml",null); 
var taskId = // parse the task XML and extract the task id
var task = vm.getHost().getEntityById(VclFinderType.TASK, taskId); // wait for the task

 

 

 

You can use the same work around with other snapshot APIs (http://tpub-review.eng.vmware....)

 

Christophe.


Viewing all articles
Browse latest Browse all 246801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>