Script to remove stale service registrations from vCenter Server.
book
Article ID: 371365
calendar_today
Updated On:
Products
VMware vCenter Server 7.0VMware vCenter Server 8.0
Issue/Introduction
Improper decommissioning of the 6.x PSC node or any vCenter from ELM might leave stale service registrations on the vCenter which leads to other issues.
Steps to check stale registrations on vCenter Server:
List of the services registered within the Platform Services Controller.
/usr/lib/vmware-lookupsvc/tools/lstool.py list --url https://localhost/lookupservice/sdk --no-check-cert > /tmp/psc.txt
Validate the number of service registrations for each vCenter:
For an environment with two vCenters in Enhanced Linked Mode (ELM), there would be two service registrations for each service. If there are more than two, then these can be potentially stale ones.
Identify a valid registration against stale registration using /etc/vmware/install-defaults/vmdir.ldu-guid to compare Node ID from above file (/tmp/psc.txt):
For Example:
The below service registration belongs to the mentioned Node ID. Name: ServiceName Description: ServiceDescription Service Product: com.vmware.cis Service Type: ServiceType Service ID: 1f10XX8f-438d-XXb-90f8-47e7d6XXa94f Site ID: default-first-site Node ID: b2b7XX1e-5XX9-4a55-88XX-699fXXeb1d6f Owner ID: [email protected] Version: 1.0 Endpoints: Type: com.vmware.cis.data.provider Protocol: vmomi URL: https://vcsa.example.org:443/sdk SSL trust: Endpoint Attributes: cis.common.ep.localurl: http://localhost:11080/sdk Attributes: com.vmware.cis.cm.HostId: 603b3XX1-fXXb-4XX2-aXX5-81517XX8f47a
The Node ID should match the entry in /etc/vmware/install-defaults/vmdir.ldu-guid.
Environment
VMware vCenter Server 7.x
VMware vCenter Server 8.x
Cause
Improper decommissioning of external PSC or vCenter in Enhanced Linked Mode (ELM).
Resolution
Follow the below steps to remove the stale service registrations from vCenter.
Shut down all the vCenter nodes in ELM and take a powered-off snapshot from each vCenter VM.
Power on all the vCenters.
Log in to any one of the vCenter's SSH session.
Validate the incorrect node by checking the URL from the service registration output.
Note down the Node ID for the incorrect service registration.
Run the attached script attached to this KB.
Steps to run the script:
./service_unregister_stalenode.sh <Node_ID of stale node>