Hello Guys!
I am using CloneVm to create a new VM, but I would like to specify the number of CPUs. I have researched a little and figured out I could use 'changeVMvCPU' to achieve that. However I was wondering if it is not possible to define the CPUs count direct on 'CloneVM'. Does any one knows?
Thanks,
Roger
You can re-write your own cloneVM operations, manually rebuilding the action/workflow to add appropriate configSpec to modify the hardware at the time of the clone.. if you REALLY want to. I have never bothered as it has not been worth the effort since the way I outlined uses existing workflows and actions that don't add significant time to the overall deployment time. The choice is yours so in short the answer is YES you should be able to do this in one call, it's just a bunch of effort to get it setup
See the code inside the changeVMvCPU action to see how to set the configSpec needed for CPU. Other important actions to look at code:
cloneVM - note the "spec" input
getCloneSpec
getConfigSpec
Build your custom workflow that calls the clone workflow, THEN once that's done, use the action within your workflow to modify the CPU count of the newly created VM. When you see such operations in vCenter, you may watch tasks when performed manually and see clone operation, followed by other operations that perform customization and hardware modifications.
Hello, I am currently doing exacly as you mentioned. What I would like to know is if there is some script or parameter that I could give to 'CloneVM' to configure CPU count to me. So VM would get created with everything configured.
After your explanation it seems not a bad practice to create the VM and then modify its properties, right?
Thank you!
You can re-write your own cloneVM operations, manually rebuilding the action/workflow to add appropriate configSpec to modify the hardware at the time of the clone.. if you REALLY want to. I have never bothered as it has not been worth the effort since the way I outlined uses existing workflows and actions that don't add significant time to the overall deployment time. The choice is yours so in short the answer is YES you should be able to do this in one call, it's just a bunch of effort to get it setup
See the code inside the changeVMvCPU action to see how to set the configSpec needed for CPU. Other important actions to look at code:
cloneVM - note the "spec" input
getCloneSpec
getConfigSpec
Hmmm... Actually....
It seems some of the library workflows have things in place for this request, but simply don't expose the inputs.. For example, for Clone/Customize Windows:
Clone, Windows with single NIC and credentials EDIT: Same steps below apply to the Clone, Linux with single NIC, and the other Clone/Customization workflows.
The change above will build the config spec to include the memory and CPU count.
Honestly, I never bothered looking deeper into this until your request because it was simply easier/faster to just use existing library elements
I really appreciate your help!
Interesting. I have a similar use case for adding a vDS portgroup and using a datastore cluster and a host cluster. In the default workflow, you can only use a standard swtich, a single host, and a single datastore. I have an additional action to change to a vDS (similar to your suggestion) but I have yet to look for a way to provision directly to a host/datastore cluster vs. the individual resources.