Decommissioning a vCenter PSC and VCSA

Posted by & filed under Virtualization, VMWare.

I recently needed to decommission a VCSA and external PSC. Following the VMWare KB 2106736 I proceeded to decomission the servers usign the cmsso utility.

 

Decommission vCenter — connected to the PSC it is registered with and:

root@vcenter-sb-psc [ ~ ]# cmsso-util unregister --node-pnid vcenter-sb.redacted.lan --username administrator@vsphere.local
Password:
2017-11-01T18:20:15.806Z   Running command: ['/usr/lib/vmware-vmafd/bin/dir-cli', 'service', 'list', '--login', 'administrator@vsphere.local']
2017-11-01T18:20:15.863Z   Done running command
Success

Now to connect to the PSC that will be staying online and decommission the other PSC

root@vcenter-psc [ ~ ]# cmsso-util unregister --node-pnid vcenter-sb --username administrator@vsphere.local
Password:
Could not find a host id which maps to vcenter-sb in Component Manager
Failed!!!

I proceeded to use vdcrepadmin to check out the replication partners which is only vcenter-sb-psc.redacted.lan from my PSC that will be staying online:

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcrepadmin -f showpartners -h vcenter-psc.redacted.lan -u administrator
password:
ldap://vcenter-sb-psc.redacted.lan

Then I checked the actual servers:

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcrepadmin -f showservers -h vcenter-psc.redacted.lan -u administrator
password:
cn=vcenter-psc.redacted.lan,cn=Servers,cn=redactedfl,cn=Sites,cn=Configuration,dc=vsphere,dc=local
cn=vcenter-sb-psc.redacted.lan,cn=Servers,cn=redactedsb,cn=Sites,cn=Configuration,dc=vsphere,dc=local

We see both PSC’s as expected. Finally I removed the PSC that is to be decommissioned:

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcleavefed -h vcenter-sb-psc.redacted.lan -u administrator
password:
vdcleavefd offline for server vcenter-sb-psc.redacted.lan
Leave federation cleanup failed. Error[1] - Operations error

Error again. Some googling led me to techbrainblog’s excellent page on using these utilities and also the solutions to some common but cryptic errors. Very useful. The solution to this error in particular is to simply shut down the old PSC. It needs to be offline before the command is ran.

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcleavefed -h vcenter-sb-psc.redacted.lan -u administrator
password:
vdcleavefd offline for server vcenter-sb-psc.redacted.lan
 vcenter-sb-psc.tnsc.lan server cleanup performed.

Good to go!

Ref: https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2106736

Ref: https://techbrainblog.com/2015/10/02/issues-and-errors-when-decommissioning-the-vcenter-server-or-a-platform-services-controller-vcsa-6-0/

Changing the IP address of a VMWare PSC via the command line

Posted by & filed under Virtualization, VMWare.

I recently needed to change the IP address of my PSC. Unfortunately it was already inaccessible so I was unable to do it via the standard GUI methods. I SSH’d into the box and had a look but it pretty immediately becomes apparent you can’t just update things the way you would a normal linux box. Enter vami_config_net. I believe this utility is available on any of the VMWare appliances that utilize VAMI/photon but I could be wrong. As you may notice int he article it refers to this being for the vCetner Support Assistant, but it worked just the same for me on my external PSC.

kb.vmware.com/selfservice/microsites/sea…

/opt/vmware/share/vami/vami_config_net

Platform services controller — Migrating to external psc and verifying replication partners

Posted by & filed under Virtualization, VMWare.

In preparation for migrating from vCenter 6.5 w/ embedded PSC, to a external PSC I needed to validate the replication between my new external PSC and the embedded platform services controller. To validate PSC replication partners, the vdcrepadmin utility can be used. For more information see https://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2127057

login as: root

VMware vCenter Server Appliance 6.5.0.10000

Type: VMware Platform Services Controller

Using keyboard-interactive authentication.
Password:
Connected to service

    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"

Command> shell
Shell access is granted to root
root@vcenter-psc [ ~ ]# cd /usr/lib/vmware-vmdir/bin
root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcrepadmin -f showservers -h localhost -u Administrator -w Passw\!rd
cn=vcenter.redacted.lan,cn=Servers,cn=redactedfl,cn=Sites,cn=Configuration,dc=vsphere,dc=local
cn=vcenter-psc.redacted.lan,cn=Servers,cn=redactedfl,cn=Sites,cn=Configuration,dc=vsphere,dc=local
root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]#

Note in the above commands, for the -w parameter, non alpha characters must be escaped with a \ otherwise you may get authentication failures.

I am now able to continue with the external psc migration as detailed here: docs.vmware.com/en/VMware-vSphere/6.5/co…

root@vcenter [ /usr/lib/vmware-vmdir/bin ]# service-control --status --all
Running:
 applmgmt lwsmd pschealth vmafdd vmcad vmdird vmdnsd vmonapi vmware-cis-license vmware-cm vmware-content-library vmware-eam vmware-perfcharts vmware-psc-client vmware-rhttpproxy vmware-sca vmware-sps vmware-statsmonitor vmware-sts-idmd vmware-stsd vmware-updatemgr vmware-vapi-endpoint vmware-vmon vmware-vpostgres vmware-vpxd vmware-vpxd-svcs vmware-vsan-health vmware-vsm vsphere-client vsphere-ui
Stopped:
 vmcam vmware-imagebuilder vmware-mbcs vmware-netdumper vmware-rbd-watchdog vmware-vcha
root@vcenter [ /usr/lib/vmware-vmdir/bin ]# cmsso-util reconfigure --repoint-psc vcenter-psc.redacted.lan --username administrator --domain-name vsphere.local --passwd Passw0rd!
Validating Provided Configuration ...
Validation Completed Successfully.
Executing reconfiguring steps. This will take few minutes to complete.
Please wait ...
Stopping all the services ...
All services stopped.
Perform update startuptype operation in stop order. startup_type=Disabled, svc_names=[u'vmware-psc-client', u'pschealth', u'vmdnsd', u'vmware-cis-license', u'vmware-stsd', u'vmware-sts-idmd', u'vmcad', u'vmdird'], include_vmonsvcs=False include_coreossvcs=False, include_leafossvcs=False
2017-09-21T16:42:42.742Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmware-psc-client']
2017-09-21T16:42:42.851Z   Done running command
Successfully changed startuptype for service vmware-psc-client
2017-09-21T16:42:42.858Z   Successfully updated starttype: DISABLED for service pschealth
2017-09-21T16:42:42.858Z   Successfully updated pschealth service
Successfully changed startuptype for service pschealth
2017-09-21T16:42:42.866Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmdnsd']
2017-09-21T16:42:42.953Z   Done running command
Successfully changed startuptype for service vmdnsd
2017-09-21T16:42:42.960Z   Successfully updated starttype: DISABLED for service cis-license
2017-09-21T16:42:42.960Z   Successfully updated cis-license service
Successfully changed startuptype for service cis-license
2017-09-21T16:42:42.967Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmware-stsd']
2017-09-21T16:42:43.077Z   Done running command
Successfully changed startuptype for service vmware-stsd
2017-09-21T16:42:43.084Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmware-sts-idmd']
2017-09-21T16:42:43.206Z   Done running command
Successfully changed startuptype for service vmware-sts-idmd
2017-09-21T16:42:43.213Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmcad']
2017-09-21T16:42:43.331Z   Done running command
Successfully changed startuptype for service vmcad
2017-09-21T16:42:43.338Z   Running command: ['/usr/bin/systemctl', 'mask', u'vmdird']
2017-09-21T16:42:43.455Z   Done running command
Successfully changed startuptype for service vmdird
2017-09-21T16:42:43.460Z   Running command: ['/sbin/chkconfig', u'vmware-rhttpproxy']
2017-09-21T16:42:43.486Z   Done running command
2017-09-21T16:42:43.487Z   Running command: ['/sbin/chkconfig', u'vmware-stsd']
2017-09-21T16:42:43.494Z   Done running command
2017-09-21T16:42:43.496Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.503Z   Done running command
2017-09-21T16:42:43.508Z   Running command: ['/sbin/chkconfig', u'vmware-sts-idmd']
2017-09-21T16:42:43.515Z   Done running command
2017-09-21T16:42:43.516Z   Running command: ['/sbin/chkconfig', u'vmware-netdumper']
2017-09-21T16:42:43.531Z   Done running command
2017-09-21T16:42:43.532Z   Running command: ['/sbin/chkconfig', u'vmware-rbd-watchdog']
2017-09-21T16:42:43.541Z   Done running command
2017-09-21T16:42:43.542Z   Running command: ['/sbin/chkconfig', u'vmware-rhttpproxy']
2017-09-21T16:42:43.549Z   Done running command
2017-09-21T16:42:43.550Z   Running command: ['/sbin/chkconfig', u'vmware-stsd']
2017-09-21T16:42:43.556Z   Done running command
2017-09-21T16:42:43.557Z   Running command: ['/sbin/chkconfig', u'vmware-vapi-endpoint']
2017-09-21T16:42:43.563Z   Done running command
2017-09-21T16:42:43.564Z   Running command: ['/sbin/chkconfig', u'vmafdd']
2017-09-21T16:42:43.570Z   Done running command
2017-09-21T16:42:43.571Z   Running command: ['/sbin/chkconfig', u'vmcad']
2017-09-21T16:42:43.579Z   Done running command
2017-09-21T16:42:43.579Z   Running command: ['/sbin/chkconfig', u'vmdird']
2017-09-21T16:42:43.586Z   Done running command
2017-09-21T16:42:43.587Z   Running command: ['/sbin/chkconfig', u'vmware-vpostgres']
2017-09-21T16:42:43.594Z   Done running command
2017-09-21T16:42:43.594Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.602Z   Done running command
2017-09-21T16:42:43.603Z   Running command: ['/sbin/chkconfig', u'vmware-vsm']
2017-09-21T16:42:43.609Z   Done running command
2017-09-21T16:42:43.610Z   Running command: ['/sbin/chkconfig', u'vmware-imagebuilder']
2017-09-21T16:42:43.617Z   Done running command
2017-09-21T16:42:43.618Z   Running command: ['/sbin/chkconfig', u'vmafdd']
2017-09-21T16:42:43.624Z   Done running command
2017-09-21T16:42:43.628Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.635Z   Done running command
2017-09-21T16:42:43.636Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.642Z   Done running command
2017-09-21T16:42:43.647Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.654Z   Done running command
2017-09-21T16:42:43.656Z   Running command: ['/sbin/chkconfig', u'vmdird']
2017-09-21T16:42:43.663Z   Done running command
2017-09-21T16:42:43.664Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.671Z   Done running command
2017-09-21T16:42:43.673Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.680Z   Done running command
2017-09-21T16:42:43.682Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.688Z   Done running command
2017-09-21T16:42:43.690Z   Running command: ['/sbin/chkconfig', u'vmware-rhttpproxy']
2017-09-21T16:42:43.697Z   Done running command
2017-09-21T16:42:43.698Z   Running command: ['/sbin/chkconfig', u'vmafdd']
2017-09-21T16:42:43.704Z   Done running command
2017-09-21T16:42:43.704Z   Running command: ['/sbin/chkconfig', u'vmware-stsd']
2017-09-21T16:42:43.711Z   Done running command
2017-09-21T16:42:43.713Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.719Z   Done running command
2017-09-21T16:42:43.722Z   Running command: ['/sbin/chkconfig', u'vmware-vpostgres']
2017-09-21T16:42:43.729Z   Done running command
2017-09-21T16:42:43.732Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.739Z   Done running command
2017-09-21T16:42:43.741Z   Running command: ['/sbin/chkconfig', u'vmware-vpostgres']
2017-09-21T16:42:43.748Z   Done running command
2017-09-21T16:42:43.750Z   Running command: ['/sbin/chkconfig', u'vmware-rhttpproxy']
2017-09-21T16:42:43.757Z   Done running command
2017-09-21T16:42:43.761Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.768Z   Done running command
2017-09-21T16:42:43.771Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.779Z   Done running command
2017-09-21T16:42:43.780Z   Running command: ['/sbin/chkconfig', u'vmware-vpxd']
2017-09-21T16:42:43.786Z   Done running command
2017-09-21T16:42:43.789Z   Running command: ['/sbin/chkconfig', u'vmware-vpostgres']
2017-09-21T16:42:43.795Z   Done running command
2017-09-21T16:42:43.797Z   Running command: ['/sbin/chkconfig', u'vmafdd']
2017-09-21T16:42:43.803Z   Done running command
2017-09-21T16:42:43.803Z   Running command: ['/sbin/chkconfig', u'vmdird']
2017-09-21T16:42:43.810Z   Done running command
2017-09-21T16:42:43.810Z   Running command: ['/sbin/chkconfig', u'vmcad']
2017-09-21T16:42:43.818Z   Done running command
Starting vmafd service.
Successfully joined the external PSC vcenter-psc.redacted.lan
Cleaning up...
Cleanup completed
Starting all the services ...
Started all the services.
The vCenter Server has been successfully reconfigured and repointed to the external Platform Services Controller vcenter-psc.redacted.lan.
root@vcenter [ /usr/lib/vmware-vmdir/bin ]#

And finally, from the external PSC we can verify replication partners again to see that the embedded PSC has been decommissioned, and the external PSC is the only one listed:

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# ./vdcrepadmin -f showservers -h localhost -u Administrator -w Passw\$ord
cn=vcenter-psc.redacted.lan,cn=Servers,cn=redactedfl,cn=Sites,cn=Configuration,dc=vsphere,dc=local
root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]#

Recovering from a failed platform services controller installation – vSphere 6.5

Posted by & filed under Virtualization, VMWare.

I have used to below commands to recover from a failed PSC deployment. When trying to redeploy after the failed deployment, I encountered the error:

“Failed to run vdcpromo”

Following the below steps on the current PSC resolved the error and I was then able to successfully restart the PSC deployment.

Also, protip to avoid having to keep redeploying the appliance, take a snapshot right after phase 1 completes. Then you can simply restore the snap and access your vm via the web interface to try again.

login as: root

VMware vCenter Server Appliance 6.5.0.10000

Type: vCenter Server with an embedded Platform Services Controller

Using keyboard-interactive authentication.
Password:
Last login: Wed Sep 20 15:34:18 2017 from 10.110.0.181
Connected to service

    * List APIs: "help api list"
    * List Plugins: "help pi list"
    * Launch BASH: "shell"

Command> shell
Shell access is granted to root
root@vcenter [ ~ ]# cd /usr/lib/vmware-vmdir/bin
root@vcenter [ /usr/lib/vmware-vmdir/bin ]# ./vdcleavefed -h vcenter-psc.redacted.lan -u Administrator
password:
vdcleavefd offline for server vcenter-psc.redacted.lan
 vcenter-psc.redacted.lan server cleanup performed.
root@vcenter [ /usr/lib/vmware-vmdir/bin ]#

 

docs.vmware.com/en/VMware-vSphere/6.5/co…

Additional info: I also ran into this when trying to deploy an additional PSC that had a failed installation, but got a completely different error (see below). Going to Administration -> System Configuration in the flash vSphere web client also displays the failed PSC. Login to the live PSC and use the above commands to cleanup, then restart the new PSC deployment. Refreshing the System Configuration page once the vdcleavefed command was ran confirms the cleanup is complete and the failed install is no longer listed.

The error I received when deploying this PSC was:

Could not connect to VMware Directory Service via LDAP. Verify VMware Directory Service is running on the appropriate system and is reachable from this host.

Removing the failed deployment via vdcleavefed did not resolve the issue.

I decided to test LDAP connectivity to the PSC from the failed PSC deployment. I SSH’d into the box and did the following:

root@localhost [ /usr/lib/vmware-vmdir/bin ]# ./vdcadmintool


==================
Please select:
0. exit
1. Test LDAP connectivity
2. Force start replication cycle
3. Reset account password
4. Set log level and mask
5. Set vmdir state
6. Get vmdir state
7. Get vmdir log level and mask
==================

1
Please enter LDAP server host: vcenter-psc.redacted.lan
Please enter LDAP server port: 389
Please enter LDAP server SSL port: 11712
Please enter LDAP Bind DN: cn=Administrator,cn=Users,dc=vsphere,dc=local
Please enter LDAP Bind UPN: Administrator@vsphere.local
Please enter LDAP Bind password:

ldap://vcenter-psc.redacted.lan:389 (ANONYMOUS) bind succeeded.

++++++++++++++++++++ ldaps://vcenter-psc.redacted.lan:11712 SSL bind failed. (-1)(Can't contact LDAP server)

ldap://vcenter-psc.redacted.lan:389 SRP bind succeeded.

++++++++++++++++++++ ldap://vcenter-psc.redacted.lan:389 GSSAPI bind failed. (9100)(Unknown (extension) error)

Edit: Additional semi-related data

Get machine’s guid

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# /usr/lib/vmware-vmafd/bin/vmafd-cli get-machine-id --server-name localhost

Get machine’s pnid (machine/host name?)

root@vcenter-psc [ /usr/lib/vmware-vmdir/bin ]# /usr/lib/vmware-vmafd/bin/vmafd-cli get-pnid --server-name localhost

Get services in the directory

root@vcenter-psc [ ~ ]# /usr/lib/vmware-vmafd/bin/dir-cli service list