Hi,
I just started using WebSphere SDKs and I get stuck on this trivial task: how to get reference to a VMware Host knowing its dnsname?
I want then to use it in a migration like
ManagedObjectReference task = sc.Service.MigrateVM_Task(
VirtualMachine.Create(sc, byVnUUID).getMor(),
null,
?,
VirtualMachineMovePriority.highPriority,
VirtualMachinePowerState.poweredOff, true);
Is there any snippet on how to use it?
Thanks,
Melice
Check out this sample code:
You want to read the 5 minute tutorial as well:
http://vijava.sourceforge.net/doc/getstarted/tutorial.htm
Good luck
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)
Hi Jin thanks for the answer.
I have already seen the code on your fantastic book
I'll try to generalize my question a little bit , maybe a bit more useful:
- among all the different ways to interact with vSphere (WS SDK, PowerCLI, ?) which one is suggeste, pro vs cons, especially by thinking that C# is the target language (no java, sorry!)
- advantages / differences between direct method call (i.e vm.PowerOffVM()) vs Task (i.e vm.PowerOffVM_Task())
Hope it could be interesting in general.
Melice
1. Depends what want to achieve. For scripting, you want PowerCLI because it's more task oriented. For building application especially large system, you want C#. In the PowerCLI document page, you will find a doc for developer introducing .NET binding.
2. a great question. I will write a blog about this in details/depth. Stay tuned to my blog for next post.
Steve JIN
Author of VMware VI and vSphere SDK (Prentice Hall)
Creator of open source vSphere (VI) Java API(Tutorial, Testimonials, Download, Samples, Forum)
Blog: DoubleCloud.ORG ( Top 10 Best Practices,[Object Model|http://www.doublecloud.org/2010/02/object-model-of-vmware-vsphere-api-a-big-picture-in-2-minutes/],[Common Mistakes|http://www.doublecloud.org/2010/01/31/common-mistakes-using-vmware-vi-and-vsphere-sdk/], Tiny REST API, Cloud Application Architecture)
1. What about ws-sdk? Is there any advantage on using it over powercli?
2. I'll stay tuned
Just a small question:
in Java you have the possibility to cast directly
ComputeResource cr = (ComputeResource) newHost.getParent();
in C# you have the ManagedHostReference (newHost.Parent)
how to get the actual object in general?
Thanks
Melice