Hey,
This is frustrating me... seems simple. Looks simple yet doesn't work...
I am trying to use the CloneVM_Task to do a simple clone, HostA cloned to HostB... no changes nothing new. But this is the exception I get:
AxisFault faultCode: ServerFaultCode faultSubcode: faultString: faultActor: faultNode: faultDetail: MethodNotFoundFault: 416 CloneVM |
I look in the sample provided with VI SDK 2.5 and it seems to be doing exactly what I am doing. Not quite the exact same way of doing things, but all the same values that are needed as parameters for the CloneVM_Task method are set and passed. Got frustrated and tried to call CloneVM() which gives me the below message (I read somewhere that CloneVM was for 1.0 and CloneVM_Task is post 2.0, so this error would make send if I read right. Do I understand this right? or is there some other diffrence betweek them?)
AxisFault faultCode: ServerFaultCode faultSubcode: faultString: The operation is not supported on the object. faultActor: faultNode: faultDetail: NotSupportedFault: null |
The code I am using to do this looks like this (the top values are tehre just to give you the object types):
ManagedObjectReference baseRef // has been set ManagedObjectReference datastore // has been set ManagedObjectReference vmFolder // has been set VimPortType connexion // has been set String clone // has been set ... VirtualMachineCloneSpec vmcs = new VirtualMachineCloneSpec(); VirtualMachineRelocateSpec vmrs = new VirtualMachineRelocateSpec(); vmcs.setLocation(vmrs); vmcs.setPowerOn(false); vmcs.setTemplate(false); ManagedObjectReference ref = connexion.cloneVM_Task(baseRef, vmFolder, clone, vmcs); //wait for completion ... |
I probably did/ missed something stupid and simple (I hope). A solution would be well appreciated.
M@
Hi,
Couple of things you can verify:
1. Make sure that you are running this operation on a Virtual Center and not on the ESX server directly
2. The "baseRef" mor should be a valid mor of a Virtual Machine. In you description "HostA" and "HostB" therefore please check properly the mor.type should be "VirtualMachine"
3. Note that the "CloneVM" is a method that is presented by the VI Perl toolkit which is the synchronized version of the method "CloneVM_Task". The actual API method is the "CloneVM_Task" which is again internally used by the VI Perl Toolkit. Therefore in the Java Stubs that you are using you would only have the "CloneVM_Task" method.
Based on the error you are getting I suspect you would be doing something wrong as per the point 1 and 2 above.
Hope the above suggestion helps you resolve the issue.
~ Sidharth
Hi,
Couple of things you can verify:
1. Make sure that you are running this operation on a Virtual Center and not on the ESX server directly
2. The "baseRef" mor should be a valid mor of a Virtual Machine. In you description "HostA" and "HostB" therefore please check properly the mor.type should be "VirtualMachine"
3. Note that the "CloneVM" is a method that is presented by the VI Perl toolkit which is the synchronized version of the method "CloneVM_Task". The actual API method is the "CloneVM_Task" which is again internally used by the VI Perl Toolkit. Therefore in the Java Stubs that you are using you would only have the "CloneVM_Task" method.
Based on the error you are getting I suspect you would be doing something wrong as per the point 1 and 2 above.
Hope the above suggestion helps you resolve the issue.
~ Sidharth
Bang on.
That was the problem. Was going straight to the ESX Server. Thought it was something simple like that...
Thanks a lot!
M@
Are you saying that it is not possible to clone a vm with the api connecting directly to an ESX server?
Is it possible to clone a vm by issuing calls to an ESX server?
Seems like it is not. (I may be wrong, if someone knows better please speak up).
I would love it if this was the case, so then I could get rid of VC.
The GUI implies that it is not possible... and the API likewise.
M@
At a vmware dev conference I was told that a person could literally write their own copy of VC using the api, because VC was only using the api to accomplish its functionality.
In that case I am wrong : )
I would be very interested in finding a workaround to VC. I only use it for cloning right now since I was unable to find another solution.
If no one has yet, perhaps start a new discussion (everyones doing it : ), since this is drifting off the original topic.
(if you do so keep me posted : )
M@
I was told that you can do everything VC does with the api, that does not mean that you really can
Unfortunately it looks like you are correct.