XenServer/XCP-ng Commands

XenServer and XCP-ng xe CLI commands for virtualization management.

Pool Startup Procedure

Step 1: Power on pool master

Start the master/coordinator host first

Step 2: Wait for master boot

Wait 3-5 minutes for xapi and toolstack to start

xe pool-list

Verify pool is accessible from master

Step 3: Power on member hosts

Power on remaining pool members

Step 4: Verify pool members

Wait for all hosts to join the pool

xe host-list

List all hosts and verify they are online

Step 5: Start VMs

VMs will auto-start based on their configuration

xe vm-list power-state=halted

List VMs that did not auto-start

xe vm-start uuid=<uuid>

Manually start VM

Pool Management

xe pool-list

List 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-list

List all hosts in pool

xe host-param-get uuid=<uuid> param-name=name-label

Get 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-master

Force local host to become master

xe pool-recover-slaves

Recover pool member configuration

VM Management

xe vm-list

List all VMs

xe vm-list power-state=running

List 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=true

Reset VM power state (force)

xe vm-uninstall uuid=<uuid> force=true

Delete 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-list

List 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-list

List 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=user

Create 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-list

List 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-list

List 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-list

List 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-list

List all snapshots

xe snapshot-revert snapshot-uuid=<uuid>

Revert VM to snapshot

xe snapshot-uninstall uuid=<uuid> force=true

Delete 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-enable

Enable HA on pool

xe pool-ha-disable

Disable HA on pool

xe pool-param-get uuid=<uuid> param-name=ha-enabled

Check HA status

xe vm-param-set uuid=<uuid> ha-restart-priority=restart

Enable HA for VM

xe vm-param-set uuid=<uuid> ha-restart-priority=best-effort

Set best-effort HA

xe vm-migrate uuid=<uuid> host-uuid=<uuid> live=true

Live 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-list

List 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_update

Check for updates (XCP-ng)

yum update --enablerepo=xcp-ng-updates

Update 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-stats

Display 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-list

List running tasks

xe task-cancel uuid=<uuid>

Cancel task

tail -f /var/log/xensource.log

Monitor XAPI log

xl list

List domains (low-level)

xl console <domain>

Connect to domain console

xe host-forget uuid=<uuid>

Remove dead host from pool

xe pool-sync-database

Synchronize pool database