Hello everybody,
I work on a web interface which manage virtual machines on vsphere Esx 5.5. My interface is based on .net web forms (not MVC)
I followed jeffpaton posts (using VMware.Vim ) which helped me (Thanks to you, Jeff).
But now i freeze on this subject. I do not know how to wait a task after cloning VM. I develop a little web page which launch vsphere command to my vsphere Esc with vmware.vim. I need to know when vpshere is finished his work to launch an another instruction.
I try to use PropertyCollector but i do not know how to use it :
i read this post but without success :
Synchronous versus Asynchronous Calls in vSphere API | DoubleCloud => Private Cloud + Public Cloud
What is the best way to wait for a Task in a concurrent environment?
Here is my code. i use jeffpaton functions.
...
using VMware.Vim;
...
VimClient client;
string serverUrl = "..."
client.Connect("https://" + serverUrl + "/sdk");
client.Login(userLogin, userPassword);
...
ManagedObjectReference cloneTask_MoRef = null;
cloneTask_MoRef = sourceVm.cloneVM_Task(sourceVm.Parent, "cloneName", mySpec);
if (cloneTask_MoRef == null) {
//error
}else
{
PropertyCollector pc = new PropertyCollector(client, cloneTask_MoRef);
//1 PropertyFilterSpec [] pfs;
//ObjectSpec
ObjectSpec objectSpec = new ObjectSpec();
//PropertySpec
//What could i do to know if the task is over or in progress ? :-(
I need some help.
Thanks for all.