XCP-NG few basic command lines- CLI

Run the following command to list VMs and their UUIDs:

xe vm-list resident-on=<uuid_of_host>

Try the shutdown command with force:

xe vm-shutdown uuid=<uuid_of_vm> force=true

Restart the toolstack on the host by using the following command:

xe-toolstack-restart

Restart the host.

shutdown -r now

If the VM is still not shutdown, you might need to destroy the domain. However, the steps given below can cause problems for your VM and should only be done as a last resort.

Read more

Share

Install Xen Orchestra on Ubuntu / Debian

Step 1: Update System

Let’s start the installation by updating all the system packages:

sudo apt update

Also consider performing an upgrade:

sudo apt upgrade -y

Step 2: Install Node.js on Ubuntu / Debian

Install dependencies.

sudo apt install -y ca-certificates curl gnupg

Import GPG repository keys:

sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg

The next step is the installation of Node.js on Ubuntu / Debian Linux system:

Read more

Share

Convert Xen XVA to KVM

Citrix Xen uses a custom virtual appliance format for import/export called “XVA”. it’s basically a strangely crafted tar-file. You don’t need this program to unpack this tar-file, just use your favourite tar unpacker (tar, gtar, bsdtar). Once unpacked you will end up with a lot of different files, ova.xml (which contains the settings for the virtual appliance, think VMware vmx) and a number of folders called Ref:/, this is your disks. Each of these folders contain hundreds of files named 00000000, 00000001 with a accompanying .CHECKSUM file (SHA1). Each file is a 1MB slice of the disk, but some of the files in the sequence will probably be missing this is because XVA do not use compression; instead it will exclude slices of the disk that only contains zeros (are empty). This tool can assemble the disk for you (you will end up with a RAW disk) that can easily be mounted and modified. It can then also split the file again and generate checksum. Once ready, you will probably want to use the “package” command to rebuild the XVA file.

I’m running this conversion into a Debian 11 Server. First thing, you need to install xvz-img package from git repo into Debian server. Let’s install some essential package first-

Read more

Share

XOA on XCP-NG import and install

Start a new SSH session to your XenServer host and run the commands below.

### Using curl ###
[18:18 xcp-node-01 ~]# bash -c "$(curl -sS https://xoa.io/deploy)"
### Using wget ###
[18:18 xcp-node-01 ~]# bash -c "$(wget -qO- https://xoa.io/deploy)"

If you are using an old XenServer version, you may encounter SSL connection issues. This can bypassed by using the unsecure connection instead:

Read more

Share

Install Xen Orchestra on Ubuntu 20

Prework

apt-get update && apt-get dist-upgrade

Node.js

For this particular installation node 16 is needed to be installed. Lets install-

Add NodeSource PPA

This command will add PPA sources required to be able to install NodeJS 16 on your Ubuntu 20.04 installation:

curl -s https://deb.nodesource.com/setup_16.x | sudo bash

Install NodeJS 16

Now that the PPA source has been added, we can install NodeJS 16 on our Ubuntu 20.04 installation. Run the following command:

sudo apt install nodejs -y

Tip: The -y flag means we’re not prompted to confirm our choices.

Read more

Share

Force stop xen vm using command line

Instructions

  1. Disable High Availability (HA) so you don’t run into issues.
  2. Log into the Xenserver host that is running your VM with issues via ssh or console via XenCenter. Run the following command to list VMs and their UUIDs
    xe vm-list resident-on=<uuid_of_host>
  3. First you can try just the normal shutdown command with force
    xe vm-shutdown uuid=<UUID from step 3> force=true
  4. If that just hangs, use CONTROL+C to kill it off and try to reset the power state.  The force is required on this command
    xe vm-reset-powerstate uuid=<UUID from step 3> force=true
  5. If the VM is still not shutdown, we may need to destroy the domain.  Run this command to get the domain id of the VM.  It is the number in the first row of output. The list will be the VMs on the host.  Dom0 will be the host itself and all numbers after are running VM
    list_domains

Now run this command using the domain ID from the output of step 7

xl destroy <DOMID from step 7>

To start the VM use-

xe vm-start name-label=$VMN
Share

Export/ Import VM to/from a backup file using command line on XenServer

Identify VM’s UUID

We start by identifying a virtual machine we would lake to export to as a regular backup file. Run xe vm-list to list all available virtual machines and take a note of the virtual machine in question:

# xe vm-list
uuid ( RO) : 7371124f-7d4d-66b7-cbc7-a98b1457543e
name-label ( RW): Debian Jessie 8.5
power-state ( RO): halted

uuid ( RO) : bad8e456-df88-435d-ba12-3f0f6e54b2c6
name-label ( RW): Control domain on host: xenserver
power-state ( RO): running

Take VM snapshot

Read more

Share

enable SNMP on Xen (XCP-NG) hypervisors

There are six steps to correctly configuring SNMP on your Citrix Xen hypervisor. These steps don’t require a system restart and are non-service affecting.

To start, we assume you’re running Xen v6.x or v7.x, and are logged into the Xen CLI as root.

1. Enable the SNMP daemon

Enable the snmpd daemon by typing-

chkconfig snmpd

2. Configure the SNMP service

Make a backup of the snmpd.conf file. The default snmpd.conf file contains a lot of useful documentation for more advanced implementations of SNMP.

# cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.backup

Read more

Share

Force Shutdown Xen VM

Instructions

  1. Disable High Availability (HA) so you don’t run into issues
  2. Log into the Xenserver host that is running your VM with issues via ssh or console via XenCenter
  3. Run the following command to list VMs and their UUIDs
    xe vm-list resident-on=<uuid_of_host>
  4. First you can try just the normal shutdown command with force
    xe vm-shutdown uuid=<UUID from step 3> force=true
  5. If that just hangs, use CONTROL+C to kill it off and try to reset the power state.  The force is required on this command
    xe vm-reset-powerstate uuid=<UUID from step 3> force=true
  6. If the VM is still not shutdown, we may need to destroy the domain
  7. Run this command to get the domain id of the VM.  It is the number in the first row of output. The list will be the VMs on the host.  Dom0 will be the host itself and all numbers after are running VM
    list_domains
  8. Now run this command using the domain ID from the output of step 7
    xl destroy <DOMID from step 7>
Share