XenServer 7.4 - hpaluch/hpaluch.github.io GitHub Wiki

XenServer 7.4 is complete virtualization package from Citrix Systems. Citrix acquired XenSource in 2007. It uses well known Xen hypervisor (which is often used in public cloud - including Amazon AWS or few years ago in Rackspace etc.) - see About page on https://www.xenproject.org/about-us.html for more details.

For plain Xen hypervisor please see Xen

Notable highlights:

  • very comfortable Windows installation (IDE drivers on install, automatic drivers replacement by Guest tools after install)

  • comfortable Linux installation (all drivers and PV mode in all mainstream Linux distribution)

  • XenCenter client supports all Windows versions since Windows 7 SP1 - unlike that Hyper-V manager is much more constrained (Windows 8+ required, windows Home edition has NOT Hyper-V Manager)

  • probably only commercial product that can manage more than one server in its Free edition (however one pool is limited to 3 hosts since XenServer 7.3.0) - for example both VMware vCenter or Microsoft SCVMM are available in paid edition only.

Requirements

Please see https://docs.citrix.com/content/dam/docs/en-us/xenserver/current-release/downloads/xenserver-installation-guide.pdf for up-to-date requirements. Briefly:

  • CPU with basic Intel VT or AMD-V virtualization support (practically everything) required for Windows guest.

    NOTE: You can still run most Linux guests in PV mode - even on CPUs without any virtualization support. It is also handy if your trying XenServer under another Hypervisor (tested also under Proxmov VE 5.1) on CPUs without nested virtualization support

  • 2GB minimum of RAM required - but you need free RAM for VMs. I use 6GB for testing.
  • 50GB disk space (Note that this will leave only around 8GB Local storage for guests disks).

NOTE: if your taking this really seriously you should visit official HCL page on http://hcl.vmd.citrix.com/

Getting software

You can get all required software in Free edition from https://www.citrix.com/downloads/xenserver/product-software/xenserver-74-free-edition.html (free registration required).

You need to download at least:

  • XenServer-7.4.0-install-cd.iso - XenServer 7.4.0 Base Installation ISO - Free Edition - this should be installed on your dedicated server
  • XenServer-7.4.0-XenCenter.msi - XenCenter 7.4.0 Windows Management Console - this should be installed on your management Windows

Quick Review

Here are some pros and cons of XenServer when compared to other Hypervisor:

Pros:

  • XenServer 7.4 works well on any 64-bit CPU with basic virtualization support (just basic Intel VT or AMD-V is enough - unlike ESXi 6.5 which is very selective). I'm happily running HVM mode VMs on AMD-X2 CPU from 2007 :-)
  • optional Para-Virtualization support (PV) for Linux guest - it is fast enough for real use (unlike Qemu++ software emulation - which is usable just for evaluation but not for production) and it works on all 64-bit CPUs without any HW virtualization support.
  • PV and drivers supported in most Linux'es out of the box (similarly as support for KVM/Qemu)
  • seamless guest OS setup in XenCenter using Templates - it just works. No need to fiddle with VNC vs. SPICE or USB Tablet hack to have working mouse. For Linux guest there is even comfortable button Open SSH console that runs favorite Putty SSH client - really nice.
  • Automatic replacement of convenient but slow IDE drivers for Windows (even for boot disk! and even under XP!) after installation (see bellow). A never saw this in other virtualization environment! If you ever tried to change boot disk device on XP you know what I'm talking about.
  • guest Suspend/Resume works across XenServer reboot (tested on Win2008R2 Trial guest - suspending on fetching updates and resuming next day)

++) to be honest - even XenServer uses QEMU - for BIOS and some legacy HW emulation.

Cons:

However Xen Hypervisor (which also contains basic CLI commands) is still entirely free and will likely stay free thanks to GPL that applies to Linux kernel. You can find more information on Xen Hypervisor for example here:

There is also alternative to XenServer, here:

Tips

Installing XP SP3 under XenServer 7.4

  • use Legacy Windows template
  • after install do following to properly install Xen Guest tools:
    • Eject installation ISO
    • select guest-tools.iso
    • after Autorun you would probably get strange error "Use Control panel Add/Remove to install Software"
    • you can workaround this to install (in this order):
    • dotNetFx40_Full_x86_x64.exe .NET 4 Framework (honestly last version that works on XP)
    • xenlegacy.exe Xen legacy tools (tools for older systems than Vista/2008: XP and Windows Server 2003)

Notes for driver magic in Windows. According to https://docs.citrix.com/content/dam/docs/en-us/xenserver/current-release/downloads/xenserver-vm-users-guide.pdf section 2.4. XenServer Tools

The I/O drivers contain storage and network drivers, and low-level management interfaces. These drivers replace the emulated devices and provide high-speed transport between Windows and the XenServer product family software. During the installation of a Windows operating system, XenServer uses traditional device emulation to present a standard IDE controller and a standard network card to the VM. This allows Windows to complete its installation using built-in drivers, but with reduced performance due to the overhead inherent in emulation of the controller drivers.

So you don't need to worry that you were not asked for driver disk - its IDE drivers are used for installation only and are replaced later with optimized PV driver.

Just install guest-tools.iso after OS installation.

You are even notified on Search tab whether you are using optimized drivers.

Installing Windows Server 2008 R2 guest

Tested trial version 7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso. Install notes:

  • before installing guest tools you need to install .NET Framework 3.5.1 Feature in Server Manager -> Features

    NOTE: Do not check WCF Activation (it is SOA like solution for .NET which requires whole IIS to be installed). WCF is not required by XenCenter guest-tools.iso

Testing VSS on Windows Server 2008 R2 guest

After guest tools install be sure to enable VSS for Quiesced snapshots support. As mentioned in installation guide, run this script:

"%programfiles%\Citrix\XenTools\install-XenProvider.cmd"

NOTE: Please read carefully section 8.10.9.3. Advanced Notes for Quiesced Snapshots of https://docs.citrix.com/content/dam/docs/en-us/xenserver/xenserver-7-0/downloads/xenserver-7-0-administrators-guide.pdf VSS has important shortcomings so be prepared for some problems...

IMPORTANT: After taking Snapshot with Quiesced Filesystem - Always look into Notifications in XenCenter. Even when you see that Snaphost was taken on Snapshot tab - in reality there can be error and this supposed snapshot quietly vanish after a while in XenCenter!

When testing on local storage (200GB SATA disk) I always get dreaded error in Notifications:

The quiesced-snapshot operation failed for an unexpected reason

And in guest Event Log:

0x80042314, The shadow copy provider timed out while holding writes to the volume being shadow copied.
This is probably   due to excessive activity on the volume by an application or a system service.
Try again later when activity on the volume is reduced.

So be prepared - on some storage you may be unable to fit 10s limit on VSS hold!

Enabling remote desktop:

  • remember to manually Enable RDP in Windows Firewall using:
  • Server Manager -> Configuration -> Windows Firewall with ... > Inbound Rules
  • Enable rule Remote Desktop (TCP-in)
  • on Server Manager (Top node) click on Configure Remote Desktop
  • remember to add yourself to Remote Desktop Users using Select Users...

RDP from XenCenter

XenCenter will automatically detect when you enable Remote Desktop Access in your Windows guest and will connect to it. So don't be scared when you see RDP dialog in you Guest Console and accept it.

Basic VM backup procedure

I use these commands:

  • connect via SSH to Xen Host where is VM (I don't use pools)

  • issue these commands (replace vm arg with your VM - you can try xe vm-list to see all VMs):

    mkdir /opt/backups
    cd /opt/backups
    xe vm-export vm=CentOS6-32bit metadata=true filename=CentOS6-32bit.meta
    xe vm-export vm=CentOS6-32bit compress=true filename=CentOS6-32bit.xva

    WARNING! The / (and thus /opt/) disk has only about 15GB free space. See tip bellow....

  • backing up to remote CIFS share (\\192.168.0.50\TEMP in my example):

    mkdir /mnt/x
    mount -t cifs //192.168.0.50/TEMP /mnt/x -o username=xen_share
    Password for xen_share@//192.168.0.50/TEMP:  …
    
    # and now export VM there:
    xe vm-export vm=Win2008R2-MariaBench compress=true \
                 filename=/mnt/x/00backups/Win2008R2-Trial-MariaBench.xva
    
    # umount share once you don't need it
    umount /mnt/x

Importing VM on XenServer host:

  • import VM
    cd /opt/backups
    xe vm-import filename=CentOS6-32bit.xva
    PRINTS_IMPORTED_VM_UUID
  • I don't like that imported VM has same name-label, so at least I use:
    xe vm-param-set uuid=VM_UUID_FROM_VM_IMPORT name-label='CentOS6-32bit-2'
  • however even attached disks have same label which is confusing. So I used following:
xe vm-disk-list name-label=CentOS6-32bit-2
...
Disk 0 VDI:
uuid ( RO)             : REMEMBER_THIS_VDI_UUID
      name-label ( RW): CentOS6-32bit 0
   sr-name-label ( RO): Local storage
    virtual-size ( RO): 8589934592
...
xe vdi-param-set uuid=ABOVE_VDI_UUID name-label=CentOS6-32bit-2

Importing same VM multiple times

For testing memory constraints I used following script to import and rename VM and its VDI:

#!/bin/bash

set -ex
vm_prefix=CentOS7MariaBench
for i in 1 2 3 4 5
do
vm_uuid=$(xe vm-import filename=/opt/backups/CentOS7MariaBench.xva)
vm_name="$vm_prefix-$i"
xe vm-param-set uuid=$vm_uuid name-label="$vm_name"
vdi_uuid=$(xe vm-disk-list uuid=$vm_uuid | grep -A 1 VDI: | \
            awk -F: '/uuid/{print $2}' | tr -d ' ')
xe vdi-param-set uuid=$vdi_uuid name-label="$vm_name"
done

Getting template disk constraints

I plan to relax some template limits (for example minimum 8GB for CentOS). Here is what I can get:

template_uuid=$(xe template-list name-label='CentOS 6 (32-bit)' --minimal)
echo $template_uuid
   0a21ac1d-b18f-469e-9fe7-8bb9d0291574
xe template-param-get uuid=$template_uuid param-name=other-config param-key=disks
   <provision><disk bootable="true" device="0" size="8589934592" sr="" type="system"/></provision>

Looks promising...

Allow lower memory limit for CentOS 7

When I installed CentOS 7.4 from ISO (using CentOS 7 template in XenCenter) I suddenly found that CentOS was using 2GB instead for 1GB specified. Also I was unable to change it back to 1GB in XenCenter (it always returned back after edit).

Fortunately in CLI I was able to lower limit to 1GB and then use it in XenCenter:

# use "xe vm-list" to get vm-uuid for your VM
xe vm-param-set uuid=YOUR_VM_UUID memory-static-min=1073741824

After this command I was able to lower CentOS 7 RAM to 1GB in XenCenter

Disable ridiculous text-mode resolution in CentOS 7.4

CentOS 7.4 by default switch to ridiculously high console resolution. Use nomodeset bochs_drm.nomodeset=0 on GRUB_CMDLINE_LINUX variable in /etc/sysconfig/grub . You can also remove dumb rhgb quiet to see Linux boot messages. After edit re-create grub.cfg using:

# this skips foreign OS detection for grub menu - typically useless in VM where is only one OS
chmod a-rx /etc/grub.d/30_os-prober
# this regenerates grub.cfg:
grub2-mkconfig -o /boot/grub2/grub.cfg

Bugs

Ethernet cards swapped after XenServer reinstall

I can't understand this but it really happened to me. After experimenting with oVirt I did clean install of XenSever on same hardware (including same disk) and suddenly my Ethernet cards were swapped - literally eth0 <=> eth1. So also Network 0 and Network 1 get swapped.

When I import VM (exported from previous installation of XenServer) I must always remember to change Network 0 to Network 1. Hmm....

Please note that these Network cards are integrated on-board so I'm pretty sure that I did not swapped them :-) (Also I have only 1st MAC address registered in my DHCP address so I'm sure that cable remained in same socket).

NOTE: It is even visible in kernel messages (weird!!!):

[   13.662711] forcedeth 0000:00:09.0 side-6477-eth1: renamed from eth1
[   13.670245] forcedeth 0000:00:08.0 side-6602-eth0: renamed from eth0
...
[   39.046593] forcedeth 0000:00:08.0 eth1: renamed from side-6602-eth0
[   39.088301] forcedeth 0000:00:09.0 eth0: renamed from side-6477-eth1

Fortunately fix is here: https://support.citrix.com/article/CTX135809

I did this on my XenServer node:

interface-rename --list
   Name  MAC                PCI           ethN  Phys  SMBios  Driver     Version  Firmware
   eth0  00:16:17:98:a2:c4  0000:00:09.0  eth1                forcedeth  0.64      
   eth1  00:16:17:98:64:db  0000:00:08.0  eth0                forcedeth  0.64      
interface-rename --update eth0=00:16:17:98:64:db eth1=00:16:17:98:a2:c4
   INFO     [2018-05-01 18:21:03] Performing manual update of rules.  Not actually renaming interfaces
   INFO     [2018-05-01 18:21:03] All done

# then reboot to take change into effect
init 6

After reboot I must reassign Management interface on XenServer console:

  • Customize System -> Network and Management Interface
  • Configure Management Interface
  • select current eth0 card and follow instruction on screen.

You may then check Network X assignment in XenCenter

  • click on your Server node
  • select Network tab

And remember - switch back from Network 1 to Network 0 on all VMs (guests). And that's all.

Resources

⚠️ **GitHub.com Fallback** ⚠️