So I have been working on a custom workflow that creates new Instantiations of various vApp templates to dump into our vCloud Director 5.5 env. Overall this a basic clone of of the "Instantiate a vApp template" that comes baked into VCO/VCD plugin.
I am doing a few custom actions at the end (via scriptable task) like changing vApp Owner, change cpu size, memory size, vm name , and computer/guest os name ( all derived from user input). This is all performed after the vapp/vm has been created and I simply power off the vm before making any changes.
All seems to be working fine, except I seem to be running into a bug or an issue where the "computer/guestOS name" is updated within the VCD GUI itself but guest customization failed to update the hostname inside the guest operating system (both Linux and windows based)
A simple power off and “Power On and Force Re-Customization” seems to fix the issue. (I suspect guest customization happens before I power off the deployed vm, and even after my changes are made it is not enough to re-trigger customization when I power the vm back on.)
I started out this search on a more simple effort to see if I can find a method in VCO to just simply replicate a “Power On and Force Re-Customization” and just throw it the end of my post deploy scriptable task. However, I quickly found out that such functionality is extremely hard to find and or does not exist for an existing deployed virtual machine. (PLEASE CORRECT ME IF I AM WRONG!! )
After I gave up on trying to find the elusive re-customization code, I stumbled upon the VCHS/vCloud API guides which reference what I am trying to do, but doing it up front before the vapp is instantiated. These methods reference creating and or modifying sourcedVMInstantiationParams which in theory could modify everything I need and feed into the process before its fired up in the “createInstantiateVAppTemplateParams” .
I am fiddling around with code to try and feed this process but haven’t had success:
//Source VM HW Params
var coresPerSocketArg =1;
var memorySizeArg = memInputGb;
var numberOfCpusArg = cpuInput;
System.log("Right b4 VclInstantiateVmHardwareCustomizationParams");
//Port them over ??
var hwParams = new VclInstantiateVmHardwareCustomizationParams();
hwParams.coresPerSocket = coresPerSocketArg;
hwParams.memorySize = memorySizeArg;
hwParams.numberOfCpus = numberOfCpusArg;
var sourcedVMParams = new VclSourcedVmInstantiationParams() ;
sourcedVMParams.hardwareCustomization =hwParams;
“sourcedVMParams” is then fed into “createInstantiateVAppTemplateParams” as the variable mapped to the local parameter of “sourcedVmInstantiationParamsArg”. I have tried many different iterations of this with no success.
This is what I suppose I am trying to recreate within VCO: http://pubs.vmware.com/vcd-55/index.jsp#com.vmware.vcloud.api.doc_55/GUID-DE3617A1-267E-4CD3-914B-834EB57FA8CD.html
But all the references are referring to user the REST API instead of using the vco javascripty language instead. I am very close to just go this route but figure I would post this to see if anyone has any ideas and experience to throw my way.
Any ways – much appreciation for any comments , responses etc.