The Sysadmin Wiki


157pages on
this wiki
Add New Page
Talk0 Share

Xen is an open source virtualization solution.

Applying a patch via the CLI Edit

Find the host UUID and set a variable for it, like this:

xe host-list

Find the patch you want to apply, like the XS62ESP1016 patch. Extract the folder number and the patch ID from the download URL and set variables like this:


Then you can run these few lines of code to download and install the patch.

wget --no-check-certificate$folder/$
unzip $ && rm -f $
patchUuid=`xe patch-upload file-name=$patchid.xsupdate`; echo $patchUuid
xe patch-apply host-uuid=$hostUuid uuid=$patchUuid
rm -f $patchid.xsupdate $patchid-src-pkgs.tar.bz2

Once you're done installing patches, it's probably a good idea to reboot.

Checking if patch is installed Edit

[[ -n $(xe patch-list name-label=$patchid 2> /dev/null) ]] && echo Installed || echo Not installed

Commands Edit

List running guests:

xe vm-list is-control-domain=false power-state=running

List info on a specific guest:

xe vm-param-list uuid=$vmid

List IP addresses of a specific guest:

xe vm-param-list uuid=$vmid | grep networks

List SR's (Storage Repositories) on a specific host:

xe sr-list | grep -i -A3 -B4 "host (...): $hostname\$"

Copy guest to another host (shut down the guest first):

srcvmid= # UUID of guest to copy
dstsrid= # UUID of SR (Storage Repository) to copy to
dstvmname= # Name of the new guest

# The actual copying (N.B., there's no progress indication while copying):
xe vm-copy vm=$srcvmid sr-uuid=$dstsrid new-name-label=$dstvmname

xe vm-start vm=$srcvmid # Start the old guest again
xe vm-start vm=$dstvmname # Start the new guest

Note: The error message "The SR backend does not support the operation (check the SR's allowed operations)" could mean that there is already a guest on that SR with that name.

Change DNS or other host network settings:

# Find host uuid
xe host-list # Then set $hostuuid
# Find NIC uuid
xe pif-list host-uuid=$hostuuid # Then set nicuuid
# List current settings
xe pif-param-list uuid=$nicuuid
# Set new settings (fill in the missing variables)
xe pif-reconfigure-ip uuid=$nicuuid mode=static IP=$nicip netmask=$nicnetmask gateway=$nicgateway DNS=$nicdns

Problem with missing NICsEdit

During some testing of our up and coming highly available solution, we noticed an issue when a XenServer node in a pool had been hard rebooted and brought back online – it would have all its NICs missing. It would not appear up in the pool, and would appear down.

It was possible to ping other servers in the pool from the node, however for some reason it seemed to have issues with its network config.  ifconfig would show all interfaces as up, but the XenServer console showed all as missing.

The quick fix for this was running the following command:


Or go to the console of your “dead” server and follow the next few steps.

Let’s reset the state.db first with:

mv /var/xapi/state.db /var/xapi/state.db_old

Now tell the server to transition into a master with:

xe pool-emergency-transition-to-master

Reboot and configure Management interface again - if needed...

==In case of Error code: SR_BACKEND_FAILURE_47 Error parameters: , The SR is not available [opterr=no such volume group: VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08]==

[root@xenserver-vpnbyxqp ~]# pvscan
PV /dev/sda3 VG XSLocalEXT-4fa26a15-778a-0ba5-8a2b-2df544dade08 lvm2 [923.50 GB / 0 free]
PV /dev/sdb VG XSLocalEXT-4fa26a15-778a-0ba5-8a2b-2df544dade08 lvm2 [931.50 GB / 8.00 GB free]
Total: 2 [1.81 TB] / in use: 2 [1.81 TB] / in no VG: 0 [0 ]

[root@xenserver-vpnbyxqp ~]# lvscan
inactive '/dev/VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08/4fa26a15-778a-0ba5-8a2b-2df544dade08' [1.80 TB] inherit
ACTIVE '/dev/VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08/MGT' [4.00 MB] inherit

[root@xenserver-vpnbyxqp ~]# vgscan
Reading all physical volumes. This may take a while...
Found volume group "VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08" using metadata type lvm2

[root@xenserver-vpnbyxqp ~]# vgchange -ay
2 logical volume(s) in volume group "XSLocalEXT-4fa26a15-778a-0ba5-8a2b-2df544dade08" now active

[root@xenserver-vpnbyxqp ~]# lvscan
ACTIVE '/dev/VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08/4fa26a15-778a-0ba5-8a2b-2df544dade08' [1.80 TB] inherit
ACTIVE '/dev/VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08/MGT' [4.00 MB] inherit

[root@xenserver-vpnbyxqp ~]# xe sr-introduce uuid=4fa26a15-778a-0ba5-8a2b-2df544dade08 type=lvm name-label="Local storage" content-type=user

[root@xenserver-vpnbyxqp ~]# ls -l /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root 9 Aug 25 01:58 scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30719538 -> ../../sdb
lrwxrwxrwx 1 root root 9 Aug 25 01:58 scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30765059 -> ../../sda
lrwxrwxrwx 1 root root 10 Aug 25 01:58 scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30765059-part1 -> ../../sda1
lrwxrwxrwx 1 root root 10 Aug 25 01:58 scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30765059-part2 -> ../../sda2
lrwxrwxrwx 1 root root 10 Aug 25 01:58 scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30765059-part3 -> ../../sda3

[root@xenserver-vpnbyxqp ~]# xe host-list
uuid ( RO) : 2c64caf6-a4e0-46d1-bb84-aed066a0b645
name-label ( RW): xenserver-vpnbyxqp
name-description ( RW): Default install of XenServer

[root@xenserver-vpnbyxqp ~]# xe pbd-create sr-uuid=4fa26a15-778a-0ba5-8a2b-2df544dade08 device-config:device=/dev/disk/by-id/scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30765059-part3,/dev/disk/by-id/scsi-SATA_WDC_WD1003FBYX-_WD-WMAW30719538 host-uuid=2c64caf6-a4e0-46d1-bb84-aed066a0b645

[root@xenserver-vpnbyxqp ~]# xe pbd-plug uuid=f446ea6e-d938-bc21-1e77-fef8e55331bb
Error parameters: , The SR is not available [opterr=no such volume group: VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08],

XSLocalEXT -> VG_XenStorage:

[root@xenserver-vpnbyxqp ~]# vgrename XSLocalEXT-4fa26a15-778a-0ba5-8a2b-2df544dade08 VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08
Volume group "XSLocalEXT-4fa26a15-778a-0ba5-8a2b-2df544dade08" successfully renamed to "VG_XenStorage-4fa26a15-778a-0ba5-8a2b-2df544dade08"

[root@xenserver-vpnbyxqp ~]# xe pbd-plug uuid=f446ea6e-d938-bc21-1e77-fef8e55331bb

See also Edit

External links Edit

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.