VMware Cloud Community
omrsafetyo
Enthusiast
Enthusiast

Applying customizations during content library OVF deployment

I've managed to find this thread which outlines how to deploy from OVF templates in a content library using VRO: https://communities.vmware.com/t5/vRealize-Orchestrator/Deploy-VM-from-template-which-is-located-in-...

I'm trying to utilize this code to fork a copy of the built in VRO "Clone, Windows with single NIC" workflow.  In this workflow, there are two customizations that are used in the getCloneSpec step -> there is a call to getCustomizationSpec, as well as getConfigSpecSimple.  The sample code I posted above does not make these customizations, and I'm trying to figure out the best way to go about this.

One method I started with is to try to run these customizations after the ovf deployment is complete.  As a continuation of the code above, I was adding the following (the first line is already included):

// return the vmObject
vmObject = VcPlugin.getAllVirtualMachines(null, "xpath:matches(id, '" + result.resource_id.id + "')")[0];

var progress = false
var pollRate = 30

if (null != configSpec) {
	System.log("Applying config spec");
	var configTaskResult = vmObject.reconfigVM_Task(configSpec);
	actionResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(configTaskResult,progress,pollRate) ;
}

if (null != customizationSpec) {
	System.log("Applying customization spec");
	var taskResult = System.getModule("com.vmware.library.vc.vm").customizeVM(vmObject, customizationSpec);
	actionResult = System.getModule("com.vmware.library.vc.basic").vim3WaitTaskEnd(taskResult,progress,pollRate) ;
}



But then I was looking at the documentation for com_vmware_vcenter_ovf_library__item_resource__pool__deployment__spec (https://vdc-download.vmware.com/vmwb-repository/dcr-public/d87b0863-0ebd-4ec7-b032-40398c7fded9/0ace...), and noticed there are additional_parameters which is an array of specs of the following types:

Would it be better to translate/re-do the existing steps that create the config and customization steps, and create OVF config options?  And does anyone know how these existing config specs map?  The two types currently being used are
VcCustomizationSpec
VcVirtualMachineConfigSpec

And these are passed into the VcVirtualMachineCloneSpec used in the existing workflow.

Any insight is appreciated.

Reply
0 Kudos
1 Reply
omrsafetyo
Enthusiast
Enthusiast

So still trying to figure this out.  As for the network portion, it looks like I need to do the following:

var networkMappings = new Properties();
networkMappings.put("VM Network", networkObject.id);
resourcePoolDeploymentSpec.network_mappings = networkMappings;



But the "VM Network" needs to be customized to the network name that exists on the NIC built into the OVF, and I can't figure out how to pull this back.  LucD outlined how to do this with PowerCLI: https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/get-ovfconfigurationa-and-multiple-net...

$pgName = 'xyz'
$ovfPath = "\my.ova"
$ovfConfig = Get-OvfConfiguration -Ovf $ovfPath
$ovfconfig.NetworkMapping | Get-Member -MemberType CodeProperty |
ForEach-Object -Process {
   $ovfConfig.NetworkMapping."$($_.Name)".Value = $pgName
}

 
This commandlet doesn't read into the content library, it requires the Ovf to be local where you're running PowerCLI.  I also can't find where to do the equivalent in VRO.

Reply
0 Kudos