Renaming a vRA Managed vSphere Cluster or vSphere Host (SKKB1026)

In this blog article we will see how can we rename vRealize Automation (vRA) 7.0 managed vSphere Cluster or vSphere Host without causing errors in vRA. Steps outlined here are also tested for vRA 6.2.3

 

Lab Environment

The logical design of this lab can be seen HERE.

 

Introduction

Renaming vSphere Host or a vSphere Cluster which is managed by vRA can cause different problems if not done properly. There are a couple of articles at the Additional Resources section of this article that describe how to do this properly for previous versions of vRA.

In this article we will demonstrate how to accomplish this for vRA 7.0.

The approach described here has been tested on:

  • VMware vRealize Automation 7.0
  • VMware vRealize Automation 6.2.3

For the purpose of this article I have a 2 node vSphere Cluster called vCenterCluster which is managed by vRA. The two node names are: esx-pay-a-31 and esx-pay-a-33.

At the end of the article we will have accomplished two things:

  • Successfully renamed vSpehre Host managed by vRA from esx-pay-a-33 to esx-pay-a-32
  • Successfully renamed vSpehre Cluster managed by vRA from vCenterCluster to CLU-PAY-A-01

 

Renaming a vSphere Host

Renaming a vRA managed vSphere host is pretty straightforward process.

Preparation

I’ve taken the following steps to prepare for successful execution:

  • Move all VM’s to the remaining hosts that will not be renamed.
  • If the ESXi host is part of a cluster, first enter the Maintenance mode to remove it from the cluster.
  • If the ESXi host is managed by VirtualCenter/vCenter Server, disconnect and remove the ESXi host from the vCenter Server.
  • Run Data Collation on the Computer Resource and make sure it finishes successfully.

Execution

I’ve taken the following steps to execute a rename of a host:

  • Rename the ESX host.
  • Join the ESX host to VirtualCenter/vCenter Server and clusters.
  • Run Data Collation on the Computer Resource and make sure it finishes successfully.
  • Using SQL Management Studio connect to the vRA database.
  • Update entries referring to the old vSphere Cluster name from the vRA database with the new vSphere Cluster name.
  • Remove ghost entries referring to the old vSphere Cluster name from the vRA database.

Let see these steps with more details.

In this example we are going to rename the esx-a-pay-33 host to esx-pay-a-32
Navigate to SQL Management Studio and connect to the vRA SQL database.
Select and view all entries from the dbo.Host table.
You should see output similar to the following:

Take a look at the results. Note all entries referring to the old vSphere Host name. In this case the old name is esx-pay-a-33.
In my case I’ve found that those entries are found only in few of the tables, so I’ve used the follows query to narrow down results only from those tables:

SELECT TOP 1000 [HostID]
,[HostName]
,[HostUniqueID]
,[HostDNSName]
FROM [vra-a-03].[dbo].[Host]

Connect to the host directly with a vSphere Client. Click ESXi host.
Click the Configuration tab.
Click DNS and Routing.
Click Properties.
In the DNS Configuration tab, edit the Name field. Change anything else that is necessary in your environment.
Click OK.
Join the ESX host to VirtualCenter/vCenter Server and clusters.

Make sure to run Data Collation on the Computer Resource.
At this point you should have renamed the node (to esx-pay-a-32) and add it back to the cluster.
Let’s execute the same query again:

Note that there is one additional entry:

HostID  HostName           HostUniqueID    HostDNSName
E2892A52-5CA7-4F08-9324-2056EE67B1DC     esx-pay-a-32.vmware.com          vcsa-a-01/Datacenter A/host/vCenterCluster/esx-pay-a-32.vmware.com            esx-pay-a-32.vmware.com

This is the entry for the renamed host.
Note also that there is a ghost entry for the old host

HostID  HostName           HostUniqueID    HostDNSName
192CC111-F765-4D38-855D-ECE374B5AD9E    esx-pay-a-33.vmware.com          vcsa-a-01/Datacenter A/host/vCenterCluster/esx-pay-a-33.vmware.com            esx-pay-a-33.vmware.com

Run query similar to the following to remove the ghost entry:

DELETE from dbo.Host
WHERE HostID = ‘192CC111-F765-4D38-855D-ECE374B5AD9E’

Now that the entry is gone let’s perform some testing.

 

Test

I’ve taken the following steps to test if the execution was successful:

  • Run Data Collection for the Computer Resource.
  • Power ON/OFF VM that was deployed on the renamed host before it was renamed.
  • Deploy new VM on the renamed host

All tests were executed successfully.

 

 

Renaming a vSphere Cluster

Renaming a vRA managed vSphere Cluster is a bit more complex task then renaming just a vSphere Host.

Preparation

I’ve taken the following steps to prepare for successful execution:

  • Run Data Collection for all Computer Resources connected to vSphere Cluster that will be renamed.
  • Toke back and stopped all vRA component VM’s
  • Toke backup of the vRA Database.

 

Execution

I’ve taken the following steps to execute a rename of a host:

  • Renamed the vSphere Cluster using the vSphere Web Client.
  • Updated entries referring to the old vSphere Cluster name from the vRA database with the new vSphere Cluster name.
  • Removed ghost entries referring to the old vSphere Cluster name from the vRA database..
  • Removed entries for previous Data Collection executions from the vRA database.
  • Powered on all vRA component VM’s

Let see these steps with more details.

In this example we are going to rename this vSphere Cluster to from vCenterCluster to CLU-PAY-A-01
Navigate to SQL Management Studio and connect to the vRA SQL database.
Select and view all entries from the dbo.Host table.
You should see output similar to the following:

Take a look at the results. Note all entries referring to the old vSphere Cluster name. In this case the old name is vCenterCluster.
In my case I’ve found that those entries are found only in few of the tables, so I’ve used the follows query to narrow down results only from those tables:

SELECT TOP 1000 [HostID]
,[HostName]
,[HostUniqueID]
,[HostDNSName]
FROM [vra-a-03].[dbo].[Host]

Now we need to replace the old name in all the tables.
To replace the entries in the HostName column use SQL query similar to the following:

UPDATE dbo.Host
SET HostName = ‘CLU-PAY-A-01’
WHERE HostID = ‘753875F8-859E-4C94-B444-EECF291598C0’

To replace the entries in the HostUniqueID column use SQL query similar to the following:

UPDATE dbo.Host
SET HostUniqueID = ‘vcsa-a-01/Datacenter A/host/CLU-PAY-A-01/esx-pay-a-32.vmware.com’
WHERE HostID = ‘E2892A52-5CA7-4F08-9324-2056EE67B1DC’

UPDATE dbo.Host
SET HostUniqueID = ‘vcsa-a-01/Datacenter A/host/CLU-PAY-A-01/esx-pay-a-31.vmware.com’
WHERE HostID = ‘577C59C0-C005-4617-A2C8-75E12438509D’

UPDATE dbo.Host
SET HostUniqueID = ‘vcsa-a-01/Datacenter A/host/CLU-PAY-A-01’
WHERE HostID = ‘753875F8-859E-4C94-B444-EECF291598C0’

 

To replace the entries in the HostDNSName column use SQL query similar to the following:

UPDATE dbo.Host
SET HostDNSName = ‘CLU-PAY-A-01’
WHERE HostID = ‘753875F8-859E-4C94-B444-EECF291598C0’

Login to vSphere and rename the cluster to CLU-PAY-A-01.

After successfully changing all the entries in the dbo.Host table it should look similar to this:

Note also that there is a ghost entry for the old host

HostID  HostName           HostUniqueID    HostDNSName
26CE2D90-7712-4B4D-8676-64EA0D14FF34    vCenterCluster  vcsa-a-01/Datacenter A/host/vCenterCluster                vCenterCluster

Run query similar to the following to remove the ghost entry:

DELETE from dbo.Host
WHERE HostID = ’26CE2D90-7712-4B4D-8676-64EA0D14FF34′

After successfully changing all the entries in the dbo.Host table it should look similar to this:

Test

I’ve taken the following steps to test if the execution was successful:

  • Run Data Collection for the Computer Resource.
  • Power ON/OFF VM that was deployed on the renamed host before it was renamed.
  • Deploy new VM on the renamed host

All tests were executed successfully.

 

Additional Resources

Renaming a vSphere cluster without causing errors in VMware vRealize Automation for Server 5.1.x (2041610)

Running an inventory data collection in vRealize Automation 6.0 fails with error: Object reference not set to an instance of an object (2073676)

Renaming the VMware vSphere Cluster used in a VMware vRealize Automation environment (2114494)

 Moving a managed ESXi/ESX host from one vCenter Server to another vCenter Server (1004775)

Deleting an endpoint in vRealize Automation fails with the error: This endpoint is being used by # compute resources and # storage paths and cannot be deleted (2105809)

Final Step

If all went well, go grab a beer.

Leave a Reply

Your email address will not be published. Required fields are marked *