VMware Cloud Community
future2000
Enthusiast
Enthusiast
Jump to solution

Custom Properties to allow Blueprint requestor to define IP address and select a network

Hi,

I have a property definition which defines


VirtualMachine.Network0.Name

This provides a dropdown list with predefined values, by which a requester can select a network to which they wish to connect their VM. This works perfectly and the VM requested is connected to the respective vSphere port group.

I am trying to combine the above property with the

VirtualMachine.Network0.IPAddress

I have this setup to allow the requester to specify an IP address. Whatever the requester put's in the form the IP address is simply assigned from the network profile and the user specified address is ignored. This happens whether I configure the above property in a Property group or directly on the blueprint via custom properties.

Any ideas?

1 Solution

Accepted Solutions
AlexJudge
VMware Employee
VMware Employee
Jump to solution

I think the confusion here is with the Network objects on the design canvas.

I've been working on a similar solution this week. I need the customer to be able to select the network, and define an IP address. Ultimately, this doesn't work if there's an Existing Network object on the design canvas. You have to do away with that.

Secondly, you can't assign network properties to a VM component on the blueprint directly. The Designer will complain if you try and set these directly. The properties have to be part of a Property Group.


So for me, I have a property Group with:

virtualmachine.network0.name

virtualmachine.network0.address

virtualmachine.network0.subnetmask

virtualmachine.network0.primarydns

virtualmachine.network0.gateway


Under Property Definitions, I have a drop down list of values for virtualmachine.network0.name.



View solution in original post

13 Replies
AlexJudge
VMware Employee
VMware Employee
Jump to solution

I think any network path that has a profile on it will take precedence over custom properties.

The simplest solution is to create  a new Port Group in vCenter for the given VLAN. Do a Data Collection and add the port group to your vRA reservation, but don't associate a network profile with it.

0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Thanks Alex. Removing the network profile from the Network path setting in the reservation didn't appear to make any difference!

I've tried adding the VirtualMachine.Network0.Address property in custom properties in the blueprint but am unable to save the configuration. 'Specify network properties in the Network Adapters grid.' is displayed. Adding VirtualMachine.Network0.Address in the Network Adapter custom properties will display the property when a user requests the blueprint but the box is greyed out and won't accept input!

Using both these properties at the same time in any combination currently results in the Guest customization failing. 'Cannot complete customization'. vRA then destroys the system.

I'm curious, is allowing the user to specify a vSphere port group/VLAN and IP address not a common use case for vRA? If it is, how can I achieve this? Do I need to do it with vRO workflow.

0 Kudos
AlexJudge
VMware Employee
VMware Employee
Jump to solution

Have a look at this thread, I think this is the same issue you're having.

vRA 7 Specify IP Address on Deployment

0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Try as I might I could not get this to work. I couldn't allow the user to specify both a network and an IP address, with any combination!

On initial deployment of the system, the correct network selected would get connected and the system would have an IP allocated from the network profile on the reservation.

I ended up using the Guest Agent to run some powershell post provisioning.

param ($IPAddress)

$IPType = "IPv4"

$adapter = Get-NetAdapter | Where-Object { $_.Status -eq "up" }

If (($adapter | Get-NetIPConfiguration).IPv4Address.IPAddress) {

    $adapter | Remove-NetIPAddress -AddressFamily $IPType -Confirm:$false

$Adapter | New-NetIPAddress `

    -AddressFamily $IPType `

    -IPAddress $IPAddress `

    }

start-sleep 120

IPCONFIG /REGISTER DNS

On the blueprint I prompted users for an IP Address which was a custom property which I could then pass to the Guest Agent script. This worked, the Guest Agent changed the IP. However the next problem was that vRA 7 didn't recognise the IP change for the system until an inventory cycle had run, even when it did recognise the IP change the properties of the VM in vRA 7 no longer showed a NIC!

Not the most elegant solution!

0 Kudos
GrantOrchardVMw
Commander
Commander
Jump to solution

I'd actually like to get to the bottom of this.

Can you confirm a few things so I can setup the same flow:

1. You used custom properties for both the Network Path and IP Address.

2. The path is mapped in the Reservation without (or with?) an associated network profile.

Grant

Grant http://grantorchard.com
0 Kudos
AlexJudge
VMware Employee
VMware Employee
Jump to solution

I think the confusion here is with the Network objects on the design canvas.

I've been working on a similar solution this week. I need the customer to be able to select the network, and define an IP address. Ultimately, this doesn't work if there's an Existing Network object on the design canvas. You have to do away with that.

Secondly, you can't assign network properties to a VM component on the blueprint directly. The Designer will complain if you try and set these directly. The properties have to be part of a Property Group.


So for me, I have a property Group with:

virtualmachine.network0.name

virtualmachine.network0.address

virtualmachine.network0.subnetmask

virtualmachine.network0.primarydns

virtualmachine.network0.gateway


Under Property Definitions, I have a drop down list of values for virtualmachine.network0.name.



GrantOrchardVMw
Commander
Commander
Jump to solution

Nice one Alex!

Grant

Grant http://grantorchard.com
0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Verified and confirmed. Big thanks Alex...

Blueprint configured without any network element on design canvas.

Property Group UserSpecifiedIP configured with...

VirtualMachine.Network0.Address (Show in Request)

Property Group NetworkSelector configured with

VirtualMachine.Network0.Name (Show in Request)

Provides a drop down list for all vSphere port groups.

Network profiles exist which contain the entire range available in that subnet / VLAN. Reservations do have the relevant network profile configured in the drop down.

Machines are provisioned with the correct IP address, on the correct network and best of all is that the network is reflected in vRA. Have to save my previous effort for something else.Thanks again!

0 Kudos
AlexJudge
VMware Employee
VMware Employee
Jump to solution

Excellent, glad I could help.

I think the documentation could be a little clearer on this subject. I've been doing vRA for the best part of 4 years, and it took me a little while to figure it out!

0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

I got happy to soon. :smileycry:

After an inventory collection cycle, the machine in vRA no longer shows the NIC entity, just like before (see screenshot). The correct IP is shown however. Unfortunately for me though the network profile and IP range defined for that network display the vRA system with the wrong IP. Namely one from the very start of the range, which it is obviously no longer using. Each additional deployment then will start progressively filling up the range. Not good. Worse is that the IP the system is using is still available.

Regarding the property group you are using, are all those properties 'shown in the request'? I.e. does the user specify all those elements when requesting a system.

I just wanted a user to specify the IP (alone), and the network, I was hoping the remaining settings would then getting assigned from the respective network profile attached to that network in the reservation. I think perhaps this just isn't possible and that the requestor needs to define all the elements you have in your property group manually.

0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Ok, so I added the VirtualMachine.Network0.ProfileName custom property and created another drop down with the Network profiles I have configured. I have this 'Displayed in the Request' as well.

The user now has to specify a Port group (VirtualMachine.Network0.Name) and a Network Profile (VirtualMachine.Network0.ProfileName).

The machine is then provisioned with the correct IP address and the correct IP is shown in vRA for the system and the correct IP is allocated in the IP range

screenshot2.jpg

Not sure but I think I can create a relationship between these two properties so that when one is selected the other will be selected automatically. That would look better. Upgrade to 7.0.1 first I think.

0 Kudos
AlexJudge
VMware Employee
VMware Employee
Jump to solution

Interesting.

I've  been playing with this a bit more. In my example, I don't have a network profile associated with the network path in the reservation, what happens if you remove it from your environment, does it work then?

The other thing I've noticed (I haven't had time to test it though) is that you can create  a network profile that doesn't have an IP range associated with it. I'm wondering if you can get away with configuring it that way, and just have a custom property field for virtualmachine.network0.address.

I'll do some testing in my lab and will report back.

0 Kudos
future2000
Enthusiast
Enthusiast
Jump to solution

Its working now. I have the user specify both network and port groups, using the virtualmachine.network0.name and virtualmachine.network0.profilename properties.

screenshot3.jpg

When I remove the profile from the reservation the provisioning operation fails in vsphere 'Cannot complete customization'.

I was hoping I could create a relationship between those two properties like you did in vCAC 6.x (with some xml) but I don't think that is possible any more?! If the user specified a port group then a network profile was selected.

Nice idea about not having a IP range assigned. I could try this but it may affect other blueprints, where the user doesn't select a network, they just provide an IP.

0 Kudos