Quantcast
Channel: VMware Communities : All Content - vSphere Management SDK
Viewing all articles
Browse latest Browse all 1860

How can I clone and customize a template using Java vSphere SDK?

$
0
0

I am running a vCenter 6.0 server with a few RedHat Linux 7.x templates.

I am writing a program which must be able to deploy VMs from these templates with customized hostnames and IP addresses.

Using the sample VMClone.java causes the vCenter to log the error:

"A specified parameter was not correct: spec.location.pool"

I am assuming this is because I have to explicitly define the resource pool to use, though the only code the sample has regarding VM specs is:

private VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
private VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

It appears that the VirtualMachineRelocateSpec object is what defines the resource pool and has methods to change it, though I cannot find any documentation on how exactly  to change the pool.

 

Any help on fixing this error and customizing the hostname and IP during cloning would be greatly appreciated.

private VirtualMachineCloneSpec cloneSpec = new VirtualMachineCloneSpec();
    private VirtualMachineRelocateSpec relocSpec = new VirtualMachineRelocateSpec();

Viewing all articles
Browse latest Browse all 1860

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>