System.out.println("Some Exception While Registering The VM");
}
}
private void createVmFromTemplate() throws Exception {
VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
ManagedObjectReference morDatastore = new ManagedObjectReference();
morDatastore.setType("Datastore");
morDatastore.set_value("datastore-30");
ManagedObjectReference morHost = new ManagedObjectReference();
morHost.setType("HostSystem");
morHost.set_value("host-48");
ManagedObjectReference morPool = new ManagedObjectReference();
morPool.setType("ResourcePool");
morPool.set_value("resgroup-41");
VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();
cloneSpec.setLocation(relocSpec);
cloneSpec.setPowerOn(false);
cloneSpec.setTemplate(false);
relocSpec.setDatastore(morDatastore);
relocSpec.setHost(morHost);
relocSpec.setPool(morPool);