VMware Cloud Community
BillStreet00
Enthusiast
Enthusiast

Update VM Network during provisioning

We purchased a new IPAM solution that doesn't have a plugin for vRA but did have a sample on how to get the next available IP in the specified range.

I am running the workflow when the request hits the VMPSMasterWorkflow32.Requested - POST state as I had read somewhere that the new IP should be procured early in the build.

My workflow reads in information from the VM being built.  Since the user can specify any network that they have access to, I use the VirtualMachine.Network0.Name property as well as getApplicableNetworks to pull in a dropdown of the subnets.

I created a function to pull in the next available IP based on the VirtualMachine.Network0.Name (which works without issue). I However, when I attempt to run this module:

System.getModule("com.vmware.library.vcac").addUpdatePropertyFromVirtualMachineEntity(vCACHost,virtualMachineEntity,"VirtualMachine.Network0.Address",vmIP,isFalse,isFalse,isFalse,isFalse);

I get this error:

2017-09-08 11:17:32.486] [E] (com.vmware.library.vcac/addUpdatePropertyFromVirtualMachineEntity) Error in (Dynamic Script Module name : addUpdatePropertyFromVirtualMachineEntity#7) TypeError: Cannot find function getLink in object .

[2017-09-08 11:17:32.499] [E] Workflow execution stack:

***

item: 'MM Next Free IP/item1', state: 'failed', business state: 'null', exception: 'TypeError: Cannot find function getLink in object . (Dynamic Script Module name : addUpdatePropertyFromVirtualMachineEntity#7)'

workflow: 'MM Next Free IP' (b257e143-2291-4931-b5d4-8d469297f3a8)

|  'attribute': name=vCACHost type=vCAC:VCACHost value=dunes://service.dunes.ch/CustomSDKObject?id='5eb2dab1-fad8-4ae3-b949-1e7279b7cb0a'&dunesName='vCAC:VCACHost'

|  'input': name=payload type=Properties value=#[#lifecycleState#=#Properties##[#phase#=#string#POST#+#state#=#string#VMPSMasterWorkflow32.Requested#]##+#componentId#=#string#w2k12prod#+#blueprintName#=#string#ExtensibilityWF#+#componentTypeId#=#string#Infrastructure.CatalogItem.Machine.Virtual.vSphere#+#IaaSTimeoutId#=#number#23155.0#+#endpointId#=#string#af7a34a4-cdfa-43f3-893d-3490bab38d67#+#machine#=#Properties##[#owner#=#string#streebil@AMWINS.LOCAL#+#name#=#string#iteng0425#+#id#=#string#7b067f84-735b-4486-aac7-f749518b89eb#+#type#=#number#0.0#+#properties#=#Properties##[#VirtualMachine.Cafe.Blueprint.Id#=#string#ExtensibilityWF#+#__clonefromid#=#string#a84938bd-9b3b-459b-bb20-cff033d688f9#+#__Cafe.Request.BlueprintType#=#string#1#+#__InterfaceType#=#string#vSphere#+#VirtualMachine.Network0.PrimaryDns#=#string#10.10.116.8#+#__Notes#=#string#Stock production server.#+#VirtualMachine.Memory.Size#=#string#5120#+#VirtualMachine.Network0.DnsSuffix#=#string#amwins.local#+#VirtualMachine.Cafe.Blueprint.Component.Cluster.Index#=#string#0#+#VirtualMachine.CPU.Count#=#string#2#+#__VirtualMachine.Allocation.InitialMachineState#=#string#SubmittingRequest#+#__Clone_Type#=#string#CloneWorkflow#+#VirtualMachine.Cafe.Blueprint.Component.TypeId#=#string#Infrastructure.CatalogItem.Machine.Virtual.vSphere#+#__api.request.id#=#string#40f6e431-4a2f-4673-b49f-d2033f15f18d#+#__clonespec#=#string#vra#+#VirtualMachine.Disk0.Size#=#string#60#+#VirtualMachine.Admin.TotalDiskUsage#=#string#61440#+#VirtualMachine.Disk0.Label#=#string#Hard disk 1#+#__api.request.callback.service.id#=#string#1b0b4846-3f70-4526-b45b-51fd21912622#+#__DailyCost#=#string#{"type":"moneyTimeRate","cost":{"type":"money","currencyCode":"USD","amount":0.0},"basis":{"type":"timeSpan","unit":4,"amount":1}}#+#__trace_id#=#string#h35U3OR6#+#VirtualMachine.Cafe.Blueprint.Name#=#string#ExtensibilityWF#+#__iaas_request_binding_id#=#string#0352ddb3-4faa-4486-baa6-6bee35c71868#+#__Legacy.Workflow.ImpersonatingUser#=#string##+#__Legacy.Workflow.User#=#string#streebil@AMWINS.LOCAL#+#__VirtualMachine.ProvisioningWorkflowName#=#string#CloneWorkflow#+#VirtualMachine.Cafe.Blueprint.Component.Id#=#string#w2k12prod#+#VirtualMachine.Network0.DnsSearchSuffixes#=#string#amwins.local#+#VirtualMachine.Network0.Address#=#string#10.10.120.9#+#VirtualMachine.Network0.SubnetMask#=#string#255.255.255.0#+#VirtualMachine.Network0.SecondaryDns#=#string#10.11.116.8#+#VirtualMachine.Disk0.Storage#=#string#P10-SF-Platinum-VVOL#+#__reservationPolicyID#=#string#0a906444-1373-4d4d-ad89-af1e9ad8eb27#+#__clonefrom#=#string#2012R2_std_template_p10_vm65#+#VirtualMachine.Storage.Name#=#string#P10-SF-Platinum-VVOL#+#__Cafe.Request.VM.LeaseDays#=#string#1#+#__request_reason#=#string##+#__Cafe.Root.Request.Id#=#string#94bd5926-d78a-4b4b-9ff4-2841ff35d146#+#VirtualMachine.Network0.Gateway#=#string#10.10.120.3#+#VirtualMachine.Network0.Name#=#string#P10-10.10.119.0%2f24#+#VirtualMachine.Disk0.IsClone#=#string#true#]##]##+#requestId#=#string#40f6e431-4a2f-4673-b49f-d2033f15f18d#]#

|  'attribute': name=__asd_requestedBy type=string value=streebil@AMWINS.LOCAL

|  'attribute': name=__asd_tenantRef type=string value=vsphere.local

|  'attribute': name=__asd_targetResourceProviderTypeId type=string value=com.vmware.csp.iaas.blueprint.service

|  'attribute': name=__asd_requestInstanceId type=string value=d1c90c00-94a8-11e7-8196-b07524073a69

|  'attribute': name=__asd_requestInstanceTypeId type=string value=com.vmware.csp.iaas.blueprint.service.machine.lifecycle.provision

|  'attribute': name=__asd_catalogRequestId type=string value=4156aee9-3d04-451f-a461-717cecea6044

|  'attribute': name=__asd_requestedFor type=string value=streebil@AMWINS.LOCAL

|  'attribute': name=__asd_targetResourceId type=string value=7b067f84-735b-4486-aac7-f749518b89eb

|  'attribute': name=__asd_requestInstanceTimestamp type=string value="2017-09-08T11:17:25.000-04:00"

|  'attribute': name=__asd_targetResourceTypeId type=string value=machine

|  'attribute': name=__asd_correlationId type=string value=94bd5926-d78a-4b4b-9ff4-2841ff35d146

|  'attribute': name=__asd_requestTraceId type=string value=h35U3OR6

|  'attribute': name=__asd_targetResourceProviderId type=string value=103480de-6fab-456c-ad1b-15ff03450f69

|  'no outputs'

*** End of execution stack.

22 Replies
BillStreet00
Enthusiast
Enthusiast

I've created a new customization spec and template.  Same issue.

I have a property group called networking that I attached to the blueprint.  In that group I have VirtualMachine.Network0.Address, DnSuffix, Gateway, Name, NetworkProfileName, PrimaryDns, SecondaryDns and SubnetMask.

When I removed VirtualMachine.Network0.Address, I stopped getting errors. Even while added and not running the event subscription it would toss the ipadapter error. When removed the machine would provision but not use the settings from the workflow.  I checked the workflow to ensure the virtualMachineAddOrUpdateProperties = outputProperties; line was running correctly and I am pushing the correct information to the VM.

I am running vCenter 6.5, vRA 7.3 and vRO 7.3

0 Kudos
nsajepi
Enthusiast
Enthusiast

BillStreet00   I am experiencing the same error "A specified parameter was not correct: spec.nicSettingMap.adapter.ip.ipAddress." I am also using vCenter 6.5, vRA 7.3 and vRO 7.3.

0 Kudos
BillStreet00
Enthusiast
Enthusiast

Since we were using MiceandMen I ended up getting the next IP address from there.  I hashed out the netmask, subnet and gateway then used the update network action during pre-build. This was the only way to get around the error.

0 Kudos