VMware Cloud Community
rami79
Contributor
Contributor

Update Virtual Machine Name

Does anyone know if the machine name property is readonly?

I'm trying to update the virtual machine name and tried updating the name and virtualMachine.Admin.Name properties and neither of them worked. From what I understand the Hostname property is for user prompt but I wanted to construct the name instead of asking the user.

0 Kudos
9 Replies
qc4vmware
Virtuoso
Virtuoso

Just set hostname during the MachineRequested or MachineBuilding PRE events using an event broker subscription.  We do this for all sorts of situations.

Paul

0 Kudos
rami79
Contributor
Contributor

Do I need to create the property Hostname in vRA first? I tried that and got the error that it cannot be empty.

0 Kudos
qc4vmware
Virtuoso
Virtuoso

I've never hit that before.  Hostname should get set to something during your deployment.  You sure you aren't somehow setting it to an empty value in the subscription?

0 Kudos
nsajepi
Enthusiast
Enthusiast

rami79​, I ran into the same issue on my vRA 7.2 environment where I wanted to give an option to the users either to use auto-generated names or typing in their own names. I found out that I couldn't leave hostname empty even though I had set it as a non-required field. So I found the below KB that helped me resolved the issue.

Error: “The data specified within the request is invalid. Composite error.” error in vRA 7.2 (2149701)

Cause: If a property definition created with a constraint required = no and is added to a blueprint with a flag show in request = true, it overrides the property definition constraint to mandatory.

As a result, back-end validation fails when users submits the request with no value for it.

https://kb.vmware.com/s/article/2149701

Let me know if this helps you out.

0 Kudos
rami79
Contributor
Contributor

Thank you very much for all your help guys, I really appreciate it.

qc4vmware so what I did was I set up a new custom property and set it to not required.  When I added the property into the property group I set the value to empty because I want vRA to do the initial naming so I can get the randomly generated number.  I then have a subscription set up at VMPSMasterWorkflow32.Requested Pre event to manipulate the name and add the project name in front of the id.   It sounded easy at first lol I wonder if I need to put something like machine.name in the value field.

nsajepi I'm running vRA 7.3.0, the article says that the problem should have been resolved by that version.  Although I know from experience that 7.3.0 has many bugs this might be one of them. I know that 7.3.1 came out a few weeks back maybe I will update to that and see what happens.

Thanks

0 Kudos
nsajepi
Enthusiast
Enthusiast

@rami79, did you happen to find a working solution?

0 Kudos
qc4vmware
Virtuoso
Virtuoso

In our workflow during that step I set these two properties VirtualMachineName and VMDNSName to whatever the value is for hostname.  It seems like modifying these values at this point in the provisioning has the desired effect for me.

0 Kudos
rami79
Contributor
Contributor

I upgraded our systems to 7.3.1, and used the VirtualMachine.Admin.Name property to change the name after the fact.  That deployed the virtual machine with the proper name but the name property in vRA is still unchanged, so the email gets sent out with the wrong name lol.

Also I found this article online which really explained what I was doing wrong https://www.sddcmaster.com/2017/02/vrealize-event-broker-and-extensibility.html.​ I was trying to run multiple workflows and changing the properties in each workflow within the same event. 

thanks guys

0 Kudos
vklinden
VMware Employee
VMware Employee

hostname is the property used for naming the machine.
0 Kudos