This issue is resolved in vRealize Automation 7.3, available at
VMware Downloads.
To resolve the issue if you do not want to upgrade:
- Log in to the IaaS database and run the below script to get a list of all expired machines in your system:
// Get expired machines from IaaS SQL server
GO
DECLARE @listStr NVARCHAR(max)
SELECT @listStr = COALESCE(+@listStr+',', '') + ''''
+ virtualmachineproperties.propertyvalue
+ ''''
FROM virtualmachine
JOIN virtualmachineproperties
ON virtualmachine.virtualmachineid = virtualmachineproperties.entityid
AND virtualmachineproperties.propertyname =
'__iaas_request_binding_id'
WHERE virtualmachinestate = 'Expired'
SELECT @listStr
GO - Open an SSH session to the vRealize Automation VA and log in to the embedded postgres by running the following:
- Navigate to /opt/vmware/vpostgres/current/bin
- Enter the command: su postgres
- Enter the command: ./psql vcac
- Create a backup of the table getting modified by running the command:
Select * into cat_resource_bkp_temp from cat_resource
Note: Ensure the table cat_resource_bkp_temp is created before you proceed further.
- Run the query below against vcac postgres database, by replacing <list> with the output list from step #1.
// Update the deployments in Postgres that have machines that have expired as per SQL Server
UPDATE cat_resource
SET leasestate = 'ARCHIVED'
WHERE id IN
(
SELECT id AS parentid
FROM cat_resource
WHERE id IN
(
SELECT Cast(cafe_resource_id AS UUID)
FROM comp_deployment
WHERE prov_req_id IN
(
SELECT parent_id
FROM comp_comprequest
WHERE binding_id IN ( <list>)
)
)
)
AND
leasestate = 'ACTIVE' - Run the query below against vcac postgres database, by replacing <list> with the output list from step #1.
UPDATE cat_resource
SET leasestate = 'ARCHIVED'
WHERE id IN (SELECT parent.id
FROM cat_resource parent
JOIN cat_resource child
ON parent.id = child.parentresource_id
WHERE child.NAME IN (<list>))
For example, the query looks similar to:
UPDATE cat_resource
SET leasestate = 'ARCHIVED'
WHERE id IN (SELECT parent.id
FROM cat_resource parent
JOIN cat_resource child
ON parent.id = child.parentresource_id
WHERE child.NAME IN ( 'VivekMn076', 'VivekMn073', 'VivekMn074' ))
This query matches the state of expired machines in the IaaS database and machines in the Postgres database, bringing back consistency.
- (Optional) After verifying that the deployments in machines_to_expire_temp have stopped sending out expire request failed notifications, drop the table machines_to_expire_temp and cat_resource_bkp_temp.
Note: If the queries are not run correctly, it can cause database corruption. Always take a backup to provide a stable roll-back point.