XenServer Commands
XenServer Commands
VMs
Status of VM
xe vm-list name-label=<Name of VM>
Shutdown VM
xe vm-shutdown vm="Name of VM"
Host
List of XenServer hosts along with their UUIDs
xe host-list
or
Note: You can also execute this command remotely by specifying the host
parameter.
VDIs
List of VDIs on a VM with descriptions and UUIDs
xe vdi-list name-label=<name of VM> params=name-description,uuid
NOTE: If this does not work you must use the name of the actual storage
drive connected to the VM (Name is case sensitive)
Delete VDI
xe vdi-destroy uuid=<UUID of VDI>
You can identify orphaned VDIs by checking the VBD connections for a
VDI. If no VBD connections exist than the VDI is not connected to any VM.
*VBD (virtual block devices) represent the mapping between VDIs and
VMs. PBDs represent the interface between the physical server and the
SR (storage repository)
http://forums.citrix.com/thread.jspa?threadID=265893
Pool
xe pool-sync-database (run on pool master)
Force the pool database to be synchronized across all hosts in the resource
pool. This is not necessary in normal operations since the database is regularly
automatically replicated, but can be useful for ensuring changes are rapidly
replicated after performing a significant set of CLI operations.
Enable HA
xe pool-ha-enable
Disable HA
xe pool-ha-disable
Using the list above, designate a new pool master by supplying the uuid
associated with the desired host:
xe pool-designate-new-master host-uuid=<UUID of member XenServer host to
become new master>
You’ll probably lose connection to the pool at this point, but that’s normal
behavior. Once XenCenter reconnects (this should happen automatically),
it’s safe to re-enable high availability:
xe pool-ha-enable
Pool Failures (This info was taken from the XenServer 6.1 Admin Guide)
In the event that your entire resource pool fails, you will need to recreate the
pool database from scratch. Be sure to regularly back up your pool-metadata
using the xe pool-dump-database CLI command
If the master is really dead, choose one of the members and run the command
xe pool-emergency-transition-to-master
Once it has become the master, run the command below and the members will now
point to the new master
xe pool-recover-slaves
SR
Find UUID of Storage Repository (SR)
xe sr-list
Scan SR
xe sr-scan uuid=<uuid of sr>
Listing of VDI's on SR
xe vdi-list sr-uuid=<UUID of SR>
http://support.citrix.com/article/CTX131328
Logs
View High Availability log file on XenServer. Can use this command to
view any log file
tail -f /var/log/xha.log
Snapshots
View a list of snapshots
xe snapshot-list
Use this to identify which vdi is not the snapshot when looking up VMs
with VDIs with snapshots
xe vdi-list name-label=<name of vdi> params=all
Common
Cycle xapi service
xe-toolstack-restart
If it hangs at “Stopping xapi” or “Starting xapi”, you may need to kill the process.
Ethtool
Check statistics for eth0
Ethtool –S eth0
Ifconfig
Check time
Ntptime