Hi,
Is there any way to manage snapshots using vCloud plugin 5.1? It seams to be missing.
If not, can we make a direct call to the vCloud Director API using the plugin? I can make a snapshot using REST api, but I need to do it from an Orchestrator workflow.
Thanks a lot.
Damian
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.
Hi Christophe,
Thanks a lot for your answer. Is exactly what I was looking for. I will try it.
By the way, I found a little trick to know if a VM has a snapshot. Even when the method is not exposed by the plugin, is still present in the XML. So, if you have a VM in a workflow, you can get the xml with .toXml() and check for the XML Element.
Regards,
Damián.
Glad you like the toXml() functionality. This was one of my feature requests to engineering
Yes, in fact, I use it to copy some Elements and create my own XML. Unfortunately, the XML plugin doesn't support the .importNode method .
By the way, I found some bugs (as you already know) and some errors in "built-in" workflows. I don't know how to report this things. For example: the Create Vdc workflow use "amount of cpu" as CpuSpeed.
I don't want to create a "case" because I don't really need assistance.
Is there any "contact form" or something to report this things?
Damián.
The only way for you to report a bug and having it tracked is by creating a case.
Customer cases are handled in priority and there is a full team of people managing the case until there is a resolution. They will also identify if this is a known issue and provide information about it, possible work arounds, until resolution.
Engineering resources working on a product are also determined by the necessity to handle such cases.
Christophe.