XenServer/XCP-ng Commands
XenServer and XCP-ng xe CLI commands for virtualization management.
Pool Startup Procedure
Step 1: Power on pool masterStart the master/coordinator host first
Step 2: Wait for master bootWait 3-5 minutes for xapi and toolstack to start
xe pool-listVerify pool is accessible from master
Step 3: Power on member hostsPower on remaining pool members
Step 4: Verify pool membersWait for all hosts to join the pool
xe host-listList all hosts and verify they are online
Step 5: Start VMsVMs will auto-start based on their configuration
xe vm-list power-state=haltedList VMs that did not auto-start
xe vm-start uuid=<uuid>Manually start VM
Pool Management
xe pool-listList pool information
xe pool-param-list uuid=<uuid>Display all pool parameters
xe pool-designate-new-master host-uuid=<uuid>Designate new pool master
xe host-listList all hosts in pool
xe host-param-get uuid=<uuid> param-name=name-labelGet host parameter
xe pool-join master-address=<ip> master-username=root master-password=<pass>Join host to pool
xe pool-eject host-uuid=<uuid>Remove host from pool
xe pool-emergency-transition-to-masterForce local host to become master
xe pool-recover-slavesRecover pool member configuration
VM Management
xe vm-listList all VMs
xe vm-list power-state=runningList running VMs
xe vm-param-list uuid=<uuid>Display VM parameters
xe vm-install template=<template-name> new-name-label=<name>Create VM from template
xe vm-start uuid=<uuid>Start VM
xe vm-shutdown uuid=<uuid>Clean shutdown VM
xe vm-reboot uuid=<uuid>Reboot VM
xe vm-suspend uuid=<uuid>Suspend VM
xe vm-resume uuid=<uuid>Resume suspended VM
xe vm-reset-powerstate uuid=<uuid> force=trueReset VM power state (force)
xe vm-uninstall uuid=<uuid> force=trueDelete VM and VDIs
xe vm-param-set uuid=<uuid> name-label=<name>Set VM name
xe vm-param-set uuid=<uuid> VCPUs-max=<num>Set max vCPUs
xe vm-param-set uuid=<uuid> memory-static-max=<bytes>Set max memory
xe vm-copy uuid=<uuid> new-name-label=<name>Copy VM
Storage Management
xe sr-listList storage repositories
xe sr-param-list uuid=<uuid>Display SR parameters
xe sr-create name-label=<name> type=<type> device-config:device=<path>Create storage repository
xe sr-scan uuid=<uuid>Scan SR for VDIs
xe sr-forget uuid=<uuid>Forget SR (detach from pool)
xe vdi-listList virtual disk images
xe vdi-param-list uuid=<uuid>Display VDI parameters
xe vdi-create sr-uuid=<uuid> name-label=<name> virtual-size=<bytes> type=userCreate VDI
xe vdi-resize uuid=<uuid> disk-size=<bytes>Resize VDI
xe vdi-destroy uuid=<uuid>Delete VDI
xe vdi-copy uuid=<uuid> sr-uuid=<uuid>Copy VDI to another SR
xe vm-disk-add vm=<name> disk-size=<GB>GiB device=<num>Add disk to VM
Network Management
xe network-listList all networks
xe network-param-list uuid=<uuid>Display network parameters
xe network-create name-label=<name>Create network
xe network-destroy uuid=<uuid>Delete network
xe pif-listList physical interfaces
xe pif-param-list uuid=<uuid>Display PIF parameters
xe pif-reconfigure-ip uuid=<uuid> mode=static IP=<ip> netmask=<mask> gateway=<gw>Configure static IP on PIF
xe vif-listList virtual interfaces
xe vif-create vm-uuid=<uuid> network-uuid=<uuid> device=<num>Add VIF to VM
xe vif-destroy uuid=<uuid>Remove VIF
xe bond-create network-uuid=<uuid> pif-uuids=<uuid1>,<uuid2>Create network bond
xe vlan-create pif-uuid=<uuid> vlan=<id> network-uuid=<uuid>Create VLAN on PIF
Snapshot & Backup
xe vm-snapshot uuid=<uuid> new-name-label=<name>Create VM snapshot
xe vm-snapshot-with-quiesce uuid=<uuid> new-name-label=<name>Create quiesced snapshot (requires guest tools)
xe snapshot-listList all snapshots
xe snapshot-revert snapshot-uuid=<uuid>Revert VM to snapshot
xe snapshot-uninstall uuid=<uuid> force=trueDelete snapshot
xe vm-export uuid=<uuid> filename=<file>Export VM to XVA file
xe vm-import filename=<file>Import VM from XVA file
xe vm-checkpoint uuid=<uuid> new-name-label=<name>Create VM checkpoint
High Availability
xe pool-ha-enableEnable HA on pool
xe pool-ha-disableDisable HA on pool
xe pool-param-get uuid=<uuid> param-name=ha-enabledCheck HA status
xe vm-param-set uuid=<uuid> ha-restart-priority=restartEnable HA for VM
xe vm-param-set uuid=<uuid> ha-restart-priority=best-effortSet best-effort HA
xe vm-migrate uuid=<uuid> host-uuid=<uuid> live=trueLive migrate VM
xe host-evacuate uuid=<uuid>Evacuate all VMs from host
xe host-disable uuid=<uuid>Disable host (prevent VM start)
xe host-enable uuid=<uuid>Enable host
Update & Patching
xe patch-upload file-name=<file>Upload patch file
xe patch-listList uploaded patches
xe patch-apply uuid=<uuid> host-uuid=<uuid>Apply patch to host
xe patch-pool-apply uuid=<uuid>Apply patch to entire pool
xe host-call-plugin host-uuid=<uuid> plugin=updater.py fn=check_updateCheck for updates (XCP-ng)
yum update --enablerepo=xcp-ng-updatesUpdate XCP-ng host (newer method)
xe pool-param-set uuid=<uuid> name-description="Updated"Update pool metadata
Monitoring & Troubleshooting
xe diagnostic-compact uuid=<uuid>Compact VDI
xe diagnostic-db-statsDisplay database statistics
xe host-get-cpu-features uuid=<uuid>Display host CPU features
xe host-get-system-status filename=<file>Generate system status report
xe host-logs-download uuid=<uuid> file-name=<file>Download host logs
xe task-listList running tasks
xe task-cancel uuid=<uuid>Cancel task
tail -f /var/log/xensource.logMonitor XAPI log
xl listList domains (low-level)
xl console <domain>Connect to domain console
xe host-forget uuid=<uuid>Remove dead host from pool
xe pool-sync-databaseSynchronize pool database