Manage virtual machines
This section provides an overview of how to create Virtual Machines (VMs) using templates. It also explains other preparation methods, including cloning templates and importing previously exported VMs.
What is a virtual machine?
A Virtual Machine (VM) is a software computer that, like a physical computer, runs an operating system and applications. The VM comprises a set of specification and configuration files backed by the physical resources of a host. Every VM has virtual devices that provide the same functions as physical hardware. VMs can give the benefits of being more portable, more manageable, and more secure. In addition, you can tailor the boot behavior of each VM to your specific requirements. For more information, see VM Boot Behavior.
XenServer supports guests with any combination of IPv4 or IPv6 configured addresses.
In XenServer VMs can operate in full virtualized mode. Specific processor features are used to ‘trap’ privileged instructions that the virtual machine carries out. This capability enables you to use an unmodified operating system. For network and storage access, emulated devices are presented to the virtual machine. Alternatively, PV drivers can be used for performance and reliability reasons.
VMs are prepared from templates. A template is a gold image that contains all the various configuration settings to create an instance of a specific VM. XenServer ships with a base set of templates, which are raw VMs, on which you can install an operating system. Different operating systems require different settings to run at their best. XenServer templates are tuned to maximize operating system performance.
There are two basic methods by which you can create VMs from templates:
Using a complete pre-configured template.
Installing an operating system from a CD, ISO image or network repository onto the appropriate provided template.
Windows VMs describes how to install Windows operating systems onto VMs.
Linux VMs describes how to install Linux operating systems onto VMs.
Templates created by older versions of XenServer can be used in newer versions of XenServer. However, templates created in newer versions of XenServer are not compatible with older versions of XenServer. If you created a VM template by using Citrix Hypervisor 8.2, to use it with an earlier version, export the VDIs separately and create the VM again.
In addition to creating VMs from the provided templates, you can use the following methods to create VMs.
You can make a copy of an existing VM by cloning from a template. Templates are ordinary VMs which are intended to be used as original copies to create instances of VMs from. A VM can be customized and converted into a template. Ensure that you follow the appropriate preparation procedure for the VM. For more information, see Preparing for Cloning a Windows VM Using Sysprep and Preparing to Clone a Linux VM.
Templates cannot be used as normal VMs.
XenServer has two mechanisms for cloning VMs:
A full copy
The faster Copy-on-Write mode only writes modified blocks to disk. Copy-on-Write is designed to save disk space and allow fast clones, but slightly slows down normal disk performance. A template can be fast-cloned multiple times without slowdown.
If you clone a template into a VM and then convert the clone into a template, disk performance can decrease. The amount of decrease has a linear relationship to the number of times this process has happened. In this event, the
vm-copyCLI command can be used to perform a full copy of the disks and restore expected levels of disk performance.
If you create a template from VM virtual disks on a shared SR, the template cloning operation is forwarded to any host in the pool that can access the shared SRs. However, if you create the template from a VM virtual disk that only has a local SR, the template clone operation is only able to run on the host that can access that SR.
You can create a VM by importing an existing exported VM. Like cloning, exporting and importing a VM is fast way to create more VMs of a certain configuration. Using this method enables you to increase the speed of your deployment. You might, for example, have a special-purpose host configuration that you use many times. After you set up a VM as required, export it and import it later to create another copy of your specially configured VM. You can also use export and import to move a VM to the XenServer host that is in another resource pool.
For details and procedures on importing and exporting VMs, see Importing and Exporting VMs.
XenServer VM Tools
XenServer VM Tools provide high performance I/O services without the overhead of traditional device emulation.
XenServer VM Tools for Windows consist of I/O drivers (also known as paravirtualized drivers or PV drivers) and the Management Agent.
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. While installing a Windows operating system, XenServer uses traditional device emulation to present a standard IDE controller and a standard network card to the VM. This emulation allows the Windows installation to use built-in drivers, but with reduced performance due to the overhead inherent in emulating the controller drivers.
The Management Agent, also known as the Guest Agent, is responsible for high-level virtual machine management features and provides a full set of functions to XenCenter.
Install XenServer VM Tools for Windows on each Windows VM for that VM to have a fully supported configuration, and to be able to use the xe CLI or XenCenter. A VM functions without the XenServer VM Tools for Windows, but performance is hampered when the I/O drivers (PV drivers) are not installed. You must install XenServer VM Tools for Windows on Windows VMs to be able to perform the following operations:
Cleanly shut down, reboot, or suspend a VM
View VM performance data in XenCenter
Migrate a running VM (using live migration or storage live migration)
Create snapshots with memory (checkpoints) or revert to snapshots
For more information, see Install XenServer VM Tools for Windows.
XenServer VM Tools for Linux contain a guest agent that provides extra information about the VM to the host.
You must install the XenServer VM Tools for Linux on Linux VMs to be able to perform the following operations:
View VM performance data in XenCenter
Adjust the number of vCPUs on a running Linux VM
Enable dynamic memory control
You cannot use the Dynamic Memory Control (DMC) feature on Red Hat Enterprise Linux 8, Red Hat Enterprise Linux 9, Rocky Linux 8, Rocky Linux 9, or CentOS Stream 9 VMs as these operating systems do not support memory ballooning with the Xen hypervisor.
For more information, see Install XenServer VM Tools for Linux.
XenCenter reports the virtualization state of a VM on the VM’s General tab. You can find out whether or not XenServer VM Tools are installed. This tab also displays whether the VM can install and receive updates from Windows Update. The following section lists the messages displayed in XenCenter:
I/O optimized (not optimized): This field displays whether or not the I/O drivers are installed on the VM.
Management Agent installed (not installed): This field displays whether or not the Management Agent is installed on the VM.
Able to (Not able to) receive updates from Windows Update: specifies whether the VM can receive I/O drivers from Windows Update.
Windows Server Core 2016 does not support using Windows Update to install or update the I/O drivers. Instead use the XenServer VM Tools for Windows installer provided on the XenServer Downloads page.
Install I/O drivers and Management Agent: this message is displayed when the VM does not have the I/O drivers or the Management Agent installed.
Guest UEFI boot and Secure Boot
XenServer enables the following guest operating systems to boot in UEFI mode:
- Windows 10
- Windows 11
- Windows Server 2016
- Windows Server 2019
- Windows Server 2022
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9 (preview)
- Ubuntu 20.04
- Ubuntu 22.04
UEFI boot provides a richer interface for the guest operating systems to interact with the hardware, which can significantly reduce VM boot times. If XenServer supports UEFI boot for your guest operating system, we recommend that you choose this boot mode instead of BIOS.
For these operating systems, XenServer also supports Secure Boot. Secure Boot prevents unsigned, incorrectly signed or modified binaries from being run during boot. On a UEFI-enabled VM that enforces Secure Boot, all drivers must be signed. This requirement might limit the range of uses for the VM, but provides the security of blocking unsigned/modified drivers. If you use an unsigned driver, secure boot fails and an alert is shown in XenCenter. Secure Boot also reduces the risk that malware in the guest can manipulate the boot files or run during the boot process.
You must specify the boot mode when creating a VM. It is not possible to change the boot mode of a VM between BIOS and UEFI (or UEFI Secure Boot) after booting the VM for the first time. However, you can change the boot mode between UEFI and UEFI Secure Boot after the VM is used to troubleshoot potential Secure Boot issues. For more information, see Troubleshooting.
Consider the following when enabling UEFI boot on VMs:
- Ensure that a UEFI-enabled Windows VM has at least two vCPUs. UEFI-enabled Linux VMs do not have this restriction.
- You can import or export a UEFI-enabled VM created on XenServer as an OVA, OVF, or an XVA file. Importing a UEFI-enabled VM from OVA or OVF packages created on other hypervisors is not supported.
- To use PVS-Accelerator with UEFI-enabled VMs, ensure that you are using Citrix Provisioning 1906 or later.
- For Windows VMs, use the UEFI settings menu to change the screen resolution of the XenCenter console. For detailed instructions, see Troubleshooting.
UEFI-enabled VMs use NVME and E1000 for emulated devices. The emulation information does not display these values until after you install XenServer VM Tools for Windows on the VM. UEFI-enabled VMs also show as only having 2 NICs until after you install XenServer VM Tools for Windows.
You can use XenCenter or the xe CLI to enable UEFI boot or UEFI Secure Boot for your VM.
When you create a VM, run the following command before booting the VM for the first time:
xe vm-param-set uuid=<UUID> HVM-boot-params:firmware=<MODE>
xe vm-param-set uuid=<UUID> platform:device-model=qemu-upstream-uefi
xe vm-param-set uuid=<UUID> platform:secureboot=<OPTION>
UUID is the VM’s UUID,
MODE is either
OPTION is either ‘true’ or ‘false’. If you do not specify the mode, it defaults to
uefi if that option is supported for your VM operating system. Otherwise, the mode defaults to
BIOS. If you do not specify the
secureboot option, it defaults to ‘auto’. For UEFI-enabled VMs, the ‘auto’ behavior is to enable Secure Boot for the VM.
To create a UEFI-enabled VM from a template supplied with XenServer, run the following command:
UUID=$(xe vm-clone name-label='Windows 10 (64-bit)' new-name-label='Windows 10 (64-bit)(UEFI)')
xe template-param-set uuid=<UUID> HVM-boot-params:firmware=<MODE> platform:secureboot=<OPTION>
Do not run this command for templates that have something installed on them or templates that you created from a snapshot. The boot mode of these snapshots cannot be changed and, if you attempt to change the boot mode, the VM fails to boot.
When you boot the UEFI-enabled VM the first time you are prompted on the VM console to press any key to start the installation. If you do not start the operating system installation, the VM console switches to the UEFI shell.
To restart the installation process, in the UEFI console, type the following commands.
When the installation process restarts, watch the VM console for the installation prompt. When the prompt appears, press any key.
You might want to disable Secure Boot on occasion. For example, some types of debugging cannot be enabled on a VM that in Secure Boot user mode. To disable Secure Boot, change the VM into Secure Boot setup mode. On your XenServer host, run the following command:
varstore-sb-state <VM_UUID> setup
For Windows VMs:
UEFI-enabled Windows VMs are provisioned with a PK from an ephemeral private key, the Microsoft KEK, the Microsoft Windows Production PCA, and Microsoft third party keys. The VMs are also provided with an up-to-date revocation list from the UEFI forum. This configuration enables Windows VMs to boot with Secure Boot turned on and to receive automatic updates to the keys and revocation list from Microsoft.
For Linux VMs:
To install third-party drivers in a Linux VM that has Secure Boot enabled, you must create a signing key, add it to the VM as a machine owner key (MOK), and use that key to sign the driver. For more information, see Install third-party drivers on your Secure Boot Linux VM.
For information about troubleshooting your UEFI or UEFI Secure Boot VMs, see Troubleshoot UEFI and Secure Boot problems.
Supported guests and allocating resources
For a list of supported guest operating systems, see Supported Guests, Virtual Memory, and Disk Size Limits
This section describes the differences in virtual device support for the members of the XenServer product family.
The current version of the XenServer product family has some general limitations on virtual devices for VMs. Specific guest operating systems may have lower limits for certain features. The individual guest installation section notes the limitations. For detailed information on configuration limits, see Configuration Limits.
Factors such as hardware and environment can affect the limitations. For information about supported hardware, see the XenServer Hardware Compatibility List.
XenServer emulates an IDE bus in the form of an
hd* device. When using Windows, installing the XenServer VM Tools installs a special I/O driver that works in a similar way to Linux, except in a fully virtualized environment.
A pool’s CPU feature set can change while a VM is running, for example, when a new host is added to an existing pool or when the VM is migrated to a host in another pool. When a pool’s CPU feature set changes, the VM continues to use the feature set which was applied when it was started. To update the VM to use the pool’s new feature set, you must restart the VM.