XCP-ng

XCP-ng

Our quick XCP-ng reference

Create Local ISO repository without Xen Orchestra

$ mkdir -p /var/opt/xen/ISO_Store

$ xe sr-create name-label=LocalISO type=iso device-config:location=/var/opt/xen/ISO_Store device-config:legacy_mode=true content-type=iso

Migrating Fedora VM (BIOS mode) from KVM (Libvirt) to XCP-ng

On KVM host

suggestion: take a copy of the boot drive

within the Fedora VM run

$ yum install dracut-config-generic dracut-network

$ dracut --add-drivers xen-blkfront -f /boot/initramfs-$(uname -r).img $(uname -r)
$ dracut --regenerate-all -f && grub2-mkconfig -o /boot/grub2/grub.cfg

shutdown VM

# qemu-img convert -O vpc myvm.qcow2 myvm.vhd

Copy the newly created .vhd to the xcp-ng host

cmd example: rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress --sparse myvm.vhd root@n.n.n.n:/run/sr-mount/sr-id

On XCP-ng host
# vhd-util repair -n myvm.vhd
# vhd-util check -n myvm.vhd should return myvm.vhd is valid
# NEWID=$(uuidgen -r) && mv myvm.vhd $NEWID.vhd && echo New Disk called $NEWID.vhd

create a new VM

attach the disk <uuidgen>.vhd

reboot the VM

 

Reference: https://github.com/xcp-ng/xcp/wiki/Migrating-from-other-hypervisors

Install XCP-ng guest tools on Fedora

Mathod 1 – Fedora 31 package

# dnf install xe-guest-utilities-latest.x86_64

# systemctl enable xe-linux-distribution.service –now

 

Mathod 2 – XCP-ng Tools Storage

Mount guest-tools.iso from XCP-ng Tools

mount /dev/cdrom /mnt/

bash /mnt/Linux/install.sh

umount /dev/cdrom

Reference: https://github.com/xcp-ng/xcp/wiki/Guest-Tools

Install XCP-ng guest tools on FreePBX

(Tested on FreePBX14 and 15)

# yum install xe-guest-utilities-latest

# vi /usr/sbin/xe-linux-distribution

go to line 150 and add: -e 's/^Sangoma Linux release \([0-9]*\)\.\([0-9]*\)\(\.[0-9]*\)\? (.*)/distro=centos;major=\1;minor=\2/gp;' \

# systemctl enable xe-linux-distribution.service --now

Install XCP-ng guest tools on pfSense®

  1. Access the CLI console or SSH into the pfSense VMpfSense menu
  2. Select option 8 for Shell
  3. run the following commands:

pkg install xe-guest-utilities
echo 'xenguest_enable="YES"' >> /etc/rc.conf.local
ln -s /usr/local/etc/rc.d/xenguest /usr/local/etc/rc.d/xenguest.sh
service xenguest start

XCP-NG vs VMware ESXi

Comparison between option available in XCP-ng vs VMware.
In addition, you can see all the features covered by XCP-NG in association with Xen Orchestra web-GUI

Reference: https://xcp-ng.com/images/resources/xcp-ng-vs-vmware.pdf

Bring up the XCP-ng console over SSH

Run the “xsconsole” once logged into the system

How To Build Xen Orchestra From Source

Brilliant video from Tom Lawrence on how to build Xen Orchestra from source.

VM backup with Xen Orchestra

Official page: https://xen-orchestra.com/#!/xo-features/backup  and some excellent videos

Destroy a hung VM

# xl list | grep -i “VM_NAME”
# xl destroy <ID>

Clear hung tasks

On the XCP-ng Server
# xe-toolstack-restart

This command will restart the XCP-ng Server management toolstack (also known as xapi). Restarting xapi does not affect running VMs. However, while xapi daemon is restarted new changes performed elsewhere will not be synchronized. Use with care!

List Disks attached to a VM

# xe vm-disk-list vm=<VM label>

Scan vhd disk

# vhd-util scan -f -m UUID.vhd

Find if vhd is attached to any vm

# xe vbd-list | grep <UUID of .vhd>

Find explore vdi chain (run on Xen Orchestra)

# xapi-explore-sr [–full] <SR UUID> <XenServer URL> <XenServer user> [<XenServer password>]

Output of xapi-explore-sr

xapi-explore-sr output
Managed and co-managed XCP-ng environment. Read more