Home VMware Useful Commands for VCD (VMware Cloud Director)

Useful Commands for VCD (VMware Cloud Director)

by Mohamed Imthiyaz
Userful Commands VCD

Managing VMware Cloud Director (vCD) environments efficiently involves the use of various commands to handle routine and critical tasks. Here’s a guide to some of the most useful vCD commands according to me.

I am using VCD 10.5.1

1. Confirming Primary vCD Cell

Finding the primary vCD cell is like identifying the lead actor in a movie. Here are two ways to get the star of your show:

sudo -i -u postgres repmgr node check --role

Or, if you need more details you can switch to postgres

su postgres

/opt/vmware/vpostgres/current/bin/repmgr -f /opt/vmware/vpostgres/current/etc/repmgr.conf node status

2. Start, Stop and check status of VCD service

service vmware-vcd start

service vmware-vcd status

service vmware-vcd stop

To do a Graceful shutdown of the cell you can follow

root@imthi-vcd01[ ~ ]# $VCLOUD_HOME/bin/cell-management-tool -u administrator cell --status
Please enter the administrator password:
Job count = 0
Scheduled job count = 14
Is Active = true
In Maintenance Mode = false
 
 
root@imthi-vcd01[ ~ ]# $VCLOUD_HOME/bin/cell-management-tool -u administrator cell --quiesce true
Please enter the administrator password:
 
 
root@imthi-vcd01[ ~ ]# $VCLOUD_HOME/bin/cell-management-tool -u administrator cell --status
Please enter the administrator password:
Job count = 0
Scheduled job count = 0
Is Active = false
In Maintenance Mode = false
 
 
root@imthi-vcd01[ ~ ]# $VCLOUD_HOME/bin/cell-management-tool -u administrator cell --shutdown
Please enter the administrator password:
Cell successfully deactivated and all tasks cleared in preparation for shutdown
 
 
root@imthi-vcd01[ ~ ]# service vmware-vcd status
* vmware-vcd.service - LSB: The VMware vCloud Director service
   Loaded: loaded (/etc/rc.d/init.d/vmware-vcd; generated)
  Drop-In: /etc/systemd/system/vmware-vcd.service.d
           `-10-aftervaos.conf
   Active: inactive (dead) since Thu 2024-03-09 12:16:16 UTC; 7s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 12521 ExecStop=/etc/rc.d/init.d/vmware-vcd stop (code=exited, status=0/SUCCESS)
  Process: 1668 ExecStart=/etc/rc.d/init.d/vmware-vcd start (code=exited, status=0/SUCCESS)
 
 
root@imthi-vcd01[ ~ ]# service vmware-vcd stop
 
 
root@imthi-vcd01[ ~ ]# service vmware-vcd start
 
 
root@imthi-vcd01[ ~ ]# tail -f /opt/vmware/vcloud-director/logs/cell.log


3. Check and update NTP settings

You can check and update the timzeone, VCD service should be restarted after the timezone has been updated.

timedatectl status    ###will show the local time and time zone

/opt/vmware/share/vami/vami_set_timezone_cmd America/New_York        ###To update timezone.

service vmware-vcd restart

tail -f /opt/vmware/vcloud-director/logs/cell.log     ###Tail the cell log to check

4. Query for Stale entries in DB

It’s always a good practice to a take a Backup before making any changes on DB. You can also schedule automatic Backups for VCD

Generally occurs when there’s a connection issue with VC, Check the VM which are present in vCenter but missing from VCD. Thank you @Santosh for sharing this query.

sudo -i -u postgres psql vcloud
select cloud_uuid, name, is_deleted, * from vm_inv where moref not in
(select moref from vm where vm_inv.vc_id = vm.vc_id and vm_inv.moref = vm.moref and vm.moref is not null)
and name like '%pf4-%'
--and cloud_uuid is not null
and is_deleted = false;

The results will display the stale entries, you can search this directly on VC GUI and delete these VMs.

Hope this helps

You may also like

Leave a Comment