Virtualization Guide - SUSE Linux Enterprise Server 12 SP2
Virtualization Guide - SUSE Linux Enterprise Server 12 SP2
Virtualization Guide - SUSE Linux Enterprise Server 12 SP2
Virtualization Guide
I Introduction
1 Virtualization Technology
1.1 Overview
1.2 Virtualization Capabilities
1.3 Virtualization Benefits
1.4 Understanding Virtualization Modes
1.5 I/O Virtualization
12 Managing Storage
12.1 Managing Storage with Virtual Machine Manager
12.2 Managing Storage with virsh
12.3 Locking Disk Files and Block Devices with virtlockd
12.4 Online Resizing of Guest Block Devices
12.5 Sharing Directories between Host and Guests (File System
Pass-Through)
13 Managing Networks
13.1 Virtual Networks
13.2 Bridged Networking
17 libguestfs
17.1 VM Guest Manipulation Overview
17.2 Package Installation
17.3 Guestfs Tools
17.4 Troubleshooting
17.5 External References
19 Virtual Networking
19.1 Network Devices for Guest Systems
19.2 Host-Based Routing in Xen
19.3 Creating a Masqueraded Network Setup
19.4 Special Configurations
23 Administrative Tasks
23.1 The Boot Loader Program
23.2 Sparse Image Files and Disk Space
23.3 Migrating Xen VM Guest Systems
23.4 Monitoring Xen
23.5 Providing Host Information for VM Guest Systems
28 Guest Installation
28.1 Basic Installation with qemu-system-ARCH
28.2 Managing Disk Images with qemu-img
Glossary
A Virtual Machine Drivers
B Appendix
B.1 Installing Paravirtualized Drivers
B.2 Generating x509 Client/Server Certificates
D Documentation Updates
D.1 November 2016 (Release of SUSE Linux Enterprise Server 12 SP2)
D.2 March 2016 (Maintenance Release of SUSE Linux Enterprise Server 12 SP1)
D.3 December 2015 (Initial Release of SUSE Linux Enterprise Server 12 SP1)
D.4 February 2015 (Documentation Maintenance Update)
D.5 October 2014 (Initial Release of SUSE Linux Enterprise Server 12)
E GNU Licenses
E.1 GNU Free Documentation License
List of Figures
2.1 Xen Virtualization Architecture
3.1 KVM Virtualization Architecture
13.1 Connection Details
13.2 Create virtual network
13.3 Create virtual network
13.4 Create virtual network
14.1 Details View of a VM Guest
14.2 Overview details
14.3 VM Guest Title and Description
14.4 Performance
14.5 Statistics Charts
14.6 Processor View
14.7 Memory View
14.8 Boot Options
14.9 Add a New Storage
14.10 Add a New Controller
14.11 Add a New Controller
14.12 Adding a PCI Device
23.1 Boot Loader Settings
27.1 Installing the KVM Hypervisor and Tools
27.2 Network Bridge
28.1 New 2 GB Partition in Guest YaST Partitioner
29.1 QEMU Window with SLES 11 SP3 as VM Guest
List of Tables
7.1 Paravirtualized OS Support
7.2 Feature Support—Host ( Dom0 )
7.3 Feature Support—Paravirtualized Guest
7.4 Feature Support—Fully Virtualized Guest
25.1 Xen Remote Storage
C.1 Notation Conventions
C.2 New Global Options
C.3 Common Options
C.4 Domain Management Removed Options
C.5 USB Devices Management Removed Options
C.6 CPU Management Removed options
C.7 Other Options
C.8 xl create Changed Options
C.9 xm create Removed Options
C.10 xl create Added Options
C.11 xl console Added Options
C.12 xm info Removed Options
C.13 xm dump-core Removed Options
C.14 xm list Removed Options
C.15 xl list Added Options
C.16 xl mem-* Changed Options
C.17 xm migrate Removed Options
C.18 xl migrate Added Options
C.19 xm reboot Removed Options
C.20 xl reboot Added Options
C.21 xl save Added Options
C.22 xl restore Added Options
C.23 xm shutdown Removed Options
C.24 xl shutdown Added Options
C.25 xl trigger Changed Options
C.26 xm sched-credit Removed Options
C.27 xl sched-credit Added Options
C.28 xm sched-credit2 Removed Options
C.29 xl sched-credit2 Added Options
C.30 xm sched-sedf Removed Options
C.31 xl sched-sedf Added Options
C.32 xm cpupool-list Removed Options
List of Examples
9.1 Example of a virt-install command line
10.1 Typical Output of kvm_stat
13.1 NAT Based Network
13.2 Routed Network
13.3 Isolated Network
13.4 Using an Existing Bridge on VM Host Server
20.1 Guest Domain Configuration File: /etc/xen/sled12.cfg
27.1 Exporting Host's File System with VirtFS
29.1 Restricted User-mode Networking
29.2 User-mode Networking with Custom IP Range
29.3 User-mode Networking with Network-boot and TFTP
29.4 User-mode Networking with Host Port Forwarding
29.5 Password Authentication
29.6 x509 Certificate Authentication
29.7 x509 Certificate and Password Authentication
29.8 SASL Authentication
C.1 Converting Xen Domain Configuration to libvirt
Copyright © 2006– 2017 SUSE LLC and contributors. All rights reserved.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Docu-
mentation License, Version 1.2 or (at your option) version 1.3; with the Invariant Section being this copyright
notice and license. A copy of the license version 1.2 is included in the section entitled “GNU Free Documenta-
tion License”.
For SUSE trademarks, see http://www.suse.com/company/legal/↗ . All other third-party trademarks are the
property of their respective owners. Trademark symbols (®, ™ etc.) denote trademarks of SUSE and its affili-
ates. Asterisks (*) denote third-party trademarks.
All information found in this book has been compiled with utmost attention to detail. However, this does not
guarantee complete accuracy. Neither SUSE LLC, its affiliates, the authors nor the translators shall be held li-
able for possible errors or the consequences thereof.
For an overview of the documentation available for your product and the latest doc-
umentation updates, refer to http://www.suse.com/doc↗.
1 Available Documentation
We provide HTML and PDF versions of our books in different languages. The follow-
ing manuals for users and administrators are available for this product:
Shows how to install single or multiple systems and how to exploit the product
inherent capabilities for a deployment infrastructure. Choose from various ap-
proaches, ranging from a local installation or a network installation server to a
mass deployment using a remote-controlled, highly-customized, and automated
installation technique.
Virtualization Guide
Describes virtualization technology in general, and introduces libvirt—the uni-
fied interface to virtualization—and detailed information on specific hypervi-
sors.
Book “AutoYaST”
AutoYaST is a system for installing one or more SUSE Linux Enterprise Server
systems automatically and without user intervention, using an AutoYaST profile
that contains installation and configuration data. The manual guides you
through the basic steps of auto-installation: preparation, installation, and config-
uration.
Find HTML versions of most product manuals in your installed system under
/usr/share/doc/manual . The latest documentation updates are available at
http://www.suse.com/documentation/↗ where you can download the documenta-
tion for your product in various formats.
2 Feedback
Several feedback channels are available:
User Comments
We want to hear your comments about and suggestions for this manual and the
other documentation included with this product. Use the User Comments fea-
ture at the bottom of each page in the online documentation or go to
http://www.suse.com/documentation/feedback.html↗ and enter your com-
ments there.
Mail
For feedback on the documentation of this product, you can also send a mail to
doc-team@suse.com . Make sure to include the document title, the product
version and the publication date of the documentation. To report errors or sug-
gest enhancements, provide a concise description of the problem and refer to
the respective section number and page (or URL).
3 Documentation Conventions
The following notices and typographical conventions are used in this documenta-
tion:
Commands that must be run with root privileges. Often you can also prefix
these commands with the sudo command to run them as non-privileged
user.
root # command
tux > sudo command
Notices
Part I Introduction
1 Virtualization Technology
Virtualization is a technology that provides a way for a machine (Host) to run an-
other operating system (guest virtual machines) on top of the host operating
system.
5 Virtualization Tools
libvirt is a library that provides a common API for managing popular virtual-
ization solutions, among them KVM, LXC, and Xen. The library provides a nor-
malized management API for these virtualization solutions, allowing a stable,
cross-hypervisor interface for higher-level management tools. The library also
provides APIs for management of virtual networks and storage on the VM Host
Server. The configuration of each VM Guest is stored in an XML file.
With libvirt you can also manage your VM Guests remotely. It supports TLS
encryption, x509 certificates and authentication with SASL. This enables manag-
ing VM Host Servers centrally from a single workstation, alleviating the need to
access each VM Host Server individually.
Using the libvirt -based tools is the recommended way of managing VM
Guests. Interoperability between libvirt and libvirt -based applications
has been tested and is an essential part of SUSE's support stance.
1 Virtualization Technology
Abstract
1.1 Overview
1.2 Virtualization Capabilities
1.3 Virtualization Benefits
1.4 Understanding Virtualization Modes
1.5 I/O Virtualization
1.1 Overview
SUSE Linux Enterprise includes the latest open source virtualization technologies,
Xen and KVM. With these Hypervisors, SUSE Linux Enterprise can be used to provi-
sion, de-provision, install, monitor and manage multiple virtual machines (VM
Guests) on a single physical system (for more information see Hypervisor).
Out of the box, SUSE Linux Enterprise can create virtual machines running both
modified, highly tuned, paravirtualized operating systems and fully virtualized un-
modified operating systems. Full virtualization allows the guest OS to run unmodi-
fied and requires the presence of AMD64/Intel 64 processors which supports either
Intel* Virtualization Technology (Intel VT) or AMD* Virtualization (AMD-V)).
The primary component of the operating system that enables virtualization is a Hy-
pervisor (or virtual machine manager), which is a layer of software that runs directly
on server hardware. It controls platform resources, sharing them among multiple
VM Guests and their operating systems by presenting virtualized hardware inter-
faces to each VM Guest.
SUSE Linux Enterprise is an enterprise-class Linux server operating system that of-
fers two types of Hypervisors: Xen and KVM. Both Hypervisors support virtualization
on 64-bit x86-based hardware architectures. Both Xen and KVM support full virtual-
ization mode. In addition, Xen supports paravirtualized mode. SUSE Linux Enter-
prise with Xen or KVM acts as a virtualization host server (VHS) that supports VM
Guests with its own guest operating systems. The SUSE VM Guest architecture con-
sists of a Hypervisor and management components that constitute the VHS, which
runs many application-hosting VM Guests.
Isolation: guest operating system can be fully isolated from the Host running
it. So if the virtual machine is corrupted, the Host system is not harmed.
First, it reduces the cost of your infrastructure. Servers are mainly used to provide a
service to a customer, and a virtualized operating system can provide the same ser-
vice, with:
Less hardware: You can run several operating system on one host, so all
hardware maintenance will be reduced.
Less power/cooling: Less hardware means you do not need to invest more in
electric power, backup power, and cooling if you need more service.
Save space: Your data center space will be saved because you do not need
more hardware servers (less servers than service running).
Full virtualization mode lets virtual machines run unmodified operating sys-
tems, such as Windows* Server 2003. However, it also requires the VM Host
Server to support hardware-assisted virtualization technology, such as AMD*
Virtualization or Intel* Virtualization Technology.
Some guest operating systems hosted in full virtualization mode can be con-
figured to run the Novell* Virtual Machine Drivers instead of drivers originat-
ing from the operating system. Running virtual machine drivers improves
performance dramatically on guest operating systems, such as Windows
Server 2003. For more information, see Appendix A, Virtual Machine Drivers.
Paravirtual mode does not require the host computer to support hardware-
assisted virtualization technology, but does require the guest operating sys-
tem to be modified for the virtualization environment. Typically, operating
systems running in paravirtual mode enjoy better performance than those
requiring full virtualization mode.
VM Guests not only share CPU and memory resources of the host system, but also
the I/O subsystem. Because software I/O virtualization techniques deliver less per-
formance than bare metal, hardware solutions that deliver almost “native” perfor-
mance have been developed recently. SUSE Linux Enterprise Server supports the fol-
lowing I/O virtualization techniques:
Full Virtualization
Fully Virtualized (FV) drivers emulate widely supported real devices, which can
be used with an existing driver in the VM Guest. The guest is also called Hard-
ware Virtual Machine (HVM). Since the physical device on the VM Host Server
may differ from the emulated one, the hypervisor needs to process all I/O oper-
ations before handing them over to the physical device. Therefore all I/O opera-
tions need to traverse two software layers, a process that not only significantly
impacts I/O performance, but also consumes CPU time.
Paravirtualization
Paravirtualization (PV) allows direct communication between the hypervisor and
the VM Guest. With less overhead involved, performance is much better than
with full virtualization. However, paravirtualization requires either the guest op-
erating system to be modified to support the paravirtualization API or paravirtu-
alized drivers. See Section 7.1.1, “Availability of Paravirtualized Drivers” for a list
of guest operating systems supporting paravirtualization.
PVHVM
This type of virtualization enhances HVM (see Full Virtualization) with paravirtu-
alized (PV) drivers, and PV interrupt and timer handling.
VFIO
VFIO stands for Virtual Function I/O and is a new user-level driver framework for
Linux. It replaces the traditional KVM PCI Pass-Through device assignment. The
VFIO driver exposes direct device access to user space in a secure memory
(IOMMU) protected environment. With VFIO, a VM Guest can directly access
hardware devices on the VM Host Server (pass-through), avoiding performance
issues caused by emulation in performance critical paths. This method does not
allow to share devices—each device can only be assigned to a single VM Guest.
VFIO needs to be supported by the VM Host Server CPU, chipset and the
BIOS/EFI.
Compared to the legacy KVM PCI device assignment, VFIO has the following ad-
vantages:
Offers a user space device driver with more flexible device ownership
model.
As of SUSE Linux Enterprise Server 12 SP2, the USB and PCI Pass-through meth-
ods of device assignment are considered deprecated and were superseded by
the VFIO model.
SR-IOV
The latest I/O virtualization technique, Single Root I/O Virtualization SR-IOV com-
bines the benefits of the aforementioned techniques—performance and the
ability to share a device with several VM Guests. SR-IOV requires special I/O de-
vices, that are capable of replicating resources so they appear as multiple sepa-
rate devices. Each such “pseudo” device can be directly used by a single guest.
However, for network cards for example the number of concurrent queues that
can be used is limited, potentially reducing performance for the VM Guest com-
pared to paravirtualized drivers. On the VM Host Server, SR-IOV must be sup-
ported by the I/O device, the CPU and chipset, the BIOS/EFI and the hypervi-
sor—for setup instructions see Section 14.10, “Adding a PCI Device to a VM
Guest”.
To be able to use the VFIO and SR-IOV features, the VM Host Server needs to fulfill
the following requirements:
This chapter introduces and explains the components and technologies you need to
understand to set up and manage a Xen-based virtualization environment.
The Dom0
The virtual machine host environment, also called Dom0 or controlling domain,
is composed of several components, such as:
Note
The term “Dom0” refers to a special domain that provides the man-
agement environment. This may be run either in graphical or in com-
mand line mode.
The xl tool stack based on the xenlight library (libxl). Use it to manage
Xen guest domains.
At least one virtual disk that contains a bootable operating system. The
virtual disk can be based on a file, partition, volume, or other type of
block device.
A configuration file for each guest domain. It is a text file following the
syntax described in the manual page man 5 xl.conf .
On the left, the virtual machine host’s Dom0 is shown running the SUSE Linux Enter-
prise operating system. The two virtual machines shown in the middle are running
paravirtualized operating systems. The virtual machine on the right shows a fully vir-
tual machine running an unmodified operating system, such as the latest version of
Microsoft Windows/Server.
VM Guests (virtual machines), virtual storage, and virtual networks can be managed
with QEMU tools directly, or with the libvirt -based stack. The QEMU tools in-
clude qemu-system-ARCH , the QEMU monitor, qemu-img , and qemu-ndb . A
libvirt -based stack includes libvirt itself, along with libvirt -based applica-
tions such as virsh , virt-manager , virt-install , and virt-viewer .
The term KVM more properly refers to the Kernel level virtualization functionality,
but is in practice more commonly used to refer to the user space component.
QEMU can provide certain Hyper-V hypercalls for Windows* guests to partly em-
ulate a Hyper-V environment. This can be used to achieve better behavior for
Windows* guests that are Hyper-V enabled.
Linux containers are a lightweight virtualization method to run multiple virtual units
(“containers”) simultaneously on a single host. This is similar to the chroot environ-
ment. Containers are isolated with kernel Control Groups (cgroups) and kernel
Namespaces.
Containers provide virtualization at the operating system level where the kernel con-
trols the isolated containers. This is unlike full virtualization solutions like Xen or
KVM where the processor simulates a complete hardware environment and controls
virtual machines.
BENEFITS OF CONTAINERS
Isolating applications and operating systems through containers.
LIMITATIONS OF CONTAINERS
All containers run inside the host system's kernel and not with a different
kernel.
Security depends on the host system. Container is not secure. If you need a
secure system, you can confine it using an AppArmor or SELinux profile.
5 Virtualization Tools
Abstract
virsh
A command line tool to manage VM Guests with similar functionality as the Vir-
tual Machine Manager. Allows you to change a VM Guest's status (start, stop,
pause, etc.), to set up new guests and devices, or to edit existing configurations.
virsh is also useful to script VM Guest management operations.
virsh takes the first argument as a command and further arguments as op-
tions to this command:
Like zypper , virsh can also be called without a command. In this case it
starts a shell waiting for your commands. This mode is useful when having to
run subsequent commands:
virsh # hostname
mercury.example.com
virt-install
A command line tool for creating new VM Guests using the libvirt library. It
supports graphical installations via VNC or SPICE protocols. Given suitable com-
mand line arguments, virt-install can run completely unattended. This al-
lows for easy automation of guest installs. virt-install is the default instal-
lation tool used by the Virtual Machine Manager.
Note
To disable automatic USB device redirection for VM Guest using spice, either
launch virt-manager with the --spice-disable-auto-usbredir pa-
rameter or run the following command to persistently change the default be-
havior:
virt-viewer
Note
To disable automatic USB device redirection for VM Guest using spice, add an
empty filter using the --spice-usbredir-auto-redirect-filter='' pa-
rameter.
yast2 vm
A YaST module that simplifies the installation of virtualization tools and can set
up a network bridge:
6 Installation of Virtualization
Components
6.1 Installing KVM
6.2 Installing Xen
6.3 Installing Containers
6.4 Patterns
2. Select KVM server for a minimal installation of QEMU tools. Select KVM tools if
a libvirt -based management stack is also desired. Confirm with Accept.
4. After the setup has been finished, you can start setting up VM Guests. Re-
booting the VM Host Server is not required.
2. Select Xen server for a minimal installation of Xen tools. Select Xen tools if a
libvirt -based management stack is also desired. Confirm with Accept.
4.
After the setup has been finished, you need to reboot the machine with the
Xen kernel.
If everything works as expected, change the default boot kernel with YaST
and make the Xen-enabled kernel the default. For more information
about changing the default kernel, see Book “Administration Guide”, Chap-
ter 11 “The Boot Loader GRUB 2”, Section 11.3 “Configuring the Boot Loader
with YaST”.
6.4 Patterns
It is possible using Zypper and patterns to install virtualization packages. Run the
command zypper in -t pattern PATTERN . Available patterns are:
KVM
kvm_server : sets up the KVM VM Host Server with QEMU tools for
management
Xen
xen_server : sets up the Xen VM Host Server with Xen tools for man-
agement
Containers
There is no pattern for containers; install the libvirt-daemon-lxc package.
Supported virtualization limits for Xen and KVM are outlined in the Release Notes↗.
1 Technology preview: The operating system has been tested to install and run suc-
cessfully. Bugs can be reported and will be tracked by SUSE Technical Services, but
no support commitments or service level agreements apply. Potential fixes and
patches will be evaluated for future inclusion.
2 You need a static IP address for each virtual machine running NetWare or OES.
3 OES can only be installed from a network installation source.
4 RedHat* guest operating systems are fully supported with Expanded Support. Oth-
erwise, they will be supported on a best-effort basis (fixes if reasonable).
RedHat
Available in RedHat Enterprise Linux 5.4 and newer
Windows
SUSE has developed virtio-based drivers for Windows, which are available in the
Virtual Machine Driver Pack (VMDP). For more information, see
http://www.suse.com/products/vmdriverpack/↗.
Full support for all SUSE host systems and SUSE Linux Enterprise Server 12
SP2 VM Guests
PowerKVM
Windows 2012+
Oracle VM 3.3
Currently, SUSE only supports KVM full virtualization on AMD64/Intel 64 hosts and
on z Systems (only as Technology Preview). On the AMD64/Intel 64 architecture,
KVM is designed around hardware virtualization features included in AMD* (AMD-V)
and Intel* (VT-x) CPUs. It supports virtualization features of chipsets, and PCI de-
vices, such as an I/O Memory Mapping Unit (IOMMU) and Single Root I/O Virtualiza-
tion (SR-IOV).
On the AMD64/Intel 64 architecture, you can test whether your CPU supports hard-
ware virtualization with the following command:
If this command returns no output, your processor either does not support hard-
ware virtualization, or this feature has been disabled in the BIOS or Firmware.
The following Web sites identify AMD64/Intel 64 processors that support hardware
virtualization: http://ark.intel.com/Products/VirtualizationTechnology↗ (for Intel
CPUs), and http://products.amd.com/↗ (for AMD CPUs).
The KVM kernel modules only load if the CPU hardware virtualization features are
available.
The general minimum hardware requirements for the VM Host Server are the same
as outlined in Book “Deployment Guide”, Chapter 2 “Installation on AMD64 and
Intel 64”, Section 2.1 “System Requirements for Operating Linux”. However, additional
RAM for each virtualized guest is needed. It should at least be the same amount that
is needed for a physical installation. It is also strongly recommended to have at least
one processor core or hyper-thread for each running guest.
Features Xen
Network and block device hotplugging Yes
Physical CPU hotplugging No
Virtual CPU hotplugging Yes
Virtual CPU pinning Yes
Virtual CPU capping Yes
Intel* VT-x2: FlexPriority, FlexMigrate (migration constraints apply to dis-
Yes
similar CPU architectures)
Intel* VT-d2 (DMA remapping with interrupt filtering and queued invali-
Yes
dation)
AMD* IOMMU (I/O page table with guest-to-host physical address
Yes
translation)
Features Xen
Virtual network and virtual block de-
Yes
vice hotplugging
Virtual CPU hotplugging Yes
Virtual CPU over-commitment Yes
Dynamic virtual memory resize Yes
VM save and restore Yes
Yes, between like virtual host systems with
VM live migration
similar resources
Advanced debugging with GDBC Yes
Dom0 metrics visible to VM Yes
Memory ballooning Yes
PCI pass-through Yes (Netware guests are excluded)
For live migration, both source and target system architectures need to match; that
is, the processors (AMD* or Intel*) must be the same. Unless CPU ID masking is
used, such as with Intel FlexMigration, the target should feature the same processor
revision or a more recent processor revision than the source. If VMs are moved
among different systems, the same rules apply for each move. To avoid failing opti-
mized code at runtime or application start-up, source and target CPUs need to ex-
pose the same processor extensions. Xen exposes the physical CPU extensions to
the VMs transparently. To summarize, guests can be 32-bit or 64-bit, but the VHS
must be identical.
For machines that support Intel FlexMigration, CPU-ID masking and faulting allow
more flexibility in cross-CPU migration.
Hotplugging of virtual network and virtual block devices, and resizing, shrinking,
and restoring dynamic virtual memory are supported in Xen and KVM only if PV
drivers are being used (VMDP).
9 Guest Installation
A VM Guest consists of an image containing an operating system and data files
and a configuration file describing the VM Guest's virtual hardware resources.
VM Guests are hosted on and controlled by the VM Host Server. This section
provides generalized instructions for installing a VM Guest.
12 Managing Storage
When managing a VM Guest on the VM Host Server itself, you can access the
complete file system of the VM Host Server to attach or create virtual hard disks
or to attach existing images to the VM Guest. However, this is not possible when
managing VM Guests from a remote host. For this reason, libvirt…
13 Managing Networks
This chapter introduces common networking configurations supported by
libvirt . It does not depend on the hypervisor used. It is valid for all hypervi-
sors supported by libvirt , such as KVM or Xen. These setups can be achieved
using both the graphical interface of Virtual Machine Manager and the com-
mand line tool virsh .
Virtual Machine Manager's Details view offers in-depth information about the
VM Guest's complete configuration and hardware equipment. Using this view,
you can also change the guest configuration or add and modify virtual hard-
ware. To access this view, open the guest's console in Virtual Machine Manager
and either choose View › Details from the menu, or click Show virtual hardware
details in the toolbar.
The communication between the virtualization solutions (KVM, Xen, LXC) and the lib-
virt API is managed by the daemon libvirtd , which needs to run on the VM Host
Server. libvirt client applications such as virt-manager, possibly running on a remote
machine, communicate with libvirtd running on the VM Host Server, which ser-
vices the request using native hypervisor APIs. Use the following commands to start
and stop libvirtd or check its status:
To automatically start libvirtd at boot time, either activate it using the YaST Ser-
vices Manager module or by entering the following command:
In case the command returns active , you need to stop xendomains before
you will be able to start the libvirtd daemon. In case you want libvirtd to
also start after rebooting, you should additionally prevent xendomains from
starting automatically by disabling the service:
xendomains and libvirtd provide the same service and when used in parallel
may interfere with one another. As an example, xendomains may attempt to
start a domU already started by libvirtd .
9 Guest Installation
9.1 GUI-Based Guest Installation
9.2 Installing from the Command Line with virt-install
9.3 Advanced Guest Installation Scenarios
A VM Guest consists of an image containing an operating system and data files and a
configuration file describing the VM Guest's virtual hardware resources. VM Guests
are hosted on and controlled by the VM Host Server. This section provides general-
ized instructions for installing a VM Guest.
Virtual machines have few if any requirements above those required to run the op-
erating system. If the operating system has not been optimized for the virtual ma-
chine host environment, it can only run on hardware-assisted virtualization com-
puter hardware, in full virtualization mode, and requires specific device drivers to be
loaded. The hardware that is presented to the VM Guest depends on the configura-
tion of the host.
The virtual machine host runs only on AMD64 and Intel 64. Additionally, KVM for
z Systems is included on SUSE Linux Enterprise Server as a technology preview. It
does not run on other system architectures such as POWER. A 64-bit virtual ma-
chine host can, however, run both 32-bit and 64-bit VM Guests.
You should be aware of any licensing issues related to running a single licensed copy
of an operating system on multiple virtual machines. Consult the operating system
license agreement for more information.
1. Start the New VM wizard either from YaST or Virtual Machine Manager.
On a VM Host Server running the Xen hypervisor, you can choose whether
to install a paravirtualized or a fully virtualized guest. The respective option
is available under Architecture Options. Depending on this choice, not all in-
stallation options may be available.
3. Depending on your choice in the previous step, you need to provide the fol-
lowing data:
Specify the path on the VM Host Server to an iso image containing the
installation data. If it is available as a volume in a libvirt storage pool,
you can also select it using Browse. For more information, see Chap-
ter 12, Managing Storage.
Alternatively, choose a physical CD-ROM or DVD inserted in the optical
drive of the VM Host Server.
4. Choose the memory size and number of CPUs for the new virtual machine.
5. This step is omitted when Import an Existing Image is chosen in the first step.
Set up a virtual hard disk for the VM Guest. Either create a new disk image or
choose an existing one from a storage pool (for more information, see
Chapter 12, Managing Storage). If you choose to create a disk, a qcow2 im-
age will be created. By default, it is stored under
/var/lib/libvirt/images .
Setting up a disk is optional. If you are running a live system directly from
CD or DVD, for example, you can omit this step by deactivating Enable Stor-
age for this Virtual Machine.
6. On the last screen of the wizard, specify the name for the virtual machine. To
be offered the possibility to review and make changes to the virtualized
hardware selection, activate Customize configuration before install. Find op-
tions to specify the network device under Network Selection.
Click Finish.
7. (Optional) If you kept the defaults in the previous step, the installation will
now start. If you selected Customize configuration before install, a VM Guest
configuration dialog opens. For more information about configuring VM
Guests, see Chapter 14, Configuring Virtual Machines.
The installation starts in a Virtual Machine Manager console window. Some key
combinations, such as Ctrl – Alt – F1 , are recognized by the VM Host Server but
are not passed to the virtual machine. To bypass the VM Host Server, Virtual Ma-
chine Manager provides the “sticky key ” functionality. Pressing Ctrl , Alt , or
Shift three times makes the key sticky, then you can press the remaining keys to
For example, to pass Ctrl – Alt – F2 to a Linux virtual machine, press Ctrl
three times, then press Alt – F2 . You can also press Alt three times, then press
Ctrl – F2 .
The sticky key functionality is available in the Virtual Machine Manager during
and after installing a VM Guest.
virt-install is a complex script with a lot of command line switches. The follow-
ing are required. For more information, see the man page of virt-install (1).
General Options
Virtualization Type
Guest Storage
Specify one of --disk , --filesystem or --nodisks the type of the storage
for the new virtual machine. For example, --disk size=10 creates 10 GB disk
in the default image location for the hypervisor and uses it for the VM Guest.
--filesystem /export/path/on/vmhost specifies the directory on the VM
Host Server to be exported to the guest. And --nodisks sets up a VM Guest
without a local storage (good for Live CDs).
Installation Method
Specify the installation method using one of --location , --cdrom , --pxe ,
--import , or --boot .
The following command line example creates a new SUSE Linux Enterprise Desk-
top 12 virtual machine with a virtio accelerated disk and network card. It creates
a new 10 GB qcow2 disk image as a storage, the source installation media being
the host CD-ROM drive. It will use VNC graphics, and it will auto-launch the
graphical client.
KVM
Xen
1. Install the Windows guest with the maximum memory equal or less than the
initial value.
2. Install the Virtual Machine Driver Pack in the Windows guest to provide re-
quired drivers.
4. Reset the maximum memory of the Windows guest to the required value.
In case you are using the GUI-based installation, select Customize Configuration Be-
fore Install in the last step of the wizard and add the add-on product ISO image via
Add Hardware › Storage. Specify the path to the image and set the Device Type to
CD-ROM.
If installing from the command line, you need to set up the virtual CD/DVD drives
with the --disk parameter rather than with --cdrom . The device that is specified
first is used for booting. The following example will install SUSE Linux Enterprise
Server 12 plus SDK:
To connect to such a remote host with Virtual Machine Manager, you need to set
up a connection as explained in Section 11.2.2, “Managing Connections with Vir-
tual Machine Manager”. If connecting to a remote host using virsh or
virt-viewer , you need to specify a connection URI with the parameter -c (for
example, virsh -c qemu+tls://saturn.example.com/system or
virsh -c xen+ssh:// ). The form of connection URI depends on the connec-
tion type and the hypervisor—see Section 11.2, “Connecting to a VM Host Server”
for details.
virsh list
For more information and further options, see virsh help list or
man 1 virsh .
When you click into the VNC console, the cursor is “grabbed” and cannot be used
outside the console anymore. To release it, press Alt – Ctrl .
To prevent the console from grabbing the cursor and to enable seamless cursor
movement, add a tablet input device to the VM Guest. See Section 14.5, “Enabling
Seamless and Synchronized Mouse Pointer Movement” for more information.
Certain key combinations such as Ctrl – Alt – Del are interpreted by the host sys-
tem and are not passed to the VM Guest. To pass such key combinations to a VM
Guest, open the Send Key menu from the VNC window and choose the desired key
combination entry. The Send Key menu is only available when using Virtual Machine
Manager and virt-viewer . With Virtual Machine Manager, you can alternatively
use the “sticky key ” feature as explained in Tip: Passing Key Combinations to Virtual
Machines.
Principally all VNC viewers can connect to the console of a VM Guest. However, if
you are using SASL authentication and/or TLS/SSL connection to access the guest,
the options are limited. Common VNC viewers such as tightvnc or tigervnc
support neither SASL authentication nor TLS/SSL. The only supported alternative
to Virtual Machine Manager and virt-viewer is vinagre .
To connect to a guest that is running or paused, use either the ID, UUID, or name.
VM Guests that are shut off do not have an ID—you can only connect to them by
UUID or name.
virt-viewer 8
Connect to the inactive guest named sles12 ; the connection window will open
once the guest starts
With the --wait option, the connection will be upheld even if the VM Guest is
not running at the moment. When the guest starts, the viewer will be launched.
When using virt-viewer to open a connection to a remote host via SSH, the
SSH password needs to be entered twice. The first time for authenticating with
libvirt , the second time for authenticating with the VNC server. The second
password needs to be provided on the command line where virt-viewer was
started.
virsh console takes two optional flags: --safe ensures exclusive access to the
console, --force disconnects any existing sessions before connecting. Both fea-
tures need to be supported by the guest operating system.
Being able to connect to a VM Guest via serial console requires that the guest oper-
ating system supports serial console access and is properly supported. Refer to the
guest operating system manual for more information.
Tip: Enabling Serial Console Access for SUSE Linux Enterprise and
openSUSE Guests
Serial console access in SUSE Linux Enterprise and openSUSE is disabled by de-
fault. To enable it, proceed as follows:
SLES 12 / openSUSE
Launch the YaST Boot Loader module and switch to the Kernel Parameters
tab. Add console=ttyS0 to the field Optional Kernel Command Line Parame-
ter.
SLES 11
Launch the YaST Boot Loader module and select the boot entry for which to
activate serial console access. Choose Edit and add console=ttyS0 to the
field Optional Kernel Command Line Parameter. Additionally, edit
/etc/inittab and uncomment the line with the following content:
When shutting down a VM Guest, you may either shut it down gracefully, or force
the shutdown. The latter is equivalent to pulling the power plug on a physical host
and is only recommended if there are no alternatives. Forcing a shutdown may
cause file system corruption and loss of data on the VM Guest.
Depending on the guest operating system, availability of ACPI may not be suffi-
cient to perform a graceful shutdown. It is strongly recommended to test shutting
down and rebooting a guest before using it in production. openSUSE or SUSE
Linux Enterprise Desktop, for example, can require PolKit authorization for shut-
down and reboot. Make sure this policy is turned off on all VM Guests.
If ACPI was enabled during a Windows XP/Windows Server 2003 guest installa-
tion, turning it on in the VM Guest configuration only is not sufficient. For more
information, see:
https://support.microsoft.com/en-us/kb/314088↗
https://support.microsoft.com/en-us/kb/309283↗
PROCEDURE 10.1: STATE CHANGE FROM THE VIRTUAL MACHINE MANAGER WINDOW
2. Choose Run, Pause, or one of the Shutdown options from the pop-up menu.
2. Choose Run, Pause, or one of the Shut Down options either from the toolbar
or from the Virtual Machine menu.
1. Double-click the VM Guest entry in Virtual Machine Manager to open its con-
sole.
3. Choose Boot Options and check Start virtual machine on host boot up.
Start
Pause
Reboot
Graceful shutdown
Force shutdown
When saved, the VM Guest is paused, its current memory state is saved to disk, and
then the guest is stopped. The operation does not make a copy of any portion of the
VM Guest’s virtual disk. The amount of time taken to save the virtual machine de-
pends on the amount of memory allocated. When saved, a VM Guest’s memory is re-
turned to the pool of memory available on the VM Host Server.
The restore operation loads a VM Guest’s previously saved memory state file and
starts it. The guest is not booted but instead resumed at the point where it was pre-
viously saved. The operation is similar to coming out of hibernation.
The VM Guest is saved to a state file. Make sure there is enough space on the parti-
tion you are going to save to. For an estimation of the file size in megabytes to be ex-
pected, issue the following command on the guest:
After using the save operation, do not boot or start the saved VM Guest. Doing so
would cause the machine's virtual disk and the saved memory state to get out of
synchronization. This can result in critical errors when restoring the guest.
To be able to work with a saved VM Guest again, use the restore operation. If you
used virsh to save a VM Guest, you cannot restore it using Virtual Machine
Manager. In this case, make sure to restore using virsh .
Important: Only for VM Guests with Disk Types raw , qcow2 , qed
Saving and restoring VM Guests is only possible if the VM Guest is using a virtual
disk of the type raw ( .img ), qcow2, or qed .
1. Open a VNC connection window to a VM Guest. Make sure the guest is run-
ning.
1. Open a VNC connection window to a VM Guest. Make sure the guest is not
running.
If the VM Guest was previously saved using Virtual Machine Manager, you
will not be offered an option to Run the guest. However, note the caveats on
machines saved with virsh outlined in Warning: Always Restore Saved
Guests.
Note
Snapshots let you restore the state of the machine at a particular point in time. This
is for example useful to undo a faulty configuration or the installation of a lot of
packages. It is also helpful for testing purposes, as it allows you to go back to a de-
fined state at any time.
Snapshots can be taken either from running guests or from a guest currently not
running. Taking a screenshot from a guest that is shut down ensures data integrity.
In case you want to create a snapshot from a running system, be aware that the
snapshot only captures the state of the disk(s), not the state of the memory. There-
fore you need to ensure that:
All running programs have written their data to the disk. If you are unsure,
terminate the application and/or stop the respective service.
Buffers have been written to disk. This can be achieved by running the com-
mand sync on the VM Guest.
Starting a snapshot reverts the machine back to the state it was in when the snap-
shot was taken. Any changes written to the disk after that point in time will be lost
when starting the snapshot.
Starting a snapshot will restore the machine to the state (shut off or running) it was
in when the snapshot was taken. After starting a snapshot that was created while
the VM Guest was shut off, you will need to boot it.
To open the snapshot management view in Virtual Machine Manager, open the VNC
window as described in Section 10.2.1.1, “Opening a Graphical Console with Virtual
Machine Manager”. Now either choose View › Snapshots or click Manage VM Snap-
shots in the toolbar.
The list of existing snapshots for the chosen VM Guest is displayed in the left-hand
part of the window. The snapshot that was last started is marked with a green tick.
The right-hand part of the window shows details of the snapshot currently marked
in the list. These details include the snapshot's title and time stamp, the state of the
VM Guest at the time the snapshot was taken and a description. Snapshots of run-
ning guests also include a screenshot. The Description can be changed directly from
this view. Other snapshot data cannot be changed.
1. Shut down the VM Guest in case you want to create a snapshot from a guest
that is not running.
tux > virsh snapshot-info sles "Basic installation incl. SMT for CLOUD4"
Name: Basic installation incl. SMT for CLOUD4
Domain: admin_server
Current: yes
State: shutoff
Location: internal
Parent: Basic installation incl. SMT for CLOUD3-HA
Children: 0
Descendants: 0
Metadata: yes
To take a snapshot of a running VM Guest, you need to specify the --live parame-
ter:
Refer to the SNAPSHOT COMMANDS section in man 1 virsh for more details.
To start the current snapshot (the one the VM Guest was started off), it is sufficient to
use --current rather than specifying the snapshot name:
You can also permanently delete the guest's virtual disk by activating Delete
Associated Storage Files. The deletion is not recoverable either.
There is no option to automatically delete the attached storage files. If they are man-
aged by libvirt, delete them as described in Section 12.2.4, “Deleting Volumes from a
Storage Pool”.
It is recommended that the source and destination systems have the same
architecture. However, it is possible to migrate between hosts with AMD*
and Intel* architectures.
Storage devices must be accessible from both machines (for example, via
NFS or iSCSI) and must be configured as a storage pool on both machines.
For more information, see Chapter 12, Managing Storage.
This is also true for CD-ROM or floppy images that are connected during the
move. However, you can disconnect them prior to the move as described in
Section 14.8, “Ejecting and Changing Floppy or CD/DVD-ROM Media with Vir-
tual Machine Manager”.
libvirtd needs to run on both VM Host Servers and you must be able to
open a remote libvirt connection between the target and the source host
(or vice versa). Refer to Section 11.3, “Configuring Remote Connections” for
details.
Host and target machine should be in the same subnet on the network, oth-
erwise networking will not work after the migration.
No running or paused VM Guest with the same name must exist on the tar-
get host. If a shut-down machine with the same name exists, its configura-
tion will be overwritten.
All CPU models except host cpu model are supported when migrating VM
Guests.
The VM Host Server and VM Guest need to have proper timekeeping in-
stalled. See Chapter 16, VM Guest Clock Settings.
No physical devices can be passed from host to guest. Live migration is cur-
rently not supported when using devices with PCI pass-through or SR-IOV. In
case live migration needs to be supported, you need to use software virtual-
ization (paravirtualization or full virtualization).
Cache mode setting is an important setting for migration. See: Section 15.5,
“Effect of Cache Modes on Live Migration”.
Backward migration (from SLES 12 SP1 or SP2 to 12 or from SLES SP2 to SP1)
is not supported.
Live migration between SLE 11 and SLE 12 is not supported because of a dif-
ferent tool stack.
The image directory should be located in the same path on both hosts.
2. Right-click the VM Guest that you want to migrate and choose Migrate. Make
sure the guest is running or paused—it is not possible to migrate guests that
are shut down.
3. Choose a New Host for the VM Guest. If the desired target host does not
show up, make sure that you are connected to the host.
To change the default options for connecting to the remote host, under Con-
nection, set the Mode, and the target host's Address (IP address or host
name) and Port. If you specify a Port, you must also specify an Address.
Additionally, there is the option Allow unsafe, which allows migrating without
disabling the cache of the VM Host Server. This can speed up the migration
but only works when the current configuration allows for a consistent view
of the VM Guest storage without using cache="none" / 0_DIRECT .
When the migration is complete, the Migrate window closes and the VM
Guest is now listed on the new host in the Virtual Machine Manager window.
The original VM Guest will still be available on the target host (in shut down
state).
The most important options are listed below. See virsh help migrate for a full
list.
--live
Does a live migration. If not specified, the guest will be paused during the migra-
tion (“offline migration”).
--suspend
Does an offline migration and does not restart the VM Guest on the target host.
--persistent
By default a migrated VM Guest will be migrated temporarily, so its configura-
tion is automatically deleted on the target host if it is shut down. Use this switch
to make the migration persistent.
--undefinesource
When specified, the VM Guest definition on the source host will be deleted after
a successful migration (however, virtual disks attached to this guest will not be
deleted).
To create a permanent copy of a guest on the target host, use the switch
--persistent . A shut down version of the original guest description remains
on the source host, too. Use the option --undefinesource together with
--persistent for a “real” move where a permanent copy is created on the tar-
get host and the version on the source host is deleted.
<pool type='netfs'>
<name>VM</name>
<source>
<host name='10.0.1.99'/>
<dir path='/volume1/VM'/>
<format type='auto'/>
</source>
<target>
<path>/var/lib/libvirt/images/VM</path>
<permissions>
<mode>0755</mode>
<owner>-1</owner>
<group>-1</group>
</permissions>
</target>
</pool>
The following commands assume that you are in the interactive shell of virsh
which can also be reached by using the command virsh without any arguments.
Then the pool can be set to start automatically at host boot (autostart option):
virsh # pool-autostart VM
Pool VM marked as autostarted
-------------------------------------------
default active yes
VM active yes
virsh # pool-info VM
Name: VM
UUID: 42efe1b3-7eaa-4e24-a06a-ba7c9ee29741
State: running
Persistent: yes
Autostart: yes
Capacity: 2,68 TiB
Allocation: 2,38 TiB
Available: 306,05 GiB
Remember: this pool must be defined on each host where you want to be able to
migrate your VM Guest.
The volume names shown will be used later to install the guest with virt-install.
10.8 Monitoring
It is also possible to get information about disk and network usage with this tool,
however, you must first activate this in Preferences:
1. Run virt-manager .
4. Activate the check boxes for the kind of activity you want to see: Poll Disk I/O,
Poll Network I/O, and Poll Memory stats.
5. If desired, also change the update interval using Update status every n sec-
onds.
Afterward, the disk and network statistics are also displayed in the main window of
the Virtual Machine Manager.
More precise data is available from the VNC window. Open a VNC window as de-
scribed in Section 10.2.1, “Opening a Graphical Console”. Choose Details from the
toolbar or the View menu. The statistics are displayed from the Performance entry of
the left-hand tree menu.
By default virt-top shows statistics for all running VM Guests. Among the data
that is displayed is the percentage of memory used ( %MEM ) and CPU ( %CPU ) and the
uptime of the guest ( TIME ). The data is updated regularly (every three seconds by
default). The following shows the output on a VM Host Server with seven VM Guests,
four of them inactive:
By default the output is sorted by ID. Use the following key combinations to change
the sort field:
Shift – P : CPU usage
Shift – M : Total memory allocated by the guest
Shift – T : Time
Shift – I : ID
To use any other field for sorting, press Shift – F and select a field from the list. To
toggle the sort order, use Shift – R .
virt-top also supports different views on the VM Guests data, which can be
changed on-the-fly by pressing the following keys:
0 : default view
1 : show physical CPUs
2 : show network interfaces
3 : show virtual disks
virt-top supports more hot keys to change the view of the data and many com-
mand line switches that affect the behavior of the program. For more information,
see man 1 virt-top .
kvm statistics
efer_reload 0 0
exits 11378946 218130
fpu_reload 62144 152
halt_exits 414866 100
halt_wakeup 260358 50
host_state_reload 539650 249
hypercalls 0 0
insn_emulation 6227331 173067
insn_emulation_fail 0 0
invlpg 227281 47
io_exits 113148 18
irq_exits 168474 127
irq_injections 482804 123
irq_window 51270 18
largepages 0 0
mmio_exits 6925 0
mmu_cache_miss 71820 19
mmu_flooded 35420 9
mmu_pde_zapped 64763 20
mmu_pte_updated 0 0
mmu_pte_write 213782 29
mmu_recycled 0 0
mmu_shadow_zapped 128690 17
mmu_unsync 46 -1
nmi_injections 0 0
nmi_window 0 0
pf_fixed 1553821 857
pf_guest 1018832 562
remote_tlb_flush 174007 37
request_irq 0 0
signal_exits 0 0
tlb_flush 394182 148
Managing several VM Host Servers, each hosting multiple VM Guests, quickly be-
comes difficult. One benefit of libvirt is the ability to connect to several VM Host
Servers at once, providing a single interface to manage all VM Guests and to connect
to their graphical console.
To ensure only authorized users can connect, libvirt offers several connection
types (via TLS, SSH, Unix sockets, and TCP) that can be combined with different au-
thorization mechanisms (socket, PolKit, SASL and Kerberos).
11.1 Authentication
The power to manage VM Guests and to access their graphical console is something
that should be restricted to a well defined circle of persons. To achieve this goal, you
can use the following authentication techniques on the VM Host Server:
Access control for Unix sockets with permissions and group ownership. This
method is available for libvirtd connections only.
Access control for Unix sockets with PolKit. This method is available for local
libvirtd connections only.
When accessing VM Guests from remote via TLS/SSL connections, access can be indi-
rectly controlled on each client by restricting read permissions to the certificate's key
file to a certain group. See Section 11.3.2.5, “Restricting Access (Security Considera-
tions)” for details.
libvirt offers two sockets: a read-only socket for monitoring purposes and a
read-write socket to be used for management operations. Access to both sockets
can be configured independently. By default, both sockets are owned by
root.root . Default access permissions on the read-write socket are restricted to
the user root ( 0700 ) and fully open on the read-only socket ( 0777 ).
In the following instructions, you will learn how to configure access permissions for
the read-write socket. The same instructions also apply to the read-only socket. All
configuration steps need to be carried out on the VM Host Server.
The default authentication method on SUSE Linux Enterprise Server is access con-
trol for Unix sockets. Only the user root may authenticate. When accessing the
libvirt tools as a non-root user directly on the VM Host Server, you need to
provide the root password through PolKit once. You are then granted access for
the current and for future sessions.
1. In case it does not exist, create the group that should own the socket:
groupadd libvirt
The group must exist prior to restarting libvirtd . If not, the restart will
fail.
unix_sock_group = "libvirt" 1
unix_sock_rw_perms = "0770" 2
auth_unix_rw = "none" 3
4. Restart libvirtd :
Authentication with PolKit can only be used for local connections on the VM Host
Server itself, since PolKit does not handle remote authentication.
By default, the policy for accessing the read-write socket is to authenticate with the
root password once and grant the privilege for the current and for future sessions.
To grant users access to a socket without having to provide the root password, you
need to create a rule in /etc/polkit-1/rules.d . Create the file
/etc/polkit-1/rules.d/10-grant-libvirt with the following content to grant
access to the read-write socket to all members of the group libvirt :
polkit.addRule(function(action, subject) {
if (action.id == "org.libvirt.unix.manage" && subject.isInGroup("libvirt")) {
return polkit.Result.YES;
}
});
Access from remote TLS/SSL connections can be indirectly controlled on the client
side by restricting access to the certificate's key file. However, this might prove er-
ror-prone when dealing with many clients. Using SASL with TLS adds security by
additionally controlling access on the server side.
auth_tcp = "sasl"
auth_tls = "sasl"
2. Restart libvirtd :
#mech_list: digest-md5
4. By default, no SASL users are configured, so no logins are possible. Use the
following commands to manage users:
sasldblistusers2 -f /etc/libvirt/passwd.db
When using SASL authentication, you will be prompted for a user name and pass-
word every time you issue a virsh command. Avoid this by using virsh in
shell mode.
In contrast to KVM and LXC, Xen does not yet offer more sophisticated VNC au-
thentication than setting a password on a per VM basis. See the
<graphics type='vnc'... libvirt configuration option below.
Two authentication types are available: SASL and single password authentication. If
you are using SASL for libvirt authentication, it is strongly recommended to use
it for VNC authentication as well—it is possible to share the same database.
A third method to restrict access to the VM Guest is to enable the use of TLS encryp-
tion on the VNC server. This requires the VNC clients to have access to x509 client
certificates. By restricting access to these certificates, access can indirectly be con-
trolled on the client side. Refer to Section 11.3.2.4.2, “VNC over TLS/SSL: Client Con-
figuration” for details.
ln -s /etc/sasl2/libvirt.conf /etc/sasl2/qemu.conf
If are setting up SASL for VNC only or you are planning to use a different
configuration than for libvirt , copy the existing file to use as a template:
cp /etc/sasl2/libvirt.conf /etc/sasl2/qemu.conf
vnc_listen = "0.0.0.0"
vnc_sasl = 1
sasldb_path: /etc/libvirt/qemu_passwd.db
The first parameter enables VNC to listen on all public interfaces (rather than
to the local host only), and the second parameter enables SASL authentica-
tion.
3. By default, no SASL users are configured, so no logins are possible. Use the
following commands to manage users:
sasldblistusers2 -f /etc/libvirt/qemu_passwd.db
4. Restart libvirtd :
5. Restart all VM Guests that have been running prior to changing the configu-
ration. VM Guests that have not been restarted will not use SASL authentica-
tion for VNC connects.
Access to the VNC server may also be controlled by setting a VNC password. You can
either set a global password for all VM Guests or set individual passwords for each
guest. The latter requires to edit the VM Guest's configuration files.
If you are using single password authentication, it is good practice to set a global
password even if setting passwords for each VM Guest. This will always leave your
virtual machines protected with a “fallback” password if you forget to set a
per-machine password. The global password will only be used if no other pass-
word is set for the machine.
vnc_listen = "0.0.0.0"
vnc_password = "PASSWORD"
The first parameter enables VNC to listen on all public interfaces (rather than
to the local host only), and the second parameter sets the password. The
maximum length of the password is eight characters.
2. Restart libvirtd :
3. Restart all VM Guests that have been running prior to changing the configu-
ration. VM Guests that have not been restarted will not use password au-
thentication for VNC connects.
vnc_listen = "0.0.0.0"
3. Search for the element <graphics> with the attribute type='vnc' , for
example:
4. Add the passwd=PASSWORD attribute, save the file and exit the editor. The
maximum length of the password is eight characters.
5. Restart libvirtd :
6. Restart all VM Guests that have been running prior to changing the configu-
ration. VM Guests that have not been restarted will not use password au-
thentication for VNC connects.
The VNC protocol is not considered to be safe. Although the password is sent en-
crypted, it might be vulnerable when an attacker can sniff both the encrypted
password and the encryption key. Therefore, it is recommended to use VNC with
TLS/SSL or tunneled over SSH. virt-viewer , Virtual Machine Manager and
vinagre from version 2.30 onward support both methods.
1 Specify the hypervisor. SUSE Linux Enterprise Server currently supports the
following hypervisors: test (dummy for testing), qemu (KVM), and xen
(Xen). This parameter is mandatory.
2 When connecting to a remote host, specify the protocol here. It can be one of:
ssh (connection via SSH tunnel), tcp (TCP connection with SASL/Kerberos
authentication), tls (TLS/SSL encrypted connection with authentication via
x509 certificates).
3 When connecting to a remote host, specify the user name and the remote
host name. If no user name is specified, the user name that has called the
command ( $USER ) is used. See below for more information. For TLS connec-
tions, the host name needs to be specified exactly as in the x509 certificate.
4 When connecting to the QEMU/KVM hypervisor, two connection types are ac-
cepted: system for full access rights, or session for restricted access. Since
session access is not supported on SUSE Linux Enterprise Server, this docu-
mentation focuses on system access.
qemu:///system or xen:///system
Connect to the QEMU/Xen hypervisor on the local host having full access (type
system).
qemu+ssh://tux@mercury.example.com/system or
xen+ssh://tux@mercury.example.com/system
Connect to the QEMU/Xen hypervisor on the remote host mercury.exam-
ple.com. The connection is established via an SSH tunnel.
qemu+tls://saturn.example.com/system or
xen+tls://saturn.example.com/system
Connect to the QEMU/Xen hypervisor on the remote host mercury.exam-
ple.com. The connection is established using TLS/SSL.
A user name needs to be specified when using Unix socket authentication (re-
gardless of whether using the user/password authentication scheme or PolKit).
This applies to all SSH and local connections.
There is no need to specify a user name when using SASL authentication (for TCP
or TLS connections) or when doing no additional server-side authentication for
TLS connections. With SASL the user name will not be evaluated—you will be
prompted for an SASL user/password combination in any case.
The “system” connection intended for server virtualization has no functional restric-
tions but is, by default, only accessible by root . However, with the addition of the
DAC (Discretionary Access Control) driver to libvirt it is now possible to grant
non-privileged users “system” access. To grant “system” access to the user tux , pro-
ceed as follows:
1. Enable access via Unix sockets as described in Section 11.1.1.1, “Access Con-
trol for Unix Sockets with Permissions and Group Ownership”. In that exam-
ple access to libvirt is granted to all members of the group libvirt and
tux made a member of this group. This ensures that tux can connect us-
ing virsh or Virtual Machine Manager.
user = "tux"
group = "libvirt"
dynamic_ownership = 1
This ensures that the VM Guests are started by tux and that resources
bound to the guest (for example virtual disks) can be accessed and modified
by tux .
4. Restart libvirtd :
All configured connections are displayed in the Virtual Machine Manager main win-
dow. Active connections are marked with a small triangle, which you can click to fold
or unfold the list of VM Guests for this connection.
Inactive connections are listed gray and are marked with Not Connected . Either
double-click or right-click it and choose Connect from the context menu. You can
also Delete an existing connection from this menu.
There is no need to specify a user name for TCP and TLS connections: In
these cases, it will not be evaluated. However, in the case of SSH connec-
tions, specifying a user name is necessary when you want to connect as a
user other than root .
User authentication for SSH connections can be done using traditional file
user/group ownership and permissions as described in Section 11.1.1.1, “Access
Control for Unix Sockets with Permissions and Group Ownership”. Connecting as
user tux ( qemu+ssh://tuxsIVname;/system or
xen+ssh://tuxsIVname;/system ) works out of the box and does not require ad-
ditional configuration on the libvirt side.
If connections are initiated from both computers, each needs to have a client and a
server certificate. This is the case, for example, if you migrate a VM Guest from one
host to another.
Each x509 certificate has a matching private key file. Only the combination of certifi-
cate and private key file can identify itself correctly. To assure that a certificate was is-
sued by the assumed owner, it is signed and issued by a central certificate called cer-
tificate authority (CA). Both the client and the server certificates must be issued by
the same CA.
Using a remote TLS/SSL connection only ensures that two computers are allowed
to communicate in a certain direction. Restricting access to certain users can indi-
rectly be achieved on the client side by restricting access to the certificates. For
more information, see Section 11.3.2.5, “Restricting Access (Security Considera-
tions)”.
libvirt also supports user authentication on the server with SASL. For more
information, see Section 11.3.2.6, “Central User Authentication with SASL for TLS
Sockets”.
The VM Host Server is the machine receiving connections. Therefore, the server cer-
tificates need to be installed. The CA certificate needs to be installed, too. When the
certificates are in place, TLS support can be turned on for libvirt .
1. Create the server certificate and export it together with the CA certificate as
described in Section B.2, “Generating x509 Client/Server Certificates”.
/etc/pki/CA/cacert.pem
/etc/pki/libvirt/servercert.pem
/etc/pki/libvirt/private/serverkey.pem
4. By default, libvirt uses the TCP port 16514 for accepting secure TLS con-
nections. Open this port in the firewall.
If you enable TLS for libvirt , the server certificates need to be in place, other-
wise restarting libvirtd will fail. You also need to restart libvirtd in case
you change the certificates.
1.
Create the client certificate and export it together with the CA certificate as
described in Section B.2, “Generating x509 Client/Server Certificates”.
/etc/pki/CA/cacert.pem
/etc/pki/libvirt/clientcert.pem
/etc/pki/libvirt/private/clientkey.pem
#QEMU/KVM
virsh -c qemu+tls://mercury.example.com/system list --all
#Xen
virsh -c xen+tls://mercury.example.com/system list --all
If your setup is correct, you will see a list of all VM Guests registered with
libvirt on the VM Host Server.
vnc_listen = "0.0.0.0"
vnc_tls = 1
vnc_tls_x509_verify = 1
The VNC TLS setting is only set when starting a VM Guest. Therefore, you
need to restart all machines that have been running prior to making the
configuration change.
System-wide location
/etc/pki/CA/cacert.pem
/etc/pki/libvirt-vnc/clientcert.pem
/etc/pki/libvirt-vnc/private/clientkey.pem
Per-user location
/etc/pki/CA/cacert.pem
~/.pki/libvirt-vnc/clientcert.pem
~/.pki/libvirt-vnc/private/clientkey.pem
virt-viewer
virt-viewer only accepts certificates from a system-wide location:
/etc/pki/CA/cacert.pem
/etc/pki/libvirt-vnc/clientcert.pem
/etc/pki/libvirt-vnc/private/clientkey.pem
Server Certificates
Server certificates need to be readable for QEMU processes. On SUSE Linux
Enterprise Server QEMU, processes started from libvirt tools are owned by
root , so it is sufficient if the root can read the certificates:
To control access to a key file that is available system-wide, restrict read access to
a certain group, so that only members of that group can read the key file. In the
following example, a group libvirt is created, and group ownership of the
clientkey.pem file and its parent directory is set to libvirt . Afterward, the
access permissions are restricted to owner and group. Finally the user tux is
added to the group libvirt , and thus can access the key file.
CERTPATH="/etc/pki/libvirt/"
# create group libvirt
groupadd libvirt
# change ownership to user root and group libvirt
chown root.libvirt $CERTPATH/private $CERTPATH/clientkey.pem
# restrict permissions
chmod 750 $CERTPATH/private
chmod 640 $CERTPATH/private/clientkey.pem
# add user tux to group libvirt
usermod --append --groups libvirt tux
Per-User Certificates
User-specific client certificates for accessing the graphical console of a VM Guest
via VNC need to be placed in the user's home directory in ~/.pki . Contrary to
SSH, for example, the VNC viewer using these certificates do not check the ac-
cess permissions of the private key file. Therefore, it is solely the user's responsi-
bility to make sure the key file is not readable by others.
tls_allowed_dn_list = [
"C=US,L=Provo,O=SUSE Linux Products GmbH,OU=*,CN=venus.example.com,EMAIL=*",
"C=DE,L=Nuremberg,O=SUSE Linux Products GmbH,OU=Documentation,CN=*"]
11.3.2.7 Troubleshooting
ps ax | grep qemu | grep "\-name sles" | awk -F" -vnc " '{ print FS $2 }'
If the output does not begin with a string similar to the following, the machine has
not been started with TLS support and must be restarted.
-vnc 0.0.0.0:0,tls,x509verify=/etc/pki/libvirt
12 Managing Storage
12.1 Managing Storage with Virtual Machine Manager
12.2 Managing Storage with virsh
12.3 Locking Disk Files and Block Devices with virtlockd
12.4 Online Resizing of Guest Block Devices
12.5 Sharing Directories between Host and Guests (File System
Pass-Through)
When managing a VM Guest on the VM Host Server itself, you can access the com-
plete file system of the VM Host Server to attach or create virtual hard disks or to at-
tach existing images to the VM Guest. However, this is not possible when managing
VM Guests from a remote host. For this reason, libvirt supports so called “Stor-
age Pools”, which can be accessed from remote machines.
To be able to access CD/DVD ISO images on the VM Host Server from remote,
they also need to be placed in a storage pool.
Storage Volume
A storage volume is a storage device that can be assigned to a guest—a virtual
disk or a CD/DVD/floppy image. Physically (on the VM Host Server) it can be a
block device (a partition, a logical volume, etc.) or a file.
Storage Pool
A storage pool is a storage resource on the VM Host Server that can be used for
storing volumes, similar to network storage for a desktop machine. Physically it
can be one of the following types:
When the LVM-based pool is deleted in the Storage Manager, the volume
group is deleted as well. This results in a non-recoverable loss of all data
stored on the pool!
To avoid data loss or data corruption, do not attempt to use resources such as
LVM volume groups, iSCSI targets, etc., that are also used to build storage pools
on the VM Host Server. There is no need to connect to these resources from the
VM Host Server or to mount them on the VM Host Server— libvirt takes care
of this.
Do not mount partitions on the VM Host Server by label. Under certain circum-
stances it is possible that a partition is labeled from within a VM Guest with a
name already existing on the VM Host Server.
1. Click Add in the bottom left corner. The dialog Add a New Storage Pool ap-
pears.
3. Specify the required details in the following window. The data that needs to
be entered depends on the type of pool you are creating:
Type dir
Type disk
Target Path: The directory that hosts the devices. The default
value /dev should usually fit.
Build Pool: Activating this option formats the device. Use with
care—all data on the device will be lost!
Type fs
Format: File system format of the device. The default value auto
should work.
Type iscsi
Get the necessary data by running the following command on the VM
Host Server:
It will return a list of iSCSI volumes with the following format. The ele-
ments in bold text are required:
IP_ADDRESS:PORT,TPGT TARGET_NAME_(IQN)
Type logical
Type mpath
Type netfs
Type scsi
Using the file browser by clicking Browse is not possible when operating
from remote.
To start an inactive pool and make it available from remote again, click Start in the
bottom left corner of the Storage Manager.
To permanently make a pool inaccessible, click Delete in the bottom left corner of the
Storage Manager. You may only delete inactive pools. Deleting a pool does not phys-
ically erase its contents on VM Host Server—it only deletes the pool configuration.
However, you need to be extra careful when deleting pools, especially when deleting
LVM volume group-based tools:
Deleting storage pools based on local file system directories, local partitions or
disks has no effect on the availability of volumes from these pools currently at-
tached to VM Guests.
Volumes located in pools of type iSCSI, SCSI, LVM group or Network Exported Di-
rectory will become inaccessible from the VM Guest if the pool is deleted. Al-
though the volumes themselves will not be deleted, the VM Host Server will no
longer have access to the resources.
When deleting an LVM group-based storage pool, the LVM group definition will
be erased and the LVM group will no longer exist on the host system. The config-
uration is not recoverable and all volumes from this pool are lost.
1. A new volume can either be created using the Storage Manager or while
adding a new storage device to a VM Guest. In either case, select a storage
pool from the left panel, then click Create new volume.
Note that SUSE currently only supports raw , qcow2 , or qed images. The
latter option is not available on LVM group-based pools.
Next to Max Capacity, specify the amount maximum size that the disk image
is allowed to reach. Unless you are working with a qcow2 image, you can
also set an amount for Allocation that should be allocated initially. If both
values differ, a sparse image file will be created which grows on demand.
For qcow2 images, you can use a Backing Store (also called “backing file”)
which constitutes a base image. The newly created qcow2 image will then
only record the changes that are made to the base image.
Volumes can be deleted even if they are currently used in an active or inactive VM
Guest. There is no way to recover a deleted volume.
A list of all virsh subcommands for managing pools and volumes is available by
running virsh help pool and virsh help volume , respectively.
List all pools currently active by executing the following command. To also list inac-
tive pools, add the option --all :
Details about a specific pool can be obtained with the pool-info subcommand:
Volumes can only be listed per pool by default. To list all volumes from a pool, enter
the following command.
At the moment virsh offers no tools to show whether a volume is used by a guest
or not. The following procedure describes a way to list volumes from all pools that
are currently used by a VM Guest.
PROCEDURE 12.1: LISTING ALL STORAGE VOLUMES CURRENTLY USED ON A VM HOST SERVER
1. Create an XSLT style sheet by saving the following content to a file, for exam-
ple, ~/libvirt/guest_storage_list.xsl:
2. Run the following commands in a shell. It is assumed that the guest's XML
definitions are all stored in the default location ( /etc/libvirt/qemu ).
xsltproc is provided by the package libxslt .
SSHEET="$HOME/libvirt/guest_storage_list.xsl"
cd /etc/libvirt/qemu
for FILE in *.xml; do
basename $FILE .xml
xsltproc $SSHEET $FILE
done
Use the virsh pool subcommands to start, stop or delete a pool. Replace POOL
with the pool's name or its UUID in the following examples:
Stopping a Pool
Deleting a Pool
Starting a Pool
Only pools that are marked to autostart will automatically be started if the VM
Host Server reboots.
virsh offers two ways to add volumes to storage pools: either from an XML defini-
tion with vol-create and vol-create-from or via command line arguments
with vol-create-as . The first two methods are currently not supported by SUSE,
therefore this section focuses on the subcommand vol-create-as .
--pool is optional. libvirt tries to locate the volume automatically. If that fails,
specify this parameter.
lock_manager = "lockd"
Currently, locking can only be activated globally, so that all virtual disks are
locked. Support for locking selected disks is planned for future releases.
If the disk file paths are not accessible to all hosts, virtlockd can be configured to
allow an “indirect” lockspace. This means that a hash of the disk file path is used to
create a file in the indirect lockspace directory. The locks are then held on these hash
files instead of the actual disk file paths. Indirect lockspace is also useful if the file
system containing the disk files does not support fcntl() locks. An indirect
lockspace is specified with the file_lockspace_dir setting:
file_lockspace_dir = "/MY_LOCKSPACE_DIRECTORY"
lvm_lockspace_dir = "/MY_LOCKSPACE_DIRECTORY"
iscsi_lockspace_dir = "/MY_LOCKSPACE_DIRECTORY"
1. Inside the guest system, check the current size of the disk (for example
/dev/vda ).
2. On the host, resize the logical volume holding the /dev/vda disk of the
guest to the required size, for example 200 GB.
Note that sharing directories between VM Host Server and Windows guests via
File System Pass-Through does not work, because Windows lacks the drivers re-
quired to mount the shared directory.
1. Open the guest's console in Virtual Machine Manager and either choose
View › Details from the menu or click Show virtual hardware details in the
toolbar. Choose Add Hardware › Filesystem to open the Filesystem
Passthrough dialog.
2.
Driver allows you to choose between a Handle or Path base driver. The de-
fault setting is Path. Mode lets you choose the security model, which influ-
ences the way file permissions are set on the host. Three options are avail-
able:
Passthrough (Default)
Files on the file system are directly created with the client-user's creden-
tials. This is very similar to what NFSv3 is using.
Squash
Same as Passthrough, but failure of privileged operations like chown are
ignored. This is required when KVM is not run with root privileges.
Mapped
Files are created with the file server's credentials ( qemu.qemu ). The user
credentials and the client-user's credentials are saved in extended at-
tributes. This model is recommended when host and guest domains
should be kept completely isolated.
3. Specify the path to the directory on the VM Host Server with Source Path. En-
ter a string at Target Path that will be used as a tag to mount the shared di-
rectory. Note that the string of this field is a tag only, not a path on the VM
Guest.
4. Apply the setting. If the VM Guest is currently running, you need to shut it
down to apply the new setting (rebooting the guest is not sufficient).
5. Boot the VM Guest. To mount the shared directory, enter the following com-
mand:
To make the shared directory permanently available, add the following line
to the /etc/fstab file:
13 Managing Networks
Abstract
This chapter introduces common networking configurations supported
by libvirt . It does not depend on the hypervisor used. It is valid for all
hypervisors supported by libvirt , such as KVM or Xen. These setups
can be achieved using both the graphical interface of Virtual Machine
Manager and the command line tool virsh .
There are two common network setups to provide a VM Guest with a network con-
nection:
A network bridge over a host's physical network interface that the guest can
use
Guests inside an isolated virtual network can communicate with each other, but can-
not communicate with guests outside the virtual network. Also, guests not belong-
ing to the isolated virtual network cannot communicate with guests inside.
On the other hand, guests inside a forwarded (NAT, network address translation) vir-
tual network can make any outgoing network connection they request. Incoming
connections are allowed from VM Host Server, and from other guests connected to
the same virtual network. All other incoming connections are blocked by iptables
rules.
A standard libvirt installation on SUSE Linux Enterprise Server already comes with a
predefined virtual network providing DHCP server and network address translation
(NAT) named "default".
2. In the Connection Details window, click the Virtual Networks tab. You can see
the list of all virtual networks available for the current connection. On the
right, there are details of the selected virtual network.
4. Specify a name for the new virtual network and click Forward.
6. libvirt can provide your virtual network with a DHCP server. If you need
it, activate Enable DHCPv4, then type the start and end IP address range of
assignable addresses.
7. To enable static routing for the new virtual network, activate the relevant op-
tion and type the network and gateway addresses.
For forwarded networks, specify the network interface to which the re-
quests will be forwarded, and one of the forwarding modes: While NAT (net-
work address translation) remaps the virtual network address space and al-
lows sharing a single IP address, Routed connects the virtual switch to the
physical host LAN with no network translation.
12. If you did not specify IPv6 network address space definition earlier, you can
enable IPv6 internal routing between virtual machines.
14.
Click Finish to create the new virtual network. On the VM Host Server, a new
virtual network bridge virbrX is available, which corresponds to the newly
created virtual network. You can check with brctl show . libvirt auto-
matically adds iptables rules to allow traffic to/from guests attached to the
new virbr X device.
2. In the Connection Details window, click the Virtual Networks tab. You can see
the list of all virtual networks available for the current connection.
2. In the Connection Details window, click the Virtual Networks tab. You can see
the list of all virtual networks available for the current connection.
2. In the Connection Details window, click the Virtual Networks tab. You can see
the list of all virtual networks available for the current connection.
zypper in libvirt-nss
...
hosts: files libvirt mdns_minimal [NOTFOUND=return] dns
...
Now you can reach the guest system by name from the host.
SYNOPSIS
net-create <file>
DESCRIPTION
Create a network.
OPTIONS
[--file] <string> file containing an XML network description
The vnet_definition.xml XML file includes the definition of the virtual network
that libvirt accepts.
<network>
<name>vnet_nated</name> 1
<bridge name="virbr1" /> 2
<forward mode="nat"/> 3
<ip address="192.168.122.1" netmask="255.255.255.0"> 4
<dhcp>
<range start="192.168.122.2" end="192.168.122.254" /> 5
<host mac="52:54:00:c7:92:da" name="host1.testing.com" \
ip="192.168.1.23.101" /> 6
<host mac="52:54:00:c7:92:db" name="host2.testing.com" \
ip="192.168.1.23.102" />
The following configuration routes traffic from the virtual network to the LAN
without applying any NAT. The IP address range must be preconfigured in the
routing tables of the router on the VM Host Server network.
<network>
<name>vnet_routed</name>
<bridge name="virbr1" />
1 The guest traffic may only go out via the eth1 network device on the VM
Host Server.
<network>
<name>vnet_isolated</name>
<bridge name="virbr3" />
<ip address="192.168.152.1" netmask="255.255.255.0">
<dhcp>
<range start="192.168.152.2" end="192.168.152.254" />
</dhcp>
</ip>
</network>
<network>
<name>host-bridge</name>
<forward mode="bridge"/>
<bridge name="br0"/>
</network>
To print brief information of all virtual interfaces associated with the specified do-
main, run:
To start an inactive network that was already defined, find its name (or unique iden-
tifier, UUID) with:
Then run:
Then run:
If there is a network bridge present on VM Host Server, you can connect a VM Guest
to it directly. This provides the VM Guest with full incoming and outgoing network
access.
3. Select Bridge from the Device Type list and enter the bridge device interface
name in the Configuration Name entry. Proceed with Next.
If you intend to create a virtual bridge that has no connection to a real Eth-
ernet device, use Statically assigned IP Address. In this case, it is a good idea
to use addresses from the private IP address ranges, for example,
192.168.x.x or 10.x.x.x .
To create a bridge that should only serve as a connection between the differ-
ent guests without connection to the host system, set the IP address to
0.0.0.0 and the subnet mask to 255.255.255.255 . The network scripts
handle this special address as an unset IP address.
5. Activate the Bridged Devices tab and activate the network devices you want
to include in the network bridge.
6. Click Next to return to the Overview tab and confirm with OK. The new net-
work bridge should be active on VM Host Server now.
2. Select the bridge device you want to delete from the list in the Overview tab.
1. Log in as root on the VM Host Server where you want to create a new net-
work bridge.
2. Choose a name for the new bridge— virbr_test in our example— and
run
virbr_test is present, but is not associated with any physical network in-
terface.
You can only enslave a network interface that is not yet used by other
network bridge.
1. Log in as root on the VM Host Server where you want to delete an existing
network bridge.
2. List existing network bridges to identify the name of the bridge to remove:
VLAN interfaces are commonly set up on the VM Host Server and either interconnect
the different VM Host Server systems, or they may be set up as a physical interface
to an otherwise virtual-only bridge. It is even possible to create a bridge with a VLAN
as a physical interface that has no IP address in the VM Host Server. That way, the
guest systems have no possibility to access the host over this network.
Run the YaST module System › Network Settings. Follow this procedure to set up the
VLAN device:
3. Change the value of Configuration Name to the ID of your VLAN. Note that
VLAN ID 1 is commonly used for management purposes.
4. Press Next.
5. Select the interface that the VLAN device should connect to below Real Inter-
face for VLAN. If the desired interface does not appear in the list, first set up
this interface without an IP Address.
6. Select the desired method for assigning an IP address to the VLAN device.
It is also possible to use the VLAN interface as a physical interface of a bridge. This
makes it possible to connect several VM Host Server-only networks and allows to
live-migrate VM Guest systems that are connected to such a network.
YaST does not always allow to set no IP address. However, this may be a desired fea-
ture especially if VM Host Server-only networks should be connected. In this case,
use the special address 0.0.0.0 with netmask 255.255.255.255 . The system
scripts handle this address as no IP address set.
The left panel of the window lists VM Guest overview and already installed hard-
ware. After clicking an item in the list, you can access its detailed settings in the de-
tails view. You can change the hardware parameters to match your needs, then click
Apply to confirm them. Some changes take effect immediately, while others need a
reboot of the machine—and virt-manager warns you about that fact.
To remove installed hardware from a VM Guest, select the appropriate list entry in
the left panel and then click Remove in the bottom right of the window.
To add new hardware, click Add Hardware below the left panel, then select the type
of the hardware you want to add in the Add New Virtual Hardware window. Modify
its parameters and confirm with Finish.
The following sections describe configuration options for the specific hardware type
being added. They do not focus on modifying an existing piece of hardware as the
options are identical.
14.1.1 Overview
Overview shows basic details about VM Guest and the hypervisor.
Name, Title, and Description are editable and help you identify VM Guest in the Vir-
tual Machine Manager list of machines.
UUID shows the universally unique identifier of the virtual machine, while Status
shows its current status—Running, Paused, or Shutoff.
The Hypervisor Details section shows the hypervisor type, CPU architecture, used em-
ulator, and chipset type. None of the hypervisor parameters can be changed.
14.1.2 Performance
Performance shows regularly updated charts of CPU and memory usage, and disk
and network I/O.
Not all the charts in the Graph view are enabled by default. To enable these
charts, go to File › View Manager, then select Edit › Preferences › Polling, and check
the charts that you want to see regularly updated.
14.1.3 Processor
Processor includes detailed information about VM Guest processor configuration.
In the CPUs section, you can configure several parameters related to the number of
allocated CPUs.
Current allocation
The number of currently allocated CPUs. You can hotplug more CPUs by increas-
ing this value up to the Maximum allocation value.
Maximum allocation
Maximum number of allocable CPUs for the current session. Any change to this
value will take effect after the next VM Guest reboot.
The Configuration section lets you configure the CPU model and topology.
When activated, the Copy host CPU configuration option uses the host CPU model for
VM Guest. Otherwise you need to specify the CPU model from the drop-down box.
After you activate Manually set CPU topology, you can specify a custom number of
sockets, cores and threads for the CPU.
14.1.4 Memory
Memory contains information about the memory that is available to VM Guest.
Current allocation
The amount of memory currently available to VM Guest. You can hotplug more
memory by increasing this value up to the value of Maximum allocation.
Maximum allocation
The maximum value to which you can hotplug the currently available memory.
Any change to this value will take effect after the next VM Guest reboot.
In the Autostart section, you can specify whether the virtual machine should auto-
matically start during the VM Host Server boot phase.
In the Boot device order, activate the devices that will be used for booting VM Guest.
You can change their order with the up and down arrow buttons on the right side of
the list. To choose from a list of bootable devices on VM Guest start, activate Enable
boot menu.
To boot a different kernel than the one on the boot device, activate Enable direct ker-
nel boot and specify the paths to the alternative kernel and initrd placed on the VM
Host Server file system. You can also specify kernel arguments that will be passed to
the loaded kernel.
14.2 Storage
This section gives you a detailed description of configuration options for storage de-
vices. It includes both hard disks and removable media, such as USB or CD-ROM
drives.
1. Click Add Hardware below the left panel, then select Storage from the Add
New Virtual Hardware window.
2. To create a qcow2 disk image in the default location, activate Create a disk
image for the virtual machine and specify its size in gigabytes.
To gain more control over the disk image creation, activate Select or create
custom storage and click Manage to manage storage pools and images. The
window Choose Storage Volume opens which has almost identical functional-
ity as the Storage tab described in Section 12.1, “Managing Storage with Vir-
tual Machine Manager”.
SUSE only supports the following storage formats: raw , qcow2 , and
qed .
3. After you manage to create and specify the disk image file, specify the Device
type. It can be one of the following options:
Disk device
CDROM device: Does not allow using Create a disk image for the virtual
machine.
Floppy device: Does not allow using Create a disk image for the virtual
machine.
4. Select the Bus type for your device. The list of available options depends on
the device type you selected in the previous step. The types based on VirtIO
use paravirtualized drivers.
5. In the Advanced options section, select the preferred Cache mode. For more
information on cache modes, see Chapter 15, Disk Cache Modes.
6. Confirm your settings with Finish. A new storage device appears in the left
panel.
14.3 Controllers
This section focuses on adding and configuring new controllers.
1. Click Add Hardware below the left panel, then select Controller from the Add
New Virtual Hardware window.
2. Select the type of the controller. You can choose from IDE, Floppy, SCSI, SATA,
VirtIO Serial (paravirtualized), USB, or CCID (smart card devices).
4. Confirm your settings with Finish. A new controller appears in the left panel.
14.4 Networking
This section describes how to add and configure new network devices.
1. Click Add Hardware below the left panel, then select Network from the Add
New Virtual Hardware window.
2. From the Network source list, select the source for the network connection.
The list includes VM Host Server's available physical network interfaces, net-
work bridges, or network bonds. You can also assign the VM Guest to an al-
ready defined virtual network. See Chapter 13, Managing Networks for more
information on setting up virtual networks with Virtual Machine Manager.
3. Specify a MAC address for the network device. While Virtual Machine Man-
ager pre-fills a random value for your convenience, it is recommended to
supply a MAC address appropriate for your network environment to avoid
network conflicts.
4. Select a device model from the list. You can either leave the Hypervisor de-
fault, or specify one of e1000, rtl8139, or virtio models. Note that virtio uses
paravirtualized drivers.
5. Confirm your settings with Finish. A new network device appears in the left
panel.
Adding a tablet has the additional advantage of synchronizing the mouse pointer
movement between VM Host Server and VM Guest when using a graphical environ-
ment on the guest. With no tablet configured on the guest, you will often see two
pointers with one dragging behind the other.
2. Click Add Hardware and choose Input and then EvTouch USB Graphics Tablet
in the pop-up window. Proceed with Finish.
3. If the guest is running, you will be asked whether to enable the tablet after
the next reboot. Confirm with Yes.
4. When you start or restart the VM Guest, the tablet becomes available in the
VM Guest.
6. Reboot the VM Guest to make the new device available. For more
information, see Section 14.8, “Ejecting and Changing Floppy or
CD/DVD-ROM Media with Virtual Machine Manager”.
dd if=/dev/fd0 of=/var/lib/libvirt/images/floppy.img
To create an empty floppy disk image use one of the following commands:
Raw Image
4. Choose Select or create custom storage and click Manage to choose an exist-
ing image from a storage pool. If Virtual Machine Manager was started on
the VM Host Server, alternatively choose an image from another location on
the file system by clicking Browse Local. Select an image and close the file
browser with Choose Volume.
6. Reboot the VM Guest to make the new device available. For more
information, see Section 14.8, “Ejecting and Changing Floppy or
CD/DVD-ROM Media with Virtual Machine Manager”.
2. Choose the Floppy or CD/DVD-ROM device and “eject” the medium by click-
ing Disconnect.
a.
b. If you are using an ISO image, choose ISO image Location and select an
image by clicking Manage. When connecting from a remote host, you
may only choose images from existing storage pools.
4. Click OK to finish. The new media can now be accessed in the VM Guest.
As an example, the following procedure shows how to change this value to the ma-
chine type q35 . q35 is an Intel* chipset. It includes PCIe, supports up to 12 USB
ports, and has support for SATA and IOMMU. IRQ routing has also been improved.
5. Check that the machine type has changed. Log in to the VM Guest as root
and run the following command:
Whenever the QEMU version on the host system is upgraded, for example, when
upgrading the VM Host Server to a new service pack, it is also recommended to
upgrade the machine type of the VM Guests to the latest available version. To
check, use the command qemu-system-x86_64 -M help on the VM Host
Server.
The default machine type pc-i440fx , for example, is regularly updated. If your
VM Guest still runs with a machine type of pc-i440fx-1.x , an update to
pc-i440fx-2.x is strongly recommended. This allows taking advantage of the
most recent updates and corrections in machine definitions, and ensures better
future compatibility.
2. Click Add Hardware and choose the PCI Host Device category in the left panel.
A list of available PCI devices appears in the right part of the window.
3. From the list of available PCI devices, choose the one you want to pass to
the guest. Confirm with Finish.
1. Identify the host PCI device to assign to the guest. In the following example,
we are assigning a DEC network card to the guest:
3. Detach the device from the host system prior to attaching it to VM Guest.
When using a multi-function PCI device that does not support FLR (func-
tion level reset) or PM (power management) reset, you need to detach all
its functions from the VM Host Server. The whole device must be reset for
security reasons. libvirt will refuse to assign the device if one of its
functions is still in use by the VM Host Server or another VM Guest.
4.
Convert the domain, bus, slot, and function value from decimal to hexadeci-
mal, and prefix with 0x to tell the system that the value is hexadecimal. In
our example, domain = 0, bus = 3, slot = 7, and function = 0. Their hexadeci-
mal values are:
This results in domain = 0x0000, bus = 0x03, slot = 0x07 and function =
0x00.
5. Run virsh edit on your domain, and add the following device entry in
the <devices> section using the values from the previous step:
libvirt recognizes two modes for handling PCI devices: they can be ei-
ther managed or unmanaged . In the managed case, libvirt will han-
dle all the details of unbinding the device from the existing driver if
needed, resetting the device, binding it to vfio-pci before starting the
domain, etc. When the domain is terminated or the device is removed
from the domain, libvirt will unbind from vfio-pci and rebind to
the original driver in the case of a managed device. If the device is un-
managed, the user must take care to ensure all of these management as-
pects of the device are done before assigning it to a domain, and after
the device is no longer used by the domain.
In the example above, the managed='yes' option means that the de-
vice is managed. To switch the device mode to unmanaged, set
managed='no' in the listing above. If you do so, you need to take care
of the related driver with the virsh nodedev-detach and
virsh nodedev-reattach commands. That means you need to run
virsh nodedev-detach pci_0000_03_07_0 prior to starting the VM
Guest to detach the device from the host. In case the VM Guest is not run-
ning, you can make the device available for the host by running
virsh nodedev-reattach pci_0000_03_07_0 .
6. Shut down the VM Guest and restart it to make the assigned PCI device avail-
able.
Tip: SELinux
If you are running SELinux on your VM Host Server, you need to disable
it prior to starting the VM Guest with
setsebool -P virt_use_sysfs 1
SR-IOV is an industry specification that was created by the Peripheral Component In-
terconnect Special Interest Group (PCI-SIG) consortium. It introduces physical func-
tions (PF) and virtual functions (VF). PFs are full PCIe functions used to manage and
configure the device. PFs also can move data. VFs lack the configuration and man-
agement part—they only can move data and a reduced set of configuration func-
tions. Since VFs do not have all PCIe functions, the host operating system or the Hy-
pervisor must support SR-IOV to be able to access and initialize VFs. The theoretical
maximum for VFs is 256 per device (consequently the maximum for a dual-port Eth-
ernet card would be 512). In practice this maximum is much lower, since each VF
consumes resources.
14.11.1 Requirements
The following requirements must be met to be able to use SR-IOV:
libvirt-0.9.10 or better
A list of the PCI addresses of the VF(s) that will be assigned to VM Guests
The information whether a device is SR-IOV-capable can be obtained from its PCI
descriptor by running lspci . A device that supports SR-IOV reports a capability
similar to the following:
Before adding an SR-IOV device to a VM Guest when initially setting it up, the VM
Host Server already needs to be configured as described in Section 14.11.2,
“Loading and Configuring the SR-IOV Host Drivers”.
1. Before loading the driver, make sure the card is properly detected by run-
ning lspci . The following example shows the lspci output for the
dual-port Intel 82576NS network card:
In case the card is not detected, it is likely that the hardware virtualization
support in the BIOS/EFI has not been enabled.
2.
If the SR-IOV driver is not yet loaded, the non-SR-IOV driver needs to be re-
moved first, before loading the new driver. Use rmmod to unload a driver.
The following example unloads the non-SR-IOV driver for the Intel 82576NS
network card:
[Unit]
Before=
[Service]
Type=oneshot
RemainAfterExit=true
ExecStart=/bin/bash -c "echo 1 > /sys/bus/pci/devices/0000:06:00.1/sriov_numvfs"
# beware, executable is run directly, not through a shell, check the man pages
# systemd.service and systemd.unit for full syntax
[Install]
# target in which to start the service
WantedBy=multi-user.target
#WantedBy=graphical.target
[Unit]
Description=/etc/init.d/after.local Compatibility
After=libvirtd.service
Requires=libvirtd.service
[Service]
Type=oneshot
ExecStart=/etc/init.d/after.local
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
#! /bin/sh
#
# Copyright (c) 2010 SuSE LINUX Products GmbH, Germany. All rights reserved.
# ...
virsh nodedev-detach pci_0000_06_08_0
5. Reboot the machine and check if the SR-IOV driver is loaded by re-running
the lspci command from the first step of this procedure. If the SR-IOV
driver was loaded successfully you should see additional lines for the VFs:
04:10.2 Ethernet controller: Intel Corporation 82576 Virtual Function (rev 01)
[...]
Note: The following procedure is using example data. Make sure to replace it
by appropriate data from your setup.
1. Use the virsh nodedev-list command to get the PCI address of the VF
you want to assign and its corresponding PF. Numerical values from the
lspci output shown in Section 14.11.2, “Loading and Configuring the
SR-IOV Host Drivers” (for example 01:00.0 or 04:00.1 ) are transformed
by adding the prefix "pci_0000_" and by replacing colons and dots with un-
derscores. So a PCI ID listed as "04:00.0" by lspci is listed as
"pci_0000_04_00_0" by virsh. The following example lists the PCI IDs for the
second port of the Intel 82576NS network card:
The first two entries represent the PFs, whereas the other entries represent
the VFs.
<domain>0</domain>
<bus>4</bus>
<slot>16</slot>
<function>0</function>
<product id='0x10ca'>82576 Virtual Function</product>
<vendor id='0x8086'>Intel Corporation</vendor>
<capability type='phys_function'>
<address domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
</capability>
</capability>
</device>
<domain>0</domain>
<bus>4</bus>
<slot>16</slot>
<function>0</function>
<interface type='hostdev'> 1
<source>
<address type='pci' domain='0' bus='11' slot='16' function='0'2/>
</source>
</interface>
1 VFs do not get a fixed MAC address; it changes every time the host re-
boots. When adding network devices the “traditional” way with <host-
dev>, it would require to reconfigure the VM Guest's network device
after each reboot of the host, because of the MAC address change. To
avoid this kind of problem, libvirt introduced the “interface
type='hostdev'” directive, which sets up network-specific data before
assigning the device.
2 Specify the data you acquired in the previous step here.
--persistent
This option will always add the device to the domain's persistent XML. In
addition, if the domain is running, it will be hotplugged.
--config
This option will only affect the persistent XML, even if the domain is run-
ning. The device will only show up in the guest on next boot.
--live
This option will only affect a running domain. If the domain is inactive,
the operation will fail. The device is not persisted in the XML and will not
be available in the guest on next boot.
--current
This option affects the current state of the domain. If the domain is inac-
tive, the device is added to the persistent XML and will be available on
next boot. If the domain is active, the device is hotplugged but not
added to the persistent XML.
Another approach is to create a libvirt network with a device pool that contains
all the VFs of an SR-IOV device. The guest then references this network, and each
time it is started, a single VF is dynamically allocated to it. When the guest is stopped,
the VF is returned to the pool, available for another guest.
<network>
<name>passthrough</name>
<forward mode='hostdev' managed='yes'>
<pf dev='eth0'/>
</forward>
</network>
To use this network on the host, save the above code to a file, for example
/tmp/passthrough.xml , and execute the following commands. Remember to re-
place eth0 with the real network interface name of your SR-IOV device's PF:
<interface type='network'>
<source network='passthrough'>
</interface>
To verify the list of associated VFs, run virsh net-dumpxml passthrough on the
host after the first guest that uses the network with the pool of VFs starts.
<network connections='1'>
<name>passthrough</name>
<uuid>a6a26429-d483-d4ed-3465-4436ac786437</uuid>
<forward mode='hostdev' managed='yes'>
<pf dev='eth0'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x10' function='0x1'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x10' function='0x3'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x10' function='0x5'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x10' function='0x7'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x11' function='0x1'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x11' function='0x3'/>
<address type='pci' domain='0x0000' bus='0x02' slot='0x11' function='0x5'/>
</forward>
</network>
17 libguestfs
Virtual Machines consist of disk images and definition files. Manually accessing
and manipulating these guest components (outside of normal hypervisor pro-
cesses) is possible, but inherently dangerous and risks compromising data in-
tegrity. libguestfs is a C library and corresponding set of tools designed for safely
accessing and modifying Virtual Machine disk images - outside of normal hyper-
visor processes, but without the risk normally associated with manual editing.
Synchronous write mode may be used, in which write requests are reported
complete only when committed to the storage device.
If a disorderly disconnection between the guest and its storage occurs, the cache
mode in use will affect whether data loss occurs. The cache mode can also affect
disk performance significantly. Additionally, some cache modes are incompatible
with live migration, depending on several factors. There are no simple rules about
what combination of cache mode, disk image format, image placement, or storage
sub-system is best. The user should plan each guest's configuration carefully and ex-
periment with various configurations to determine the optimal performance.
writethrough
This mode causes the hypervisor to interact with the disk image file or block de-
vice with O_DSYNC semantics, where writes are reported as completed only
when the data has been committed to the storage device. The host page cache is
used in what can be termed a writethrough caching mode. The guest's virtual
storage adapter is informed that there is no writeback cache, so the guest would
not need to send down flush commands to manage data integrity. The storage
behaves as if there is a writethrough cache.
writeback
This mode causes the hypervisor to interact with the disk image file or block de-
vice with neither O_DSYNC nor O_DIRECT semantics, so the host page cache is
used and writes are reported to the guest as completed when they are placed in
the host page cache. The normal page cache management will handle commit-
ment to the storage device. Additionally, the guest's virtual storage adapter is in-
formed of the writeback cache, so the guest would be expected to send down
flush commands as needed to manage data integrity. Analogous to a raid con-
troller with RAM cache.
none
This mode causes the hypervisor to interact with the disk image file or block de-
vice with O_DIRECT semantics, so the host page cache is bypassed and I/O hap-
pens directly between the hypervisor user space buffers and the storage device.
Because the actual storage device may report a write as completed when placed
in its write queue only, the guest's virtual storage adapter is informed that there
is a writeback cache. The guest would be expected to send down flush com-
mands as needed to manage data integrity. Performance-wise, it is equivalent to
direct access to your host's disk.
unsafe
This mode is similar to the writeback mode discussed above. The key aspect
of this “unsafe” mode, is that all flush commands from the guests are ignored.
Using this mode implies that the user has accepted the trade-off of performance
over risk of data loss in case of a host failure. Useful, for example, during guest
installation, but not for production workloads.
directsync
This mode causes the hypervisor to interact with the disk image file or block de-
vice with both O_DSYNC and O_DIRECT semantics. This means, writes are re-
ported as completed only when the data has been committed to the storage de-
vice, and when it is also desirable to bypass the host page cache. Like
writethrough, it is helpful to guests that do not send flushes when needed. It
was the last cache mode added, completing the possible combinations of
caching and direct access semantics.
writeback
This mode informs the guest of the presence of a write cache, and relies on the
guest to send flush commands as needed to maintain data integrity within its
disk image. This is a common storage design which is completely accounted for
within modern file systems. But it should be noted that because there is a win-
dow of time between the time a write is reported as completed, and that write
being committed to the storage device, this mode exposes the guest to data loss
in the unlikely case of a host failure.
unsafe
This mode is similar to writeback caching except the guest flush commands are
ignored, nullifying the data integrity control of these flush commands, and re-
sulting in a higher risk of data loss because of host failure. The name “unsafe”
should serve as a warning that there is a much higher potential for data loss be-
cause of a host failure than with the other modes. Note that as the guest termi-
nates, the cached data is flushed at that time.
The choice to make full use of the page cache, or to write through it, or to bypass it
altogether can have dramatic performance implications. Other factors that influence
disk performance include the capabilities of the actual storage system, what disk im-
age format is used, the potential size of the page cache and the IO scheduler used.
Additionally, not flushing the write cache increases performance, but with risk, as
noted above. As a general rule, high-end systems typically perform best with the
cache mode none , because of the reduced data copying that occurs. The potential
benefit of having multiple guests share the common host page cache, the ratio of
reads to writes, and the use of AIO mode native (see below) should also be con-
sidered.
The libvirt management layer includes checks for migration compatibility based
on several factors. If the guest storage is hosted on a clustered file system, is
read-only or is marked shareable, then the cache mode is ignored when determin-
ing if migration can be allowed. Otherwise libvirt will not allow migration unless
the cache mode is set to none . However, this restriction can be overridden with the
“unsafe” option to the migration APIs, which is also supported by virsh , as for ex-
ample in
Tip
The cache mode none is required for the AIO mode setting native . If another
cache mode is used, then the AIO mode will silently be switched back to the de-
fault threads . The guest flush within the host is implemented using
fdatasync() .
It is strongly recommended to ensure the VM Host Server keeps the correct time
as well, for example, by using NTP (see Book “Administration Guide”, Chapter 22
“Time Synchronization with NTP” for more information).
Use the following command inside a VM Guest running Linux to check whether the
driver kvm_clock has been loaded:
To check which clock source is currently used, run the following command in the VM
Guest. It should output kvm-clock :
cat /sys/devices/system/clocksource/clocksource0/current_clocksource
Note
OES 2 NetWare virtual machines manage clock time independently after booting.
They do not synchronize with the host clock time.
If a guest operating system is configured for NTP and the virtual machine's indepen-
dent wallclock setting is disabled, it will still periodically synchronize its time with the
host time. This dual type of configuration can result in time drift between virtual ma-
chines that need to be synchronized. To effectively use an external time source, such
as NTP, for time synchronization on a virtual machine, the virtual machine's indepen-
dent wallclock setting must be enabled (set to 1 ). Otherwise, it will continue to syn-
chronize its time with its host.
cat /proc/sys/xen/independent_wallclock
0 means that the virtual machine is getting its time from the host
and is not using independent wallclock.
xen.independent_wallclock=1
4. Save the file and reboot the virtual machine operating system.
While booting, a virtual machine gets its initial clock time from the host.
Then, if the wallclock setting is set to 1 in the sysctl.conf file, it manages
its clock time independently and does not synchronize with the host clock
time.
xen.independent_wallclock=1
17 libguestfs
Abstract
Virtual Machines consist of disk images and definition files. Manually ac-
cessing and manipulating these guest components (outside of normal hy-
pervisor processes) is possible, but inherently dangerous and risks com-
promising data integrity. libguestfs is a C library and corresponding set of
tools designed for safely accessing and modifying Virtual Machine disk
images - outside of normal hypervisor processes, but without the risk
normally associated with manual editing.
Security: Mounting disk images as loop devices requires root access. While an
image is loop mounted, other users and processes can potentially access the
disk contents.
libguestfs provides many tools designed for accessing and modifying VM Guest disk
images and contents. These tools provide such capabilities as: viewing and editing
files inside guests, scripting changes to VM Guests, monitoring disk used/free statis-
tics, creating guests, doing V2V or P2V migrations, performing backups, cloning VM
Guests, formatting disks, and resizing disks.
You must not use libguestfs tools on live virtual machines. Doing so will probably
result in disk corruption in the VM Guest. libguestfs tools try to stop you from do-
ing this, but cannot catch all cases.
However most command have the --ro (read-only) option. With this option,
you can attach a command to a live virtual machine. The results might be strange
or inconsistent at times but you will not risk disk corruption.
guestfs-data : which contains the appliance files used when launching im-
ages (stored in /usr/lib64/guestfs )
zypper in guestfs-tools
The set of tools found within the guestfs-tools package is used for accessing and
modifying virtual machine disk images. This functionality is provided through a fa-
miliar shell interface with built-in safeguards which ensure image integrity. Guestfs
tools shells expose all capabilities of the guestfs API, and create an appliance on the
fly using the packages installed on the machine and the files found in
/usr/lib4/guestfs .
Xfs
Btrfs
raw
qcow2
Guestfs may also support Windows* file systems (VFAT, NTFS), BSD* and Apple*
file systems, and other disk image formats (VMDK, VHDX...). However, these file
systems and disk image formats are unsupported on SUSE Linux Enterprise.
17.3.3 virt-rescue
virt-rescue is similar to a rescue CD, but for virtual machines, and without the
need for a CD. virt-rescue presents users with a rescue shell and some simple recov-
ery tools which can be used to examine and correct problems within a virtual ma-
chine or disk image.
><rescue>
[ 67.194384] EXT4-fs (sda1): mounting ext3 file system
using the ext4 subsystem
[ 67.199292] EXT4-fs (sda1): mounted filesystem with ordered data
mode. Opts: (null)
mount: /dev/sda1 mounted on /sysroot.
mount: /dev bound on /sysroot/dev.
mount: /dev/pts bound on /sysroot/dev/pts.
mount: /proc bound on /sysroot/proc.
mount: /sys bound on /sysroot/sys.
Directory: /root
Thu Jun 5 13:20:51 UTC 2014
(none):~ #
17.3.4 virt-resize
virt-resize is used to resize a virtual machine disk, making it larger or smaller
overall, and resizing or deleting any partitions contained within.
1. First, with virtual machine powered off, determine the size of the partitions
available on this virtual machine:
**********
Setting up initial partition table on outdisk.img ...
Copying /dev/sda1 ...
◐ 84%
⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒════════
Expanding /dev/sda1 using the 'resize2fs' method ...
5. Bring up the VM Guest using the new disk image and confirm correct opera-
tion before deleting the old image.
17.3.5.1 virt-filesystems
This tool is used to report information regarding file systems, partitions, and logical
volumes in a disk image or virtual machine.
17.3.5.2 virt-ls
virt-ls lists file names, file sizes, checksums, extended attributes and more from
a virtual machine or disk image. Multiple directory names can be given, in which
case the output from each is concatenated. To list directories from a libvirt guest, use
the -d option to specify the name of the guest. For a disk image, use the -a op-
tion.
17.3.5.3 virt-cat
virt-cat is a command line tool to display the contents of a file that exists in the
named virtual machine (or disk image). Multiple file names can be given, in which
case they are concatenated together. Each file name must be a full path, starting at
the root directory (starting with '/').
17.3.5.4 virt-df
virt-df is a command line tool to display free space on virtual machine file sys-
tems. Unlike other tools, it does not just display the size of disk allocated to a virtual
machine, but can look inside disk images to show how much space is actually being
used.
17.3.5.5 virt-edit
virt-edit is a command line tool capable of editing files that reside in the named
virtual machine (or disk image).
17.3.5.6 virt-tar-in/out
virt-tar-in unpacks an uncompressed TAR archive into a virtual machine disk
image or named libvirt domain. virt-tar-out packs a virtual machine disk image
directory into a TAR archive.
17.3.5.7 virt-copy-in/out
virt-copy-in copies files and directories from the local disk into a virtual ma-
chine disk image or named libvirt domain. virt-copy-out copies files and directo-
ries out of a virtual machine disk image or named libvirt domain.
17.3.5.8 virt-log
virt-log shows the log files of the named libvirt domainvirtual machine or disk
image. If the package guestfs-winsupport is installed it can also show the events
log of a Windows virtual machine disk image.
...
17.3.6 guestfish
guestfish is a shell and command line tool for examining and modifying virtual
machine file systems. It uses libguestfs and exposes all of the functionality of the
guestfs API.
Examples of usage:
guestfish
Converting a physical machine into a KVMone is not yet supported in SUSE Linux
Enterprise Server. This feature is released as a technology preview only.
Note
3. Edit the config.xml file in the generated configuration if needed. For ex-
ample, in config.xml adjust the keyboard layout of the live system.
1 The directory where the kiwi configuration was generated in the previ-
ous step.
2 The directory where kiwi will place the generated ISO image and other
intermediary build results.
3 The URLs to the package repositories as found with zypper lr -d .
Use one --add-repo parameter per repository.
5. Burn the ISO on a DVD or a USB stick. With such a medium, boot the ma-
chine to be converted.
6. Once the system is started, you will be asked for the connection details of
the conversion server. This server is a machine with the virt-v2v package
installed.
If the network setup is more complex than a DHCP client, click the Configure
network button to open the YaST network configuration dialog.
Click the Test connection button to allow moving to the next page of the wiz-
ard.
7. Select the disks and network interfaces to be converted and define the VM
data like the amount of allocated CPUs, memory and the Virtual Machine
name.
Note
If not defined, the created disk image format will be raw by default. This
can be changed by entering the desired format in the Output format field.
There are two possibilities to generate the virtual machine: either using the
local or the libvirt output. The first one will place the Virtual Machine disk im-
age and configuration in the path defined in the Output storage field. These
can then be used to define a new libvirt-handled guest using virsh . The
second method will create a new libvirt-handled guest with the disk image
placed in the pool defined in the Output storage field.
17.4 Troubleshooting
This is usually caused by the presence of snapshots in the guests. In this case guestfs
does not know what snapshot to bootstrap. To force the use of a snapshot, use the
-m parameter as following:
17.4.2 Environment
When troubleshooting problems within a libguestfs appliance, the environment vari-
able LIBGUESTFS_DEBUG=1 can be used to enable debug messages. To output each
command/API call in a format that is similar to guestfish commands, use the envi-
ronment variable LIBGUESTFS_TRACE=1.
17.4.3 libguestfs-test-tool
libguestfs-test-tool is a test program that checks if basic libguestfs functional-
ity is working. It will print a large amount of diagnostic messages and details of the
guestfs environment, then create a test image and try to start it. If it runs to comple-
tion successfully, the following message should be seen near the end:
libguestfs FAQ↗
This section documents how to set up and use SUSE Linux Enterprise Server 12
SP2 as a virtual machine host.
19 Virtual Networking
A VM Guest system needs some means to communicate either with other VM
Guest systems or with a local network. The network interface to the VM Guest
system is made of a split device driver, which means that any virtual Ethernet de-
vice has a corresponding network interface in Dom0. This interface is s…
23 Administrative Tasks
This section documents how to set up and use SUSE Linux Enterprise Server 12 SP2
as a virtual machine host.
Usually, the hardware requirements for the Dom0 are the same as those for the
SUSE Linux Enterprise Server operating system, but additional CPU, disk, memory,
and network resources should be added to accommodate the resource demands of
all planned VM Guest systems.
Tip: Resources
Remember that VM Guest systems, like physical machines, perform better when
they run on faster processors and have access to more system memory.
The virtual machine host requires several software packages and their dependencies
to be installed. To install all necessary packages, run YaST Software Management, se-
lect View › Patterns and choose Xen Virtual Machine Host Server for installation. The in-
stallation can also be performed with YaST using the module Virtualization › Install
Hypervisor and Tools.
After the Xen software is installed, restart the computer and, on the boot screen,
choose the newly added option with the Xen kernel.
Updates are available through your update channel. To be sure to have the latest
updates installed, run YaST Online Update after the installation has finished.
If the host should always run as Xen host, run YaST System › Boot Loader and
activate the Xen boot entry as default boot section.
Change the default boot to the Xen label, then click Set as Default.
Click Finish.
For best performance, only the applications and processes required for vir-
tualization should be installed on the virtual machine host.
When using both iSCSI and OCFS2 to host Xen images, the latency required
for OCFS2 default timeouts in SUSE Linux Enterprise Server 12 may not be
met. To reconfigure this timeout, run systemctl configure o2cb or edit
O2CB_HEARTBEAT_THRESHOLD in the system configuration.
If you intend to use a watchdog device attached to the Xen host, use only
one at a time. It is recommended to use a driver with actual hardware inte-
gration over a generic software one.
The Dom0 Kernel is running virtualized, so tools like irqbalance or lscpu will
not reflect the real hardware characteristics.
A better solution is to set a default amount of memory for Dom0, so the memory
can be allocated appropriately to the hypervisor. An adequate amount would be 20
percent of the total system memory up to 4 GiB. A recommended minimum amount
would be 512 MiB
The minimum amount of memory heavily depends on how many VM Guest(s) the
host should handle. So be sure you have enough memory to support all your VM
Guests. If the value is too low, the host system may hang when multiple VM
Guests use most of the memory.
When using the XL tool stack and the dom0_mem= option for the Xen hypervisor
in GRUB 2 you need to disable xl autoballoon in etc/xen/xl.conf , otherwise
launching VMs will fail with errors about not being able to balloon down Dom0.
So add autoballoon=0 to xl.conf if you have the dom0_mem= option specified
for Xen. Also see Xen dom0 memory↗
When using SUSE Linux Enterprise, only the paravirtualized network cards are avail-
able for the VM Guest by default. The following network options are available:
emulated
vif = [ 'type=ioemu,mac=00:16:3e:5f:48:e4,bridge=br0' ]
Find more details about the xl configuration in the xl.conf manual page
man 5 xl.conf .
paravirtualized
When you specify type=vif and do not specify a model or type, the paravirtu-
alized network interface is used:
vif = [ 'type=vif,mac=00:16:3e:5f:48:e4,bridge=br0,backen=0' ]
vif = [ 'type=ioemu,mac=00:16:3e:5f:48:e4,model=rtl8139,bridge=br0' ]
In this case, one of the network interfaces should be disabled on the VM Guest.
In Xen, the hypervisor manages the memory resource. If you need to reserve sys-
tem memory for a recovery kernel in Dom0, this memory need to be reserved by
the hypervisor. Thus, it is necessary to add the parameter crashkernel=size
to the kernel line instead of using the line with the other boot options.
For more information on the crashkernel parameter, see Book “System Analysis
and Tuning Guide”, Chapter 17 “Kexec and Kdump”, Section 17.4 “Calculating
crashkernel Allocation Size”.
If the Xen option is not on the GRUB 2 menu, review the steps for installation and
verify that the GRUB 2 boot loader has been updated. If the installation has been
done without selecting the Xen pattern, run the YaST Software Management, select
the filter Patterns and choose Xen Virtual Machine Host Server for installation.
After booting the hypervisor, the Dom0 virtual machine starts and displays its
graphical desktop environment. If you did not install a graphical desktop, the com-
mand line environment appears.
Sometimes it may happen that the graphics system does not work properly. In
this case, add vga=ask to the boot parameters. To activate permanent settings,
use vga=mode-0x??? where ??? is calculated as 0x100 + VESA mode from
http://en.wikipedia.org/wiki/VESA_BIOS_Extensions↗, for example
vga=mode-0x361 .
Before starting to install virtual guests, make sure that the system time is correct. To
do this, configure NTP (Network Time Protocol) on the controlling domain:
2. Select the option to automatically start the NTP daemon during boot. Pro-
vide the IP address of an existing NTP time server, then click Finish.
Hardware clocks commonly are not very precise. All modern operating systems
try to correct the system time compared to the hardware time by means of an ad-
ditional time source. To get the correct time on all VM Guest systems, also activate
the network time services on each respective guest or make sure that the guest
uses the system time of the host. For more about Independent Wallclocks in
SUSE Linux Enterprise Server see Section 16.2, “Xen Virtual Machine Clock Set-
tings”.
For more information about managing virtual machines, see Chapter 20, Managing a
Virtualization Environment.
This feature is available from both AMD* and Intel*. For AMD machines, the feature
is called IOMMU; in Intel speak, this is VT-d. Note that Intel-VT technology is not suffi-
cient to use this feature for fully virtualized guests. To make sure that your computer
supports this feature, ask your supplier specifically to deliver a system that supports
PCI Pass-Through.
LIMITATIONS
Some graphics drivers use highly optimized ways to access DMA. This is not
supported, and thus using graphics cards may be difficult.
When accessing PCI devices behind a PCIe bridge, all of the PCI devices must
be assigned to a single guest. This limitation does not apply to PCIe devices.
Guests with dedicated PCI devices cannot be migrated live to a different host.
The configuration of PCI Pass-Through is twofold. First, the hypervisor must be in-
formed at boot time that a PCI device should be available for reassigning. Second,
the PCI device must be assigned to the VM Guest.
4. Add the PCI number to the Optional Kernel Command Line Parameter line:
pciback.hide=(06:01.0)
7. Check if the device is in the list of assignable devices with the command
xl pci-assignable-list
Begin by making sure that dom0 has the pciback module loaded:
modprobe pciback
xl pci-assignable-add 06:01.0
pci=['06:01.0']
pci = [ '06:01.0,power_mgmt=1,permissive=1' ]
After assigning the PCI device to the VM Guest, the guest system must care for the
configuration and device drivers for this device.
Xen 4.0 and newer supports VGA graphics adapter pass-through on fully virtualized
VM Guests. The guest can take full control of the graphics adapter with high-perfor-
mance full 3D and video acceleration.
LIMITATIONS
VGA Pass-Through functionality is similar to PCI Pass-Through and as such
also requires IOMMU (or Intel VT-d) support from the mainboard chipset and
BIOS.
Only the primary graphics adapter (the one that is used when you power on
the computer) can be used with VGA Pass-Through.
The graphics card cannot be shared between multiple VM Guests using VGA
Pass-Through — you can dedicate it to one guest only.
To enable VGA Pass-Through, add the following settings to your fully virtualized
guest configuration file:
gfx_passthru=1
pci=['yy:zz.n']
where yy:zz.n is the PCI controller ID of the VGA graphics adapter as found with
lspci -v on Dom0.
18.5.4 Troubleshooting
In some circumstances, problems may occur during the installation of the VM Guest.
This section describes some known problems and their solutions.
kernel: PCI-DMA: Out of SW-IOMMU space for 32768 bytes at device 000:01:02.0
In this case you need to increase the size of the swiotlb . Add swiotlb=128
on the cmdline of Dom0. Note that the number can be adjusted up or down to
find the optimal size for the machine.
The swiotlb=force kernel parameter is required for DMA access to work for
PCI devices on a PV guest. For more information about IOMMU and the
swiotlb option see the file boot-options.txt from the package
kernel-source .
http://wiki.xensource.com/xenwiki/VTdHowTo↗
http://software.intel.com/en-us/articles/intel-virtualization-technology-
for-directed-io-vt-d-enhancing-intel-platforms-for-efficient-virtualization-
of-io-devices/↗
http://support.amd.com/TechDocs/48882_IOMMU.pdf↗
PVUSB uses a paravirtualized front- and back-end interface. PVUSB supports USB
1.1 and USB 2.0, and it works for both, PV and HVM guests. In order to use PVUSB,
you need usbfront in your guest OS, and usbback in dom0 or usb backend in qemu.
With SUSE Linux Enterprise Server, usb backend comes with qemu.
root # lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 003: ID 0461:4d15 Primax Electronics, Ltd Dell Optical Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
To pass through the Dell mouse, for instance, specify either 0461:4d15 or 2.3 (you
must remove leading zeros, otherwise xl would interpret the numbers as octal val-
ues).
In the configuration file, specify USB controllers and USB host devices with
usbctrl and usbdev . For example, in case of HVM guests:
usbctrl=['type=qubs,version=2,ports=4', 'type=qubs,version=1,ports=4', ]
usbdev=['hostbus=2, hostaddr=1, controller=0,port=1', ]
Note
Create a USB controller which is version USB 1.1 and has 8 ports:
Find the first available controller:port in the domain, and attach USB device whose
busnum:devnum is 2:3 to it; you can also specify controller and port :
Remove the USB controller with the indicated dev_id , and all USB devices under it:
19 Virtual Networking
19.1 Network Devices for Guest Systems
19.2 Host-Based Routing in Xen
19.3 Creating a Masqueraded Network Setup
19.4 Special Configurations
A VM Guest system needs some means to communicate either with other VM Guest
systems or with a local network. The network interface to the VM Guest system is
made of a split device driver, which means that any virtual Ethernet device has a cor-
responding network interface in Dom0. This interface is set up to access a virtual
network that is run in Dom0. The bridged virtual network is fully integrated into the
system configuration of SUSE Linux Enterprise Server and can be configured with
YaST.
When installing a Xen VM Host Server, a bridged network configuration will be pro-
posed during normal network configuration. The user can choose to change the
configuration during the installation and customize it to the local needs.
If desired, Xen VM Host Server can be installed after performing a default Physical
Server installation using the Install Hypervisor and Tools module in YaST.
This module will prepare the system for hosting virtual machines, including invoca-
tion of the default bridge networking proposal.
In case the necessary packages for a Xen VM Host Server are installed manually with
rpm or zypper , the remaining system configuration needs to be done by the ad-
ministrator manually or with YaST.
The network scripts that are provided by Xen are not used by default in SUSE Linux
Enterprise Server. They are only delivered for reference but disabled. The network
configuration that is used in SUSE Linux Enterprise Server is done by means of the
YaST system configuration similar to the configuration of network interfaces in SUSE
Linux Enterprise Server.
For more general information about managing network bridges, see Section 13.2,
“Bridged Networking”.
Systems that are not aware of paravirtualized hardware may not have this option. To
connect systems to a network that can only run fully virtualized, several emulated
network interfaces are available. The following emulations are at your disposal:
NE2000 (PCI)
NE2000 (ISA)
All these network interfaces are software interfaces. Because every network inter-
face must have a unique MAC address, an address range has been assigned to Xen-
source that can be used by these interfaces.
For example, if you want to know the device name for the third interface (eth2) of
the VM Guest with id 5, the device in Dom0 would be vif5.2 . To obtain a list of all
available interfaces, run the command ip a .
The device naming does not contain any information about which bridge this inter-
face is connected to. However, this information is available in Dom0. To get an over-
view about which interface is connected to which bridge, run the command
brctl show . The output may look like the following:
# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.001cc0309083 no eth0
vif2.1
br1 8000.000476f060cc no eth1
vif2.0
br2 8000.000000000000 no
In this example, there are three configured bridges: br0 , br1 and br2 . Currently,
br0 and br1 each have a real Ethernet device added: eth0 and eth1 , respec-
tively. There is one VM Guest running with the ID 2 that has two Ethernet devices
available. eth0 on the VM Guest is bridged with eth1 on the VM Host Server and
eth1 on the VM Guest is connected to eth0 on the VM Host Server. The third bridge
with the name br2 is not connected to any VM Guest nor any real Ethernet device.
Xen can be set up to use host-based routing in the controlling Dom0. Unfortunately,
this is not yet well supported from YaST and requires quite an amount of manual
editing of configuration files. Thus, this is a task that requires an advanced adminis-
trator.
The following configuration will only work when using fixed IP addresses. Using
DHCP is not practicable with this procedure, because the IP address must be known
to both, the VM Guest and the VM Host Server system.
The easiest way to create a routed guest is to change the networking from a bridged
to a routed network. As a requirement to the following procedures, a VM Guest with
a bridged network setup must be installed. For example, the VM Host Server is
named earth with the IP 192.168.1.20, and the VM Guest has the name alice with the
IP 192.168.1.21.
1. Make sure that alice is shut down. Use xl commands to shut down and
check.
a. Create a hotplug interface that will be used to route the traffic. To ac-
complish this, create a file named
/etc/sysconfig/network/ifcfg-alice.0 with the following con-
tent:
FW_DEV_EXT="br0 alice.0"
FW_ROUTE="yes"
FW_FORWARD="192.168.1.21/32,0/0"
c. Add a static route to the interface of alice. To accomplish this, add the
following line to the end of /etc/sysconfig/network/routes :
192.168.1.21 - - alice.0
d. To make sure that the switches and routers that the VM Host Server is
connected to know about the routed interface, activate proxy_arp
on earth. Add the following lines to /etc/sysctl.conf :
net.ipv4.conf.default.proxy_arp = 1
net.ipv4.conf.all.proxy_arp = 1
bridge=br0
vifname=vifalice.0
or
vifname=vifalice.0=emu
c. Change the script that is used to set up the interface to the following:
script=/etc/xen/scripts/vif-route-ifup
c.
192.168.1.20 - - eth0
default 192.168.1.20 - -
5. Finally, test the network connection from the VM Guest to the world outside
and from the network to your VM Guest.
a. Create a hotplug interface that will be used to route the traffic. To ac-
complish this, create a file named
/etc/sysconfig/network/ifcfg-dolly.0 with the following con-
tent:
FW_DEV_DMZ="dolly.0"
FW_ROUTE="yes"
FW_MASQUERADE="yes"
FW_MASQ_NETS="192.168.100.1/32"
FW_NOMASQ_NETS=""
c. Add a static route to the interface of dolly. To accomplish this, add the
following line to the end of /etc/sysconfig/network/routes :
192.168.100.1 - - dolly.0
bridge=br0
vifname=vifdolly.0
d. Change the script that is used to set up the interface to the following:
script=/etc/xen/scripts/vif-route-ifup
192.168.1.20 - - eth0
default 192.168.1.20 - -
5. Finally, test the network connection from the VM Guest to the outside world.
In the configuration file, first search for the device that is connected to the virtual
bridge. The configuration looks like the following:
vif = [ 'mac=00:16:3e:4f:94:a9,bridge=br0' ]
To add a maximum transfer rate, add a parameter rate to this configuration as in:
vif = [ 'mac=00:16:3e:4f:94:a9,bridge=br0,rate=100Mb/s' ]
Note that the rate is either Mb/s (megabits per second) or MB/s (megabytes per
second). In the above example, the maximum transfer rate of the virtual interface is
100 megabits. By default, there is no limitation to the bandwidth of a guest to the
virtual bridge.
It is even possible to fine-tune the behavior by specifying the time window that is
used to define the granularity of the credit replenishment:
vif = [ 'mac=00:16:3e:4f:94:a9,bridge=br0,rate=100Mb/s@20ms' ]
To monitor the traffic on a specific interface, the little application iftop is a nice
program that displays the current network traffic in a terminal.
When running a Xen VM Host Server, you need to define the interface that is moni-
tored. The interface that Dom0 uses to get access to the physical network is the
bridge device, for example br0 . This, however, may vary on your system. To moni-
tor all traffic to the physical interface, run a terminal as root and use the com-
mand:
iftop -i br0
ftop -i vif5.0
To quit iftop , press the key Q . More options and possibilities are available in the
manual page man 8 iftop .
20 Managing a Virtualization
Environment
20.1 XL—Xen Management Tool
20.2 Automatic Start of Guest Domains
20.3 Event Actions
20.4 Time Stamp Counter
20.5 Saving Virtual Machines
20.6 Restoring Virtual Machines
20.7 Virtual Machine States
Apart from using the recommended libvirt library (Part II, “Managing Virtual Ma-
chines with libvirt ”), you can manage Xen guest domains with the xl tool from
the command line.
Note
xl can only manage running guest domains specified by their configuration file.
If a guest domain is not running, you cannot manage it with xl .
Tip
To allow users to continue to have managed guest domains in the way the obso-
lete xm command allowed, we now recommend using libvirt 's virsh and
virt-manager tools. For more information, see Part II, “Managing Virtual Ma-
chines with libvirt ”.
xl operations rely upon xenstored and xenconsoled services. Make sure you
start
In the most common network configuration, you need to set up a bridge in the
host domain named xenbr0 to have a working network for the guest domains.
For a complete list of the available xl subcommands, run xl help . For each com-
mand, there is a more detailed help available that is obtained with the extra parame-
ter --help . More information about the respective subcommands is available in
the manual page of xl .
For example, the xl list --help displays all options that are available to the list
command. As an example, the xl list command displays the status of all virtual
machines.
# xl list
Name ID Mem VCPUs State Time(s)
Domain-0 0 457 2 r----- 2712.9
sles12 7 512 1 -b---- 16.3
opensuse 512 1 12.9
The State information indicates if a machine is running, and in which state it is. The
most common flags are r (running) and b (blocked) where blocked means it is ei-
ther waiting for IO, or sleeping because there is nothing to do. For more details
about the state flags, see man 1 xl .
A domain configuration file is a plain text file. It consists of several key = value
pairs. Some keys are mandatory, some are general and apply to any guest, and
some apply only to a specific guest type (para or fully virtualized). A value can either
be a "string" surrounded by single or double quotes, a number, a boolean value,
or a list of several values enclosed in brackets [ value1, value2, ... ] .
name= "sled12"
builder = "hvm"
vncviewer = 1
memory = 512
1. Create the domain configuration file if it does not exist, and save it in the
/etc/xen/ directory, for example /etc/xen/domain_name.cfg .
2. Make a symbolic link of the guest domain configuration file in the auto/
subdirectory.
ln -s /etc/xen/domain_name.cfg /etc/xen/auto/domain_name.cfg
on_poweroff="restart"
LIST OF EVENTS
on_poweroff
Specifies what should be done with the domain if it shuts itself down.
on_reboot
Action to take if the domain shuts down with a reason code requesting a reboot.
on_watchdog
Action to take if the domain shuts down because of a Xen watchdog timeout.
on_crash
Action to take if the domain crashes.
For these events, you can define one of the following actions:
restart
Destroy the domain and immediately create a new domain with the same con-
figuration.
rename-restart
Rename the domain that terminated, and then immediately create a new do-
main with the same configuration as the original.
preserve
Keep the domain. It can be examined, and later destroyed with xl destroy .
coredump-destroy
Write a core dump of the domain to /var/xen/dump/NAME and then destroy
the domain.
coredump-restart
Write a core dump of the domain to /var/xen/dump/NAME and then restart
the domain.
With the tsc_mode setting, you specify whether rdtsc instructions are executed “na-
tively ” (fast, but TSC-sensitive applications may sometimes run incorrectly) or emu-
lated (always run correctly, but performance may suffer).
tsc_mode=0 (default)
Use this to ensure correctness while providing the best performance possi-
ble—for more information, see https://xenbits.xen.org/docs/4.3-testing
/misc/tscmode.txt↗.
tsc_mode=3 (PVRDTSCP)
High-TSC-frequency applications may be paravirtualized (modified) to obtain
both correctness and highest performance—any unmodified applications must
be TSC-resilient.
xl save ID state-file
1.
Make sure the virtual machine to be restored has not been started since you
ran the save operation.
xl restore state-file
b - blocked - The virtual machine’s processor is not running and not able to
run. It is either waiting for I/O or has stopped working.
p - paused - The virtual machine is paused. It does not interact with the hy-
pervisor but still maintains its allocated resources, such as memory.
disk = [ 'format=raw,vdev=hdc,access=ro,devtype=cdrom,target=/root/image.iso' ]
It defines a disk block device based on the /root/image.iso disk image file. The
disk will be seen as hdc by the guest, with read-only ( ro ) access. The type of the
device is cdrom with raw format.
The following example defines an identical device, but using simplified positional
syntax:
disk = [ '/root/image.iso,raw,hdc,ro,cdrom' ]
You can include more disk definitions in the same line, each one separated by a
comma. If a parameter is not specified, then its default value is taken:
disk = [ '/root/image.iso,raw,hdc,ro,cdrom','/dev/vg/guest-volume,,hda','...' ]
LIST OF PARAMETERS
target
Source block device or disk image file path.
format
The format of the image file. Default is raw .
vdev
Virtual device as seen by the guest. Supported values are hd[x], xvd[x], sd[x] etc.
See /usr/share/doc/packages/xen/misc/vbd-interface.txt for more
details. This parameter is mandatory.
access
Whether the block device is provided to the guest in read-only or read-write
mode. Supported values are ro or r for read-only, and rw or w for
read/write access. Default is ro for devtype=cdrom , and rw for other device
types.
devtype
Qualifies virtual device type. Supported value is cdrom .
backendtype
The back-end implementation to use. Supported values are phy , tap , and
qdisk . Normally this option should not be specified as the back-end type is au-
tomatically determined.
script
Specifies that target is not a normal host path, but rather information to be
interpreted by the executable program. The specified script file is looked for in
/etc/xen/scripts if it does not point to an absolute path. These scripts are
normally called block-<script_name> .
The following example shows mapping of an RBD (RADOS Block Device) disk with
multiple Ceph monitors and cephx authentication enabled:
Devices
When a virtual machine is running, each of its file-backed virtual disks consumes a
loopback device on the host. By default, the host allows up to 64 loopback devices
to be consumed.
To simultaneously run more file-backed virtual disks on a host, you can increase the
number of available loopback devices by adding the following option to the host’s
/etc/modprobe.conf.local file.
Tip
Enter rmmod loop and modprobe loop to unload and reload the module. In
case rmmod does not work, unmount all existing loop devices or reboot the com-
puter.
Use a block device that may be increased in size. LVM devices and file system
images are commonly used.
Do not partition the device inside the VM Guest, but use the main device di-
rectly to apply the file system. For example, use /dev/xvdb directly instead
of adding partitions to /dev/xvdb .
Make sure that the file system to be used can be resized. Sometimes, for ex-
ample with Ext3, some features must be switched off to be able to resize the
file system. A file system that can be resized online and mounted is XFS . Use
the command xfs_growfs to resize that file system after the underlying
block device has been increased in size. For more information about XFS ,
see man 8 xfs_growfs .
When resizing an LVM device that is assigned to a VM Guest, the new size is automat-
ically known to the VM Guest. No further action is needed to inform the VM Guest
about the new size of the block device.
When using file system images, a loop device is used to attach the image file to the
guest. For more information about resizing that image and refreshing the size infor-
mation for the VM Guest, see Section 23.2, “Sparse Image Files and Disk Space”.
block-dmmd
block-drbd-probe
block-npiv
The scripts allow for external commands to perform some action, or series of ac-
tions of the block devices prior to serving them up to a guest.
These scripts could formerly only be used with xl or libxl using the disk config-
uration syntax script= . They can now be used with libvirt by specifying the base
name of the block script in the <source> element of the disk. For example:
<source dev='dmmd:md;/dev/md0;lvm;/dev/vgxen/lv-vm01'/>
22 Virtualization: Configuration
Options and Settings
22.1 Virtual CD Readers
The documentation in this section, describes advanced management tasks and con-
figuration options that might help technology innovators implement leading-edge
virtualization solutions. It is provided as a courtesy and does not imply that all docu-
mented options and tasks are supported by Novell, Inc.
Paravirtualized guests can use the device type devtype=cdrom . This partly emu-
lates the behavior of a real CD reader, and allows CDs to be changed. It is even pos-
sible to use the eject command to open the tray of the CD reader.
A fully virtual machine can have up to four block devices composed of virtual CD
readers and virtual disks. A virtual CD reader on a fully virtual machine interacts with
an inserted CD in the way you would expect a physical CD reader to interact. For ex-
ample, in a Windows* XP* virtual machine, the inserted CD appears in the
Devices with Removable Storage section of My Computer .
When a CD is inserted in the physical CD reader on the host computer, all virtual
machines with virtual CD readers based on the physical CD reader, such as
/dev/cdrom/ , can read the inserted CD. Assuming the operating system has auto-
mount functionality, the CD should automatically appear in the file system. Virtual
CD readers cannot be used to write data to a CD. They are configured as read-only
devices.
1. Make sure that the virtual machine is running and the operating system has
finished booting.
2. Insert the desired CD into the physical CD reader or copy the desired ISO
image to a location available to Dom0.
4. Choose the CD reader or ISO image that you want to assign to the guest.
5. When using a real CD reader, use the following command to assign the CD
reader to your VM Guest. In this example, the name of the guest is alice:
/dev/xvdb
b. Enter the command to mount the CD or ISO image using its drive des-
ignation. For example,
2. If the virtual CD reader is mounted, unmount it from within the virtual ma-
chine.
3. Enter xl block-list alice on the host view of the guest block devices.
Text Only
You can use the ssh command from a remote computer to log in to a virtual
machine host and access its text-based console. You can then use the xl com-
mand to manage virtual machines, and the virt-install command to create
new virtual machines.
You can use the IP address of a VM Host Server and a VNC viewer to view the display
of this VM Guest. When a virtual machine is running, the VNC server on the host as-
signs the virtual machine a port number to be used for VNC viewer connections. The
assigned port number is the lowest port number available when the virtual machine
starts. The number is only available for the virtual machine while it is running. After
shutting down, the port number might be assigned to other virtual machines.
For example, if ports 1 and 2 and 4 and 5 are assigned to the running virtual ma-
chines, the VNC viewer assigns the lowest available port number, 3. If port number 3
is still in use the next time the virtual machine starts, the VNC server assigns a differ-
ent port number to the virtual machine.
To use the VNC viewer from a remote computer, the firewall must permit access to
as many ports as VM Guest systems run from. This means from port 5900 and up.
For example, to run 10 VM Guest systems, you need to open the TCP ports
5900:5910.
To access the virtual machine from the local console running a VNC viewer client, en-
ter one of the following commands:
vncviewer ::590#
vncviewer :#
When accessing the VM Guest from a machine other than Dom0, use the following
syntax:
vncviewer 192.168.1.20::590#
To assign a specific port number on a VM Guest, edit the xl setting of the virtual ma-
chine and change the vnclisten to the desired value. Note that for example for
port number 5902, specify 2 only, as 5900 is added automatically:
vfb = [ 'vnc=1,vnclisten="localhost:2"' ]
For more information regarding editing the xl settings of a guest domain, see Sec-
tion 20.1, “XL—Xen Management Tool”.
Tip
Assign higher port numbers to avoid conflict with port numbers assigned by the
VNC viewer, which uses the lowest available port number.
To set the default to use SDL instead of VNC, change the virtual machine's configura-
tion information to the following. For instructions, see Section 20.1, “XL—Xen Man-
agement Tool”.
vfb = [ 'sdl=1' ]
Remember that, unlike a VNC viewer window, closing an SDL window terminates the
virtual machine.
To view a virtual machine's current keymap entry, enter the following command on
the Dom0:
vfb = [ 'keymap="de"' ]
For a complete list of supported keyboard layouts, see the Keymaps section of the
xl.cfg manual page man 5 xl.cfg .
22.5.1 Dom0
Dedicating CPU resources to Dom0 results in a better overall performance of the vir-
tualized environment because Dom0 has free CPU time to process I/O requests from
VM Guests. Failing to dedicate exclusive CPU resources to Dom0 usually results in a
poor performance and can cause the VM Guests to function incorrectly.
Dedicating CPU resources involves three basic steps: modifying Xen boot line, bind-
ing Dom0's VCPUs to a physical processor, and configuring CPU-related options on
VM Guests:
1. First you need to append the dom0_max_vcpus=X to the Xen boot line. Do
so by adding the following line to /etc/default/grub :
GRUB_CMDLINE_XEN="dom0_max_vcpus=X"
grub2-mkconfig -o /boot/grub2/grub.cfg
4. The next step is to bind (or “pin”) each Dom0's VCPU to a physical processor.
xl vcpu-pin Domain-0 0 0
xl vcpu-pin Domain-0 1 1
The first line binds Dom0's VCPU number 0 to the physical processor num-
ber 0, while the second line binds Dom0's VCPU number 1 to the physical
processor number 1.
5. Lastly, you need to make sure no VM Guest uses the physical processors
dedicated to VCPUs of Dom0. Assuming you are running an 8-CPU system,
you need to add
cpus="2-8"
22.5.2 VM Guests
It is often necessary to dedicate specific CPU resources to a virtual machine. By de-
fault, a virtual machine uses any available CPU core. Its performance can be im-
proved by assigning a reasonable number of physical processors to it as other VM
Guests are not allowed to use them after that. Assuming a machine with 8 CPU cores
while a virtual machine needs to use 2 of them, change its configuration file as fol-
lows:
vcpus=2
cpus="2,3"
The above example dedicates 2 processors to the VM Guest, and these being the
3rd and 4th one, ( 2 and 3 counted from zero). If you need to assign more physical
processors, use the cpus="2-8" syntax.
If you need to change the CPU assignment for a guest named “alice” in a hotplug
manner, do the following on the related Dom0:
xl vcpu-set alice 2
xl vcpu-pin alice 0 2
xl vcpu-pin alice 1 3
The example will dedicate 2 physical processors to the guest, and bind its VCPU 0 to
physical processor 2 and VCPU 1 to physical processor 3. Now check the assignment:
xl vcpu-list alice
Name ID VCPUs CPU State Time(s) CPU Affinity
alice 4 0 2 -b- 1.9 2-3
alice 4 1 3 -b- 2.8 2-3
boot = boot_device
boot_device can be one of c for hard disk, d for CD-ROM, or n for Net-
work/PXE. You can specify multiple options, and they will be attempted in the given
order. For example,
boot = dc
boots from CD-ROM, and falls back to the hard disk if CD-ROM is not bootable.
To gain an overview of the current CPU, have a look at /proc/cpuinfo . This con-
tains all the important information that defines the current CPU.
To redefine a CPU, first have a look at the respective cpuid definitions of the CPU
vendor. These are available from:
Intel
http://www.intel.com/Assets/PDF/appnote/241618.pdf↗
cpuid = "host,tm=0,sse3=0"
1
Force the corresponding bit to 1
0
Force the corresponding bit to 0
x
Use the values of the default policy
k
Use the values defined by the host
s
Like k , but preserve the value over migrations
Note that counting bits is done from right to left, starting with bit 0 .
In case you need to increase the default number of PCI-IRQs available to Dom0
and/or VM Guest, you can do so by modifying the Xen kernel command line. Use the
command extra_guest_irqs= domu_irgs,dom0_irgs . The optional first num-
ber domu_irgs is common for all VM Guests, while the optional second number
dom0_irgs (preceded by a comma) is for Dom0. Changing the setting for VM Guest
has no impact on Dom0 and vice versa. For example to change Dom0 without
changing VM Guest, use
extra_guest_irqs=,512
23 Administrative Tasks
23.1 The Boot Loader Program
23.2 Sparse Image Files and Disk Space
23.3 Migrating Xen VM Guest Systems
23.4 Monitoring Xen
23.5 Providing Host Information for VM Guest Systems
The YaST boot loader program is located at YaST › System › Boot Loader. Click the
Bootloader Options tab and select the line containing the Xen kernel as the Default
Boot Section.
Confirm with OK. Next time you boot the host, it will be ready to provide the Xen vir-
tualization environment.
You can use the Boot Loader program to specify functionality, such as:
If the host’s physical disk reaches a state where it has no available space, a virtual
machine using a virtual disk based on a sparse image file cannot write to its disk.
Consequently, it reports I/O errors.
If this situation occurs, you should free up available space on the physical disk, re-
mount the virtual machine’s file system, and set the file system back to read-write.
To check the actual disk requirements of a sparse image file, use the command
du -h <image file> .
To increase the available space of a sparse image file, first increase the file size and
then the file system.
Touching the sizes of partitions or sparse files always bears the risk of data fail-
ure. Do not work without a backup.
The resizing of the image file can be done online, while the VM Guest is running. In-
crease the size of a sparse image file with:
It is also possible to increase the image files of devices that are not sparse files.
However, you must know exactly where the previous image ends. Use the seek
parameter to point to the end of the image file and use a command similar to the
following:
Be sure to use the right seek, else data loss may happen.
If the VM Guest is running during the resize operation, also resize the loop device
that provides the image file to the VM Guest. First detect the correct loop device with
the command:
losetup -j /var/lib/xen/images/sles/disk0
Then resize the loop device, for example /dev/loop0 , with the following com-
mand:
losetup -c /dev/loop0
Finally check the size of the block device inside the guest system with the command
fdisk -l /dev/xvdb . The device name depends on the actually increased device.
The resizing of the file system inside the sparse file involves tools that are depending
on the actual file system. This is described in detail in the Book “Storage
Administration Guide”.
All VM Host Server systems should use a similar CPU. The frequency is not so
important, but they should be using the same CPU family. To get more infor-
mation about the used CPU, see cat /proc/cpuinfo .
All resources that are used by a specific guest system must be available on all
involved VM Host Server systems—for example all used block devices must
exist on both VM Host Server systems.
If the hosts included in the migration process run in different subnets, make
sure that either DHCP relay is available to the guests, or for guests with static
network configuration, set up the network manually.
iSCSI can be set up to give access to the same block devices from different
systems at the same time. For more information about iSCSI, see Book
“Storage Administration Guide”, Chapter 14 “Mass Storage over IP Networks:
iSCSI”.
NFS is a widely used root file system that can easily be accessed from differ-
ent locations. For more information, see Book “Administration Guide”, Chap-
ter 25 “Sharing File Systems with NFS”.
DRBD can be used if only two VM Host Server systems are involved. This
gives some extra data security, because the used data is mirrored over the
network. For more information, see the SUSE Linux Enterprise High Availability
Extension 12 SP2 documentation at http://www.suse.com/doc/↗.
SCSI can also be used if the available hardware permits shared access to
the same disks.
NPIV is a special mode to use Fibre channel disks. However, in this case all
migration hosts must be attached to the same Fibre channel switch. For
more information about NPIV, see Section 21.1, “Mapping Physical Storage to
Virtual Disks”. Commonly, this works if the Fibre channel environment sup-
ports 4 Gbit or faster connections.
The speed of the migration depends on how fast the memory print can be saved to
disk, sent to the new VM Host Server and loaded there. This means that small VM
Guest systems can be migrated faster than big systems with a lot of memory.
For a regular operation of many virtual guests, having a possibility to check the san-
ity of all the different VM Guest systems is indispensable. Xen offers several tools be-
sides the system tools to gather information about the system.
Basic monitoring of the VM Host Server (I/O and CPU) is available via the Virtual
Machine Manager. Refer to Section 10.8.1, “Monitoring with Virtual Machine
Manager” for details.
xentop has several command keys that can give you more information about the
system that is monitored. Some of the more important are:
D
Change the delay between the refreshes of the screen.
N
Also display network statistics. Note, that only standard configurations will be
displayed. If you use a special configuration like a routed network, no network
will be displayed.
B
Display the respective block devices and their cumulated usage count.
For more information about xentop see the manual page man 1 xentop .
Tip: virt-top
ip
The command line utility ip may be used to monitor arbitrary network inter-
faces. This is especially useful if you have set up a network that is routed or ap-
plied a masqueraded network. To monitor a network interface with the name
alice.0 , run the following command:
brctl
In a standard setup, all the Xen VM Guest systems are attached to a virtual net-
work bridge. brctl allows you to determine the connection between the
bridge and the virtual network adapter in the VM Guest system. For example,
the output of brctl show may look like the following:
This shows that there are two virtual bridges defined on the system. One is con-
nected to the physical Ethernet device eth0 , the other one is connected to a
VLAN interface vlan22 .
There is only one guest interface active in this setup, vif1.0 . This means that
the guest with ID 1 has an Ethernet interface eth0 assigned, that is connected
to br0 in the VM Host Server.
iptables-save
Especially when using masquerade networks, or if several Ethernet interfaces
are set up together with a firewall setup, it may be helpful to check the current
firewall rules.
The command iptables may be used to check all the different firewall set-
tings. To list all the rules of a chain, or even of the complete setup, you may use
the commands iptables-save or iptables -S .
2. To add or remove metric sections from the configuration, edit the file
/etc/vhostmd/vhostmd.conf . However, the default works well.
3. Check the validity of the vhostmd.conf configuration file with the com-
mand:
cd /etc/vhostmd
xmllint --postvalid --noout vhostmd.conf
8. Run the command vm-dump-metrics . To save the result to a file, use the
option -d <filename> .
The result of the vm-dump-metrics is an XML output. The respective metric entries
follow the DTD /etc/vhostmd/metric.dtd .
For more information, see the manual pages man 8 vhostmd and
/usr/share/doc/vhostmd/README on the VM Host Server system. On the guest,
see the manual page man 1 vm-dump-metrics .
This section introduces basic information about XenStore, its role in the Xen envi-
ronment, the directory structure of files used by XenStore, and the description of
XenStore's commands.
24.1 Introduction
XenStore is a database of configuration and status information shared between VM
Guests and the management tools running in Dom0. VM Guests and the manage-
ment tools read and write to XenStore to convey configuration information, status
updates, and state changes. The XenStore database is managed by Dom0 and sup-
ports simple operations such as reading and writing a key. VM Guests and manage-
ment tools can be notified of any changes in XenStore by watching entries of inter-
est. Note that the xenstored daemon is managed by the xencommons service.
Tip
Each VM Guest has two different ID numbers. The universal unique identifier
(UUID) remains the same even if the VM Guest is migrated to another machine.
The domain identifier (DOMID) is an identification number that represents a par-
ticular running instance. It typically changes when the VM Guest is migrated to an-
other machine.
xenstore-ls
Displays the full dump of the XenStore database.
xenstore-read path_to_xenstore_entry
Displays the value of the specified XenStore entry.
xenstore-exists xenstore_path
Reports whether the specified XenStore path exists.
xenstore-list xenstore_path
Displays all the children entries of the specified XenStore path.
xenstore-write path_to_xenstore_entry
Updates the value of the specified XenStore entry.
xenstore-rm xenstore_path
Removes the specified XenStore entry or directory.
xenstore-control
Sends a command to the xenstored back-end, such as triggering an integrity
check.
24.2.2 /vm
The /vm path is indexed by the UUID of each VM Guest, and stores configuration in-
formation such as the number of virtual CPUs and the amount of allocated memory.
There is a /vm/<uuid> directory for each VM Guest. To list the directory content,
use xenstore-list .
# xenstore-list /vm
00000000-0000-0000-0000-000000000000
9b30841b-43bc-2af9-2ed3-5a649f466d79-1
The first line of the output belongs to Dom0, and the second one to a running VM
Guest. The following command lists all the entries related to the VM Guest:
# xenstore-list /vm/9b30841b-43bc-2af9-2ed3-5a649f466d79-1
image
rtc
device
pool_name
shadow_memory
uuid
on_reboot
start_time
on_poweroff
bootloader_args
on_crash
vcpus
vcpu_avail
bootloader
name
To read a value of an entry, for example the number of virtual CPUs dedicated to the
VM Guest, use xenstore-read :
# xenstore-read /vm/9b30841b-43bc-2af9-2ed3-5a649f466d79-1/vcpus
1
uuid
UUID of the VM Guest. It does not change during the migration process.
on_reboot
Specifies whether to destroy or restart the VM Guest in response to a reboot re-
quest.
on_poweroff
Specifies whether to destroy or restart the VM Guest in response to a halt re-
quest.
on_crash
Specifies whether to destroy or restart the VM Guest in response to a crash.
vcpus
Number of virtual CPUs allocated to the VM Guest.
vcpu_avail
Bitmask of active virtual CPUs for the VM Guest. The bitmask has several bits
equal to the value of vcpus , with a bit set for each online virtual CPU.
name
The name of the VM Guest.
# xenstore-list /vm/9b30841b-43bc-2af9-2ed3-5a649f466d79-1/image
ostype
kernel
cmdline
ramdisk
dmargs
device-model
display
ostype
The OS type of the VM Guest.
kernel
The path on Dom0 to the kernel for the VM Guest.
cmdline
The kernel command line for the VM Guest used when booting.
ramdisk
The path on Dom0 to the RAM disk for the VM Guest.
dmargs
Shows arguments passed to the QEMU process. If you look at the QEMU process
with ps , you should see the same arguments as in
/vm/<uuid>/image/dmargs .
24.2.3 /local/domain/<domid>
This path is indexed by the running domain (VM Guest) ID, and contains information
about the running VM Guest. Remember that the domain ID changes during VM
Guest migration. The following entries are available:
vm
The path of the /vm directory for this VM Guest.
domid
Domain identifier for the VM Guest.
cpu
The current CPU to which the VM Guest is pinned.
cpu_weight
The weight assigned to the VM Guest for scheduling purposes. Higher weights
use the physical CPUs more often.
Apart from the individual entries described above, there are also several subdirecto-
ries under /local/domain/<domid> , containing specific entries. To see all entries
available, refer to XenStore Reference↗.
/local/domain/<domid>/memory
Contains memory information. /local/domain/<domid>/memory/target
contains target memory size for the VM Guest (in kilobytes).
/local/domain/<domid>/console
Contains information about a console used by the VM Guest.
/local/domain/<domid>/backend
Contains information about all back-end devices used by the VM Guest. The
path has subdirectories of its own.
/local/domain/<domid>/device
Contains information about the front-end devices for the VM Guest.
/local/domain/<domid>/device-misc
Contains miscellaneous information about devices.
/local/domain/<domid>/store
Contains information about the VM Guest's store.
25 Xen as a High-Availability
Virtualization Host
25.1 Xen HA with Remote Storage
25.2 Xen HA with Local Storage
25.3 Xen HA and Private Bridges
Setting up two Xen hosts as a failover system has several advantages compared to a
setup where every server runs on dedicated hardware.
Failure of a single server does not cause major interruption of the service.
A single big machine is normally way cheaper than multiple smaller ma-
chines.
The utilization of the server is improved, which has positive effects on the
power consumption of the system.
The setup of migration for Xen hosts is described in Section 23.3, “Migrating Xen VM
Guest Systems”. In the following, several typical scenarios are described.
If the storage system cannot be used directly but provides a possibility to offer the
needed space over NFS, it is also possible to create image files on NFS. If the NFS file
system is available on all Xen host systems, this method also allows live migrations
of Xen guests.
When setting up a new system, one of the main considerations is whether a dedi-
cated storage area network should be implemented. The following possibilities are
available:
Com-
Method Comments
plexity
Note that all block device traffic goes over the same Ether-
Ethernet low net interface as the network traffic. This may be limiting
the performance of the guest.
Running the storage traffic over a dedicated Ethernet in-
Ethernet terface may eliminate a bottleneck on the server side.
dedicated to medium However, planning your own network with your own IP
storage. address range and possibly a VLAN dedicated to storage
requires numerous considerations.
NPIV is a method to virtualize Fibre channel connections.
This is available with adapters that support a data rate of
NPIV high
at least 4 Gbit/s and allows the setup of complex storage
systems.
Typically, a 1 Gbit/s Ethernet device can fully use a typical hard disk or storage sys-
tem. When using very fast storage systems, such an Ethernet device will probably
limit the speed of the system.
For space or budget reasons, it may be necessary to rely on storage that is local to
the Xen host systems. To still maintain the possibility of live migrations, it is neces-
sary to build block devices that are mirrored to both Xen hosts. The software that al-
lows this is called Distributed Replicated Block Device (DRBD).
If a system that uses DRBD to mirror the block devices or files between two Xen
hosts should be set up, both hosts should use the identical hardware. If one of the
hosts has slower hard disks, both hosts will suffer from this limitation.
During the setup, each of the required block devices should use its own DRBD de-
vice. The setup of such a system is quite a complex task.
A different implementation method is using VLAN interfaces. In that case, all the traf-
fic goes over the regular Ethernet interface. However, the VLAN interface does not
get the regular traffic, because only the VLAN packets that are tagged for the correct
VLAN are forwarded.
For more information about the setup of a VLAN interface see Section 13.2.3, “Using
VLAN Interfaces”.
QEMU is a fast, cross-platform open source machine emulator which can emu-
late a huge number of hardware architectures for you. QEMU lets you run a
complete unmodified operating system (VM Guest) on top of your existing sys-
tem (VM Host Server).
28 Guest Installation
The libvirt -based tools such as virt-manager and virt-install offer
convenient interfaces to set up and manage virtual machines. They act as a kind
of wrapper for the qemu-system-ARCH command. However, it is also possible
to use qemu-system-ARCH directly without using libvirt -based tools.
26 QEMU Overview
QEMU is a fast, cross-platform open source machine emulator which can emulate a
huge number of hardware architectures for you. QEMU lets you run a complete un-
modified operating system (VM Guest) on top of your existing system (VM Host
Server).
You can also use QEMU for debugging purposes—you can easily stop your running
virtual machine, inspect its state and save and restore it later.
generic devices used to connect the emulated devices to the related host de-
vices
debugger
QEMU is central to KVM and Xen Virtualization, where it provides the general ma-
chine emulation. Xen's usage of QEMU is somewhat hidden from the user, while
KVM's usage exposes most QEMU features transparently. If the VM Guest hardware
architecture is the same as the VM Host Server's architecture, QEMU can take advan-
tage of the KVM acceleration (SUSE only supports QEMU with the KVM acceleration
loaded).
qemu-system-i386
qemu-system-s390x
qemu-system-x86_64
This section documents how to set up and use SUSE Linux Enterprise Server 12 SP2
as a QEMU-KVM based virtual machine host.
Tip: Resources
In general, the virtual guest system needs the same hardware resources as SUSE
Linux Enterprise Server installed on a physical machine. The more guests you
plan to run on the host system, the more hardware resources—CPU, disk, mem-
ory, and network—you need to add.
To find out whether your system supports virtualization, see Section 7.3, “KVM Hard-
ware Requirements”.
2. Select KVM server and preferably also KVM tools, and confirm with Accept.
3. During the installation process, you can optionally let YaST create a Network
Bridge for you automatically. If you do not plan to dedicate an additional
physical network card to your virtual guests, network bridge is a standard
way to connect the guest machines to the network.
4. After all the required packages are installed (and new network setup acti-
vated), try to load the KVM kernel module relevant for your CPU type—
kvm-intel or kvm-amd :
Now the KVM host is ready to serve KVM VM Guests. For more information,
see Chapter 29, Running Virtual Machines with qemu-system-ARCH.
Tip
Improved scalability
KVM guests have a limited number of PCI controllers, which results in a limited
number of possibly attached devices. virtio-scsi solves this limitation by
grouping multiple storage devices on a single controller. Each device on a
virtio-scsi controller is represented as a logical unit, or LUN.
Device naming
virtio-blk devices are presented inside the guest as /dev/vd X , which is
different from device names in physical systems and may cause migration prob-
lems.
virtio-scsi keeps the device names identical to those on physical systems,
making the virtual machines easily relocatable.
qemu-system-x86_64 [...] \
-device virtio-scsi-pci,id=scsi
qemu-system-x86_64 [...] \
-netdev tap,id=guest0,vhost=on,script=no \
-net nic,model=virtio,netdev=guest0,macaddr=00:16:35:AF:94:4B
As the number of virtual CPUs increases in VM Guests, QEMU offers a way of im-
proving the network performance using multiqueue. Multiqueue virtio-net scales the
network performance by allowing VM Guest virtual CPUs to transfer packets in par-
allel. Multiqueue support is required on both the VM Host Server and VM Guest
sides.
VM Guest has many connections active at the same time, mainly between
the guest systems, or between the guest and the host, or between the
guest and an external system.
The number of active queues is equal to the number of virtual CPUs in the
VM Guest.
Note
The following procedure lists important steps to enable the multiqueue feature
with qemu-system-ARCH . It assumes that a tap network device with multi-
queue capability (supported since kernel version 3.8) is set up on the VM Host
Server.
-netdev tap,vhost=on,queues=N
-device virtio-net-pci,mq=on,vectors=2*N+2
where the formula for the number of MSI-X vectors results from: N vectors
for TX (transmit) queues, N for RX (receive) queues, one for configuration
purposes, and one for possible VQ (vector quantization) control.
The resulting qemu-system-ARCH command line will look similar to the following
example:
Note that the id of the network device ( guest0 ) needs to be identical for both
options.
Now the guest system networking uses the multiqueue support from the
qemu-system-ARCH hypervisor.
To be able to assign a PCI device via VFIO to a VM Guest, you need to find out which
IOMMU Group it belongs to. The IOMMU (input/output memory management unit
that connects a direct memory access-capable I/O bus to the main memory) API sup-
ports the notion of groups. A group is a set of devices that can be isolated from all
other devices in the system. Groups are therefore the unit of ownership used by
VFIO.
Note down the device ID ( 00:10.0 in this case) and the vendor ID (
8086:10ca ).
The IOMMU group for this device is 20 . Now you can check the devices be-
longing to the same IOMMU group:
ls -l /sys/bus/pci/devices/0000:01:10.0/iommu_group/devices/0000:01:10.0
[...] 0000:00:1e.0 -> ../../../../devices/pci0000:00/0000:00:1e.0
[...] 0000:01:10.0 -> ../../../../devices/pci0000:00/0000:00:1e.0/0000:01:10.0
[...] 0000:01:10.1 -> ../../../../devices/pci0000:00/0000:00:1e.0/0000:01:10.1
4. Bind the device to the vfio-pci driver using the vendor ID from step 1:
Important: No Hotplugging
You can find more detailed information on the VFIO driver in the
/usr/src/linux/Documentation/vfio.txt file (package kernel-source
needs to be installed).
KVM introduces a new optimized method called VirtFS (sometimes called “file system
pass-through”). VirtFS uses a paravirtual file system driver, which avoids converting
the guest application file system operations into block device operations, and then
again into host file system operations.
To replace the virtual disk as the root file system to which the guest's RAM
disk connects during the guest boot process.
To provide storage services to different customers from a single host file sys-
tem in a cloud environment.
27.3.5.1 Implementation
In QEMU, the implementation of VirtFS is simplified by defining two types of devices:
fsdev device which defines the export file system properties, such as file
system type and security model.
qemu-system-x86_64 [...] \
-fsdev local,id=exp1 1 ,path=/tmp/ 2 ,security_model=mapped 3 \
-device virtio-9p-pci,fsdev=exp1 4 ,mount_tag=v_tmp 5
where v_tmp is the mount tag defined earlier with -device mount_tag= and
/mnt is the mount point where you want to mount the exported file system.
KSM stores its status information in the files under the /sys/kernel/mm/ksm di-
rectory:
2. Now run several VM Guests under KVM and inspect the content of files
pages_sharing and pages_shared , for example:
28 Guest Installation
28.1 Basic Installation with qemu-system-ARCH
28.2 Managing Disk Images with qemu-img
The libvirt -based tools such as virt-manager and virt-install offer con-
venient interfaces to set up and manage virtual machines. They act as a kind of
wrapper for the qemu-system-ARCH command. However, it is also possible to use
qemu-system-ARCH directly without using libvirt -based tools.
Virtual Machines created with qemu-system-ARCH are not "visible" for the
libvirt -based tools.
qemu-system-ARCH
In the following example, a virtual machine for a SUSE Linux Enterprise Server 11 in-
stallation is created. For detailed information on the commands, refer to the respec-
tive man pages.
If you do not already have an image of a system that you want to run in a virtualized
environment, you need to create one from the installation media. In such case, you
need to prepare a hard disk image, and obtain an image of the installation media or
the media itself.
After at least one hard disk image is created, you can set up a virtual machine with
qemu-system-ARCH that will boot into the installation system:
1 Name of the virtual machine that will be displayed in the window caption and
be used for the VNC server. This name must be unique.
2 Specifies the machine type. Use qemu-system-ARCH -M ? to display a list of
valid parameters. pc is the default Standard PC.
3 Maximum amount of memory for the virtual machine.
4 Defines an SMP system with two processors.
5 Specifies the boot order. Valid values are a , b (floppy 1 and 2), c (first hard
disk), d (first CD-ROM), or n to p (Ether-boot from network adapter 1-3).
Defaults to c .
6 Defines the first ( index=0 ) hard disk. It will be accessed as a paravirtualized (
if=virtio ) drive in raw format.
7 The second ( index=1 ) image drive will act as a CD-ROM.
8 Defines a paravirtualized ( model=virtio ) network adapter with the MAC ad-
dress 52:54:00:05:11:11 . Be sure to specify a unique MAC address, other-
wise a network conflict may occur.
9 Specifies the graphic card. If you specify none , the graphic card will be dis-
abled.
10 Defines the paravirtualized balloon device that allows to dynamically change
the amount of memory (up to the maximum value specified with the parame-
ter -m ).
After the installation of the guest operating system finishes, you can start the related
virtual machine without the need to specify the CD-ROM device:
qemu-img uses subcommands (like zypper does) to do specific tasks. Each sub-
command understands a different set of options. Some options are general and
used by more of these subcommands, while some are unique to the related sub-
command. See the qemu-img manual page ( man 1 qemu-img ) for a list of all sup-
ported options. qemu-img uses the following general syntax:
create
Creates a new disk image on the file system.
check
Checks an existing disk image for errors.
compare
Check if two images have the same content.
map
Dumps the metadata of the image file name and its backing file chain.
amend
Amends the image format specific options for the image file name.
convert
Converts an existing disk image to a new one in a different format.
info
Displays information about the relevant disk image.
snapshot
Manages snapshots of existing disk images.
commit
Applies changes made to an existing disk image.
rebase
Creates a new base image based on an existing image.
resize
Increases or decreases the size of an existing image.
1 The format of the target image. Supported formats are qed , qcow2 , and
raw .
2 Some image formats support additional options to be passed on the com-
mand line. You can specify them here with the -o option. The raw image for-
mat supports only the size option, so it is possible to insert -o size=8G
instead of adding the size option at the end of the command.
3 Path to the target disk image to be created.
4 Size of the target disk image (if not already specified with the
-o size=<image_size> option. Optional suffixes for the image size are K
(kilobyte), M (megabyte), G (gigabyte), or T (terabyte).
As you can see, the virtual size of the newly created image is 4 GB, but the actual re-
ported disk size is 0 as no data has been written to the image yet.
If you need to create a disk image on the Btrfs file system, you can use
nocow=on to reduce the performance overhead created by the copy-on-write
feature of Btrfs:
If you, however, want to use copy-on-write (for example for creating snapshots
or sharing them across virtual machines), then leave the command line without
the nocow option.
1 Applies compression on the target disk image. Only qcow and qcow2 for-
mats support compression.
2 The format of the source disk image. It is usually autodetected and can there-
fore be omitted.
3 The format of the target disk image.
4 Specify additional options relevant for the target image format. Use -o ? to
view the list of options supported by the target image format.
5 Path to the source disk image to be converted.
6 Path to the converted target disk image.
To see a list of options relevant for the selected target image format, run the follow-
ing command (replace vmdk with your image format):
1 The format of the source disk image. It is usually autodetected and can there-
fore be omitted.
2 Path to the source disk image to be checked.
If no error is found, the command returns no output. Otherwise, the type and num-
ber of errors found is shown.
Note
You can resize the disk image using the formats raw , qcow2 and qed . To resize
an image in another format, convert it to a supported format with
qemu-img convert first.
The image now contains an empty space of 2 GB after the final partition. You can re-
size the existing partitions or add new ones.
A qcow2 formatted file is organized in units of constant size. These units are called
clusters. Viewed from the guest side, the virtual disk is also divided into clusters of
the same size. QEMU defaults to 64 kB clusters, but you can specify a different value
when creating a new image:
A qcow2 image contains a set of tables organized in two levels that are called the L1
and L2 tables. There is just one L1 table per disk image, while there can be many L2
tables depending on how big the image is.
To read or write data to the virtual disk, QEMU needs to read its corresponding L2
table to find out the relevant data location. Because reading the table for each I/O
operation consumes system resources, QEMU keeps a cache of L2 tables in memory
to speed up disk access.
Therefore, to have a cache that maps n gigabytes of disk space with the default
cluster size, you need
QEMU uses 1 MB (1048576 bytes) of L2 cache by default. Following the above for-
mulas, 1 MB of L2 cache covers 8 GB (1048576 / 131072) of virtual disk. This means
that the performance is fine with the default L2 cache size if your virtual disk size is
up to 8 GB. For larger disks, you can speed up the disk access by increasing the L2
cache size.
The following options configure the cache size for the virtual guest:
l2-cache-size
The maximum size of the L2 table cache.
refcount-cache-size
The maximum size of the refcount block cache. For more information on ref-
count, see https://github.com/qemu/qemu/blob/master/docs/specs/qcow2.txt↗
.
cache-size
The maximum size of both caches combined.
When specifying values for the options above, be aware of the following:
The size of both the L2 and refcount block caches needs to be a multiple of
the cluster size.
If you only set one of the options, QEMU will automatically adjust the other
options so that the L2 cache is 4 times bigger than the refcount cache.
The refcount cache is used much less often than the L2 cache, therefore you can
keep it relatively small:
The following example removes all unused cache entries every 10 minutes:
If this option is not set, the default value is 0 and it disables this feature.
Snapshots are helpful when you need to save your virtual machine in a particular
state. For example, after you configured network services on a virtualized server and
want to quickly start the virtual machine in the same state you last saved it. Or you
can create a snapshot after the virtual machine has been powered off to create a
backup state before you try something experimental and possibly make VM Guest
unstable. This section introduces the latter case, while the former is described in
Chapter 30, Virtual Machine Administration Using QEMU Monitor.
To use snapshots, your VM Guest must contain at least one writable hard disk image
in qcow2 format. This device is usually the first virtual hard disk.
Virtual Machine snapshots are created with the savevm command in the interactive
QEMU monitor. To make identifying a particular snapshot easier, you can assign it a
tag. For more information on QEMU monitor, see Chapter 30, Virtual Machine Ad-
ministration Using QEMU Monitor.
Once your qcow2 disk image contains saved snapshots, you can inspect them with
the qemu-img snapshot command.
If something breaks in your VM Guest and you need to restore the state of the saved
snapshot (ID 5 in our example), power off your VM Guest and execute the following
command:
The next time you run the virtual machine with qemu-system-ARCH , it will be in the
state of snapshot number 5.
Note
With QEMU it is possible to create “base” disk images. You can use them as template
virtual machines. These base images will save you plenty of time because you will
never need to install the same operating system more than once.
It is a good practice to create a base image from a freshly installed (and, if needed,
registered) operating system with no patches applied and no additional applications
installed or removed. Later on, you can create another base image with the latest
patches applied and based on the original base image.
Note
While you can use the raw format for base images, you cannot use it for derived
images because the raw format does not support the backing_file option.
Use for example the qcow2 format for the derived images.
The image's reserved size is 4 GB, the actual size is 2.4 GB, and its format is raw .
Create an image derived from the /images/sles_base.raw base image with:
Although the reserved size of the derived image is the same as the size of the base
image (4 GB), the actual size is 140 KB only. The reason is that only changes made to
the system inside the derived image are saved. Run the derived virtual machine, reg-
ister it, if needed, and apply the latest patches. Do any other changes in the system
such as removing unneeded or installing new software packages. Then shut the VM
Guest down and examine its details once more:
The disk size value has grown to 1.1 GB, which is the disk space occupied by the
changes on the file system compared to the base image.
This command created the new base image /images/sles_base2.raw using the
raw format.
The new image is 0.4 gigabytes bigger than the original base image. It uses no back-
ing file, and you can easily create new derived images based upon it. This lets you
create a sophisticated hierarchy of virtual disk images for your organization, saving a
lot of time and work.
Linux systems can mount an internal partition of a raw disk image using a loop-
back device. The first example procedure is more complex but more illustrative,
while the second one is straightforward:
1. Set a loop device on the disk image whose partition you want to mount.
2. Find the sector size and the starting sector number of the partition you want
to mount.
4. Delete the loop and mount the partition inside the disk image with the cal-
culated offset on a prepared directory.
5. Copy one or more files onto the mounted partition and unmount it when
finished.
Once you have a virtual disk image ready (for more information on disk images, see
Section 28.2, “Managing Disk Images with qemu-img ”), it is time to start the related
virtual machine. Section 28.1, “Basic Installation with qemu-system-ARCH ” intro-
duced simple commands to install and run a VM Guest. This chapter focuses on a
more detailed explanation of qemu-system-ARCH usage, and shows solutions for
more specific tasks. For a complete list of qemu-system-ARCH 's options, see its
manual page ( man 1 qemu ).
-name name_of_guest
Specifies the name of the running guest system. The name is displayed in the
window caption and used for the VNC server.
-boot options
Specifies the order in which the defined drives will be booted. Drives are repre-
sented by letters, where a and b stand for the floppy drives 1 and 2, c stands
for the first hard disk, d stands for the first CD-ROM drive, and n to p stand
for Ether-boot network adapters.
For example, qemu-system-ARCH [...] -boot order=ndc first tries to boot
from network, then from the first CD-ROM drive, and finally from the first hard
disk.
-pidfile fname
Stores the QEMU's process identification number (PID) in a file. This is useful if
you run QEMU from a script.
-nodefaults
By default QEMU creates basic virtual devices even if you do not specify them on
the command line. This option turns this feature off, and you must specify every
single device manually, including graphical and network cards, parallel or serial
ports, or virtual consoles. Even QEMU monitor is not attached by default.
-daemonize
“Daemonizes” the QEMU process after it is started. QEMU will detach from the
standard input and standard output after it is ready to receive connections on
any of its devices.
SeaBIOS is the default BIOS used. You can boot USB devices, any drive (CD-ROM,
Floppy, or a hard disk). It has USB mouse and keyboard support and supports
multiple VGA cards. For more information about SeaBIOS, refer to the SeaBIOS
Website↗.
isapc ISA-only PC
none empty machine
xenfv Xen Fully-virtualized PC
xenpv Xen Para-virtualized PC
Note: ISA-PC
-m megabytes
Specifies how many megabytes are used for the virtual RAM size.
-balloon virtio
Specifies a paravirtualized device to dynamically change the amount of virtual
RAM memory assigned to VM Guest. The top limit is the amount of memory
specified with -m .
-smp number_of_cpus
Specifies how many CPUs will be emulated. QEMU supports up to 255 CPUs on
the PC platform (up to 64 with KVM acceleration used). This option also takes
other CPU-related parameters, such as number of sockets, number of cores per
socket, or number of threads per core.
-no-acpi
Disables ACPI support.
-S
QEMU starts with CPU stopped. To start CPU, enter c in QEMU monitor. For
more information, see Chapter 30, Virtual Machine Administration Using QEMU
Monitor.
-readconfig cfg_file
Instead of entering the devices configuration options on the command line each
time you want to run VM Guest, qemu-system-ARCH can read it from a file that
was either previously saved with -writeconfig or edited manually.
-writeconfig cfg_file
Dumps the current virtual machine's devices configuration to a text file. It can be
consequently re-used with the -readconfig option.
[drive]
index = "0"
media = "disk"
file = "/images/sles_base.raw"
This way you can effectively manage the configuration of your virtual machines'
devices in a well-arranged way.
-rtc options
Specifies the way the RTC is handled inside a VM Guest. By default, the clock of
the guest is derived from that of the host system. Therefore, it is recommended
that the host system clock is synchronized with an accurate external clock (for
example, via NTP service).
If you need to isolate the VM Guest clock from the host one, specify clock=vm
instead of the default clock=host .
You can also specify the initial time of the VM Guest's clock with the base op-
tion:
Instead of a time stamp, you can specify utc or localtime . The former in-
structs VM Guest to start at the current UTC value (Coordinated Universal Time,
see http://en.wikipedia.org/wiki/UTC↗), while the latter applies the local time
setting.
QEMU virtual machines emulate all devices needed to run a VM Guest. QEMU sup-
ports, for example, several types of network cards, block devices (hard and remov-
able drives), USB devices, character devices (serial and parallel ports), or multimedia
devices (graphic and sound cards). This section introduces options to configure vari-
ous types of supported devices.
Tip
If your device, such as -drive , needs a special driver and driver properties to be
set, specify them with the -device option, and identify with drive= subop-
tion. For example:
To get help on available drivers and their properties, use -device ? and
-device driver ,? .
Virtual Machine drives are defined with -drive . This option has many sub-options,
some of which are described in this section. For the complete list, see the manual
page ( man 1 qemu ).
file=image_fname
Specifies the path to the disk image that will be used with this drive. If not speci-
fied, an empty (removable) drive is assumed.
if=drive_interface
Specifies the type of interface to which the drive is connected. Currently only
floppy , scsi , ide , or virtio are supported by SUSE. virtio defines a
paravirtualized disk driver. Default is ide .
index=index_of_connector
Specifies the index number of a connector on the disk interface (see the if op-
tion) where the drive is connected. If not specified, the index is automatically in-
cremented.
media=type
Specifies the type of media. Can be disk for hard disks, or cdrom for remov-
able CD-ROM drives.
format=img_fmt
Specifies the format of the connected disk image. If not specified, the format is
autodetected. Currently, SUSE supports qcow2 , qed and raw formats.
cache=method
Specifies the caching method for the drive. Possible values are unsafe ,
writethrough , writeback , directsync , or none . To improve perfor-
mance when using the qcow2 image format, choose writeback . none dis-
ables the host page cache and, therefore, is the safest option. Default for image
files is writeback . For more information, see Chapter 15, Disk Cache Modes.
Tip
instead of
and
instead of
As an alternative to using disk images (see Section 28.2, “Managing Disk Images
with qemu-img ”) you can also use existing VM Host Server disks, connect them
as drives, and access them from VM Guest. Use the host disk device directly in-
stead of disk image file names.
That is why the discard=on option is introduced on the KVM command line. It tells
the hypervisor to automatically free the “holes” after deleting data from the sparse
guest image. Note that this option is valid only for the if=scsi drive interface:
if=scsi is not supported. This interface does not map to virtio-scsi, but rather
to the lsi SCSI adapter.
29.3.1.2 virtio-blk-data-plane
Only Linux VM Host Servers are supported because of the Linux AIO usage,
but non-Linux VM Guests are supported.
2. Reboot the guest with the new kernel command line active.
The bio-based virtio-blk driver does not help on slow devices such as spin hard
disks. The reason is that the benefit of scheduling is larger than what the short-
ened bio path offers. Do not use the bio-based driver on slow devices.
This feature is only available using the RAW image format, as the iSCSI protocol
has some technical limitations.
The following is the QEMU command line interface for iSCSI connectivity.
The use of libiscsi based storage provisioning is not yet exposed by the virt-man-
ager interface, but instead it would be configured by directly editing the guest
xml. This new way of accessing iSCSI based storage is to be done at the command
line.
Here is an example snippet of guest domain xml which uses the protocol based
iSCSI:
<devices>
...
<disk type='network' device='disk'>
<driver name='qemu' type='raw'/>
<source protocol='iscsi' name='iqn.2013-07.com.example:iscsi-nopool/2'>
<host name='example.com' port='3260'/>
</source>
<auth username='myuser'>
<secret type='iscsi' usage='libvirtiscsi'/>
</auth>
<target dev='vda' bus='virtio'/>
</disk>
</devices>
Contrast that with an example which uses the host based iSCSI initiator which
virt-manager sets up:
<devices>
...
<disk type='block' device='disk'>
<driver name='qemu' type='raw' cache='none' io='native'/>
<source dev='/dev/disk/by-path/scsi-0:0:0:0'/>
<target dev='hda' bus='ide'/>
<address type='drive' controller='0' bus='0' target='0' unit='0'/>
</disk>
<controller type='ide' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01'
function='0x1'/>
</controller>
</devices>
none
Disables video cards on VM Guest (no video card is emulated). You can still ac-
cess the running VM Guest via the serial console.
std
Emulates a standard VESA 2.0 VBE video card. Use it if you intend to use high
display resolution on VM Guest.
cirrus
Emulates Cirrus Logic GD5446 video card. Good choice if you insist on high
compatibility of the emulated video hardware. Most operating systems (even
Windows 95) recognize this type of card.
Tip
For best video performance with the cirrus type, use 16-bit color depth
both on VM Guest and VM Host Server.
-display gtk
Display video output in a GTK window. This interface provides UI elements to
configure and control the VM during runtime.
-display sdl
Display video output via SDL, usually in a separate graphics window. For more
information, see the SDL documentation.
-spice option[,option[,...]]
Enables the spice remote desktop protocol.
-display vnc
Refer to Section 29.5, “Viewing a VM Guest with VNC” for more information.
-nographic
Disables QEMU's graphical output. The emulated serial port is redirected to the
console.
After starting the virtual machine with -nographic , press Ctrl – A H in the
virtual console to view the list of other useful shortcuts, for example, to toggle
between the console and the QEMU monitor.
-no-frame
Disables decorations for the QEMU window. Convenient for dedicated desktop
work space.
-full-screen
Starts QEMU graphical output in full screen mode.
-no-quit
Disables the close button of the QEMU window and prevents it from being
closed by force.
-alt-grab , -ctrl-grab
By default, the QEMU window releases the “captured” mouse after pressing
Ctrl – Alt . You can change the key combination to either Ctrl – Alt – Shift (
disk
Emulates a mass storage device based on file. The optional format option is
used rather than detecting the format.
host
Pass through the host device (identified by bus.addr).
serial
Serial converter to a host character device.
braille
Emulates a braille device using BrlAPI to display the braille output.
net
Emulates a network adapter that supports CDC Ethernet and RNDIS protocols.
mouse
Emulates a virtual USB mouse. This option overrides the default PS/2 mouse
emulation. The following example shows the hardware status of a mouse on VM
Guest started with qemu-system-ARCH [...] -usbdevice mouse :
tablet
Emulates a pointer device that uses absolute coordinates (such as touchscreen).
This option overrides the default PS/2 mouse emulation. The tablet device is
useful if you are viewing VM Guest via the VNC protocol. See Section 29.5, “View-
ing a VM Guest with VNC” for more information.
null
Creates an empty device that outputs no data and drops any data it receives.
stdio
Connects to QEMU's process standard input and standard output.
socket
Creates a two-way stream socket. If path is specified, a Unix socket is created:
The command creates a local listening ( server ) TCP socket on port 7777.
QEMU will not block waiting for a client to connect to the listening port ( nowait
).
udp
Sends all network traffic from VM Guest to a remote host over the UDP protocol.
qemu-system-x86_64 [...] \
-chardev udp,id=udp_fwd,host=mercury.example.com,port=7777
The command binds port 7777 on the remote host mercury.example.com and
sends VM Guest network traffic there.
vc
Creates a new QEMU text console. You can optionally specify the dimensions of
the virtual console:
The command creates a new virtual console called vc1 of the specified size,
and connects the QEMU monitor to it.
file
Logs all traffic from VM Guest to a file on VM Host Server. The path is required
and will be created if it does not exist.
qemu-system-x86_64 [...] \
-chardev file,id=qemu_log1,path=/var/log/qemu/guest1.log
By default QEMU creates a set of character devices for serial and parallel ports, and
a special console for QEMU monitor. However, you can create your own character
devices and use them for the mentioned purposes. The following options will help
you:
-serial char_dev
Redirects the VM Guest's virtual serial port to a character device char_dev on
VM Host Server. By default, it is a virtual console ( vc ) in graphical mode, and
stdio in non-graphical mode. The -serial understands many sub-options.
See the manual page man 1 qemu for a complete list of them.
You can emulate up to 4 serial ports. Use -serial none to disable all serial
ports.
-parallel device
Redirects the VM Guest's parallel port to a device . This option supports the
same devices as -serial .
Tip
With SUSE Linux Enterprise Server as a VM Host Server, you can directly use
the hardware parallel port devices /dev/parportN where N is the number
of the port.
You can emulate up to 3 parallel ports. Use -parallel none to disable all par-
allel ports.
-monitor char_dev
Redirects the QEMU monitor to a character device char_dev on VM Host
Server. This option supports the same devices as -serial . By default, it is a vir-
tual console ( vc ) in a graphical mode, and stdio in non-graphical mode.
For a complete list of available character devices back-ends, see the man page (
man 1 qemu ).
-netdev type[,prop[=value][,...]]
Currently, SUSE supports the following network types: user , bridge , and tap .
For a complete list of -netdev sub-options, see the manual page ( man 1 qemu ).
bridge
Uses a specified network helper to configure the TAP interface and attach it to a
specified bridge. For more information, see Section 29.4.3, “Bridged Network-
ing”.
user
Specifies user-mode networking. For more information, see Section 29.4.2,
“User-Mode Networking”.
tap
Specifies bridged or routed networking. For more information, see Sec-
tion 29.4.3, “Bridged Networking”.
qemu-system-x86_64 [...] \
-netdev tap 1 ,id=hostnet0 \
-device virtio-net-pci 2 ,netdev=hostnet0,vlan=1 3 ,\
macaddr=00:16:35:AF:94:4B 4 ,name=ncard1
Currently, SUSE supports the models rtl8139 , e1000 and its variants
e1000-82540em , e1000-82544gc and e1000-82545em , and
virtio-net-pci . To view a list of options for a specific driver, add help as
a driver option:
3 Connects the network interface to VLAN number 1. You can specify your own
number—it is mainly useful for identification purpose. If you omit this subop-
tion, QEMU uses the default 0.
4 Specifies the Media Access Control (MAC) address for the network card. It is a
unique identifier and you are advised to always specify it. If not, QEMU sup-
plies its own default MAC address and creates a possible MAC address conflict
within the related VLAN.
This mode is useful if you want to allow the VM Guest to access the external network
resources, such as the Internet. By default, no incoming traffic is permitted and
therefore, the VM Guest is not visible to other machines on the network. No admin-
istrator privileges are required in this networking mode. The user-mode is also use-
ful for doing a network boot on your VM Guest from a local directory on VM Host
Server.
The VM Guest allocates an IP address from a virtual DHCP server. VM Host Server
(the DHCP server) is reachable at 10.0.2.2, while the IP address range for allocation
starts from 10.0.2.15. You can use ssh to connect to VM Host Server at 10.0.2.2,
and scp to copy files back and forth.
qemu-system-x86_64 [...] \
-netdev user 1 ,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,vlan=1 2 ,name=user_net1 3 ,restrict=yes
qemu-system-x86_64 [...] \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,net=10.2.0.0/8 1 ,host=10.2.0.6 2 ,\
dhcpstart=10.2.0.20 3 ,hostname=tux_kvm_guest 4
1 Specifies the IP address of the network that VM Guest sees and optionally the
netmask. Default is 10.0.2.0/8.
2 Specifies the VM Host Server IP address that VM Guest sees. Default is
10.0.2.2.
3 Specifies the first of the 16 IP addresses that the built-in DHCP server can as-
sign to VM Guest. Default is 10.0.2.15.
4 Specifies the host name that the built-in DHCP server will assign to VM Guest.
qemu-system-x86_64 [...] \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,tftp=/images/tftp_dir 1 ,\
bootfile=/images/boot/pxelinux.0 2
1 Activates a built-in TFTP (a file transfer protocol with the functionality of a very
basic FTP) server. The files in the specified directory will be visible to a VM
Guest as the root of a TFTP server.
2 Broadcasts the specified file as a BOOTP (a network protocol that offers an IP
address and a network location of a boot image, often used in diskless work-
stations) file. When used together with tftp , the VM Guest can boot from
network from the local directory on the host.
qemu-system-x86_64 [...] \
-netdev user,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,hostfwd=tcp::2222-:22
Forwards incoming TCP connections to the port 2222 on the host to the port 22
( SSH ) on VM Guest. If sshd is running on VM Guest, enter
where qemu_host is the host name or IP address of the host system, to get a
SSH prompt from VM Guest.
With the -netdev tap option, QEMU creates a network bridge by connecting the
host TAP network device to a specified VLAN of VM Guest. Its network interface is
then visible to the rest of the network. This method does not work by default and
needs to be explicitly specified.
First, create a network bridge and add a VM Host Server physical network interface
(usually eth0 ) to it:
2. Click Add and select Bridge from the Device Type drop-down box in the Hard-
ware Dialog window. Click Next.
4. In the Bridged Devices pane, select the Ethernet device to add to the bridge.
Click Next. When asked about adapting an already configured device, click
Continue.
Make sure the tunctl and bridge-utils packages are installed on the VM
Host Server. If not, install them with zypper in tunctl bridge-utils .
#!/bin/bash
bridge=br0 1
tap=$(sudo tunctl -u $(whoami) -b) 2
sudo ip link set $tap up 3
sleep 1s 4
sudo brctl addif $bridge $tap 5
qemu-system-x86_64 -machine accel=kvm -m 512 -hda /images/sles_base.raw \
-netdev tap,id=hostnet0 \
-device virtio-net-pci,netdev=hostnet0,vlan=0,macaddr=00:16:35:AF:94:4B,\
ifname=$tap 6 ,script=no 7 ,downscript=no
sudo brctl delif $bridge $tap 8
sudo ip link set $tap down 9
sudo tunctl -d $tap 10
qemu-system-x86_64 [...] \
-netdev bridge,id=hostnet0,vlan=0,br=br0 \
-device virtio-net-pci,netdev=hostnet0
You can specify your own custom helper script that will take care of the TAP device
(de)configuration, with the helper=/path/to/your/helper option:
qemu-system-x86_64 [...] \
-netdev bridge,id=hostnet0,vlan=0,br=br0,helper=/path/to/bridge-helper \
-device virtio-net-pci,netdev=hostnet0
Tip
allow br0
Tip
When working with QEMU's virtual machine via VNC session, it is useful to work
with the -usbdevice tablet option.
Moreover, if you need to use another keyboard layout than the default en-us ,
specify it with the -k option.
The first suboption of -vnc must be a display value. The -vnc option understands
the following display specifications:
host:display
Only connections from host on the display number display will be accepted.
The TCP port on which the VNC session is then running is normally a 5900 +
display number. If you do not specify host , connections will be accepted
from any host.
unix:path
The VNC server listens for connections on Unix domain sockets. The path op-
tion specifies the location of the related Unix socket.
none
The VNC server functionality is initialized, but the server itself is not started. You
can start the VNC server later with the QEMU monitor. For more information,
see Chapter 30, Virtual Machine Administration Using QEMU Monitor.
Following the display value there may be one or more option flags separated by
commas. Valid options are:
reverse
Connect to a listening VNC client via a reverse connection.
websocket
Opens an additional TCP listening port dedicated to VNC Websocket connec-
tions. By definition the Websocket port is 5700+display.
password
Require that password-based authentication is used for client connections.
tls
Require that clients use TLS when communicating with the VNC server.
x509=/path/to/certificate/dir
Valid if TLS is specified. Require that x509 credentials are used for negotiating
the TLS session.
x509verify=/path/to/certificate/dir
Valid if TLS is specified. Require that x509 credentials are used for negotiating
the TLS session.
sasl
Require that the client uses SASL to authenticate with the VNC server.
acl
Turn on access control lists for checking of the x509 client certificate and SASL
party.
lossy
Enable lossy compression methods (gradient, JPEG, ...).
non-adaptive
Disable adaptive encodings. Adaptive encodings are enabled by default.
share=[allow-exclusive|force-shared|ignore]
Set display sharing policy.
Note
For more details about the display options, see the qemu-doc man page.
The default VNC server setup does not use any form of authentication. In the previ-
ous example, any user can connect and view the QEMU VNC session from any host
on the network.
There are several levels of security that you can apply to your VNC client/server con-
nection. You can either protect your connection with a password, use x509 certifi-
cates, use SASL authentication, or even combine some authentication methods in
one QEMU command.
See Section B.2, “Generating x509 Client/Server Certificates” for more information
about the x509 certificates generation. For more information about configuring
x509 certificates on a VM Host Server and the client, see Section 11.3.2, “Remote
TLS/SSL Connection with x509 Certificate ( qemu+tls or xen+tls )” and Sec-
tion 11.3.2.3, “Configuring the Client and Testing the Setup”.
Starts the VM Guest graphical output on VNC display number 5 (usually port
5905). The password suboption initializes a simple password-based authenti-
cation method. There is no password set by default and you need to set one
with the change vnc password command in QEMU monitor:
You need the -monitor stdio option here, because you would not be able to
manage the QEMU monitor without redirecting its input/output.
The QEMU VNC server can use TLS encryption for the session and x509 certifi-
cates for authentication. The server asks the client for a certificate and validates
it against the CA certificate. Use this authentication type if your company pro-
vides an internal certificate authority.
You can combine the password authentication with TLS encryption and x509
certificate authentication to create a two-layer authentication model for clients.
Remember to set the password in the QEMU monitor after you run the follow-
ing command:
For security reasons, you are advised to combine SASL authentication with TLS
encryption and x509 certificates:
Note
The following sections list selected useful QEMU monitor commands and their
purpose. To get the full list, enter help in the QEMU monitor command line.
To get help while using the console, use help or ? . To get help for a specific com-
mand, use help command .
info version
Shows the version of QEMU.
info commands
Lists available QMP commands.
info network
Shows the network state.
info chardev
Shows the character devices.
info block
Information about block devices, such as hard disks, floppy drives, or CD-ROMs.
info blockstats
Read and write statistics on block devices.
info registers
Shows the CPU registers.
info cpus
Shows information about available CPUs.
info history
Shows the command line history.
info irq
Shows the interrupt statistics.
info pic
Shows the i8259 (PIC) state.
info pci
Shows the PCI information.
info tlb
Shows virtual to physical memory mappings.
info mem
Shows the active virtual memory mappings.
info jit
Shows dynamic compiler information.
info kvm
Shows the KVM information.
info numa
Shows the NUMA information.
info usb
Shows the guest USB devices.
info usbhost
Shows the host USB devices.
info profile
Shows the profiling information.
info capture
Shows the capture (audio grab) information.
info snapshots
Shows the currently saved virtual machine snapshots.
info status
Shows the current virtual machine status.
info pcmcia
Shows the guest PCMCIA status.
info mice
Shows which guest mice are receiving events.
info vnc
Shows the VNC server status.
info name
Shows the current virtual machine name.
info uuid
Shows the current virtual machine UUID.
info usernet
Shows the user network stack connection states.
info migrate
Shows the migration status.
info balloon
Shows the balloon device information.
info qtree
Shows the device tree.
info qdm
Shows the qdev device model list.
info roms
Shows the ROMs.
info migrate_cache_size
Shows the current migration xbzrle (“Xor Based Zero Run Length Encoding”)
cache size.
info migrate_capabilities
Shows the status of the various migration capabilities, such as xbzrle compres-
sion.
info mtree
Shows the VM Guest memory hierarchy.
info trace-events
Shows available trace-events and their status.
You can confirm your new device by querying the block subsystem:
After the new drive is defined, it needs to be connected to a device so that the guest
can see it. The typical device would be a virtio-blk-pci or scsi-disk . To get
the full list of available driver values, run:
(qemu) device_add ?
name "VGA", bus PCI
name "usb-storage", bus usb-bus
[...]
name "virtio-blk-pci", bus virtio-bus
Tip
Devices added with the device_add command can be removed from the guest
with device_del . Enter help device_del on the QEMU monitor command
line for more information.
To release the device or file connected to the removable media device, use the
eject device command. Use the optional -f to force ejection.
To change removable media (like CD-ROMs), use the change device command.
The name of the removable media can be determined using the info block com-
mand:
sendkey ctrl-alt-f1
To list the key names used in the keys option, enter sendkey and press →| .
mouse_move dx dy [ dz ]
Move the active mouse pointer to the specified coordinates dx, dy with the op-
tional scroll axis dz.
mouse_button val
Change the state of the mouse buttons (1=left, 2=middle, 4=right).
mouse_set index
Set which mouse device receives events. Device index numbers can be obtained
with the info mice command.
To get information about the balloon device in the monitor console and to deter-
mine whether the device is enabled, use the info balloon command:
If the balloon device is enabled, use the balloon memory_in_MB command to set
the requested amount of memory:
x / fmt addr
Makes a virtual memory dump starting at address addr and formatted accord-
ing to the fmt string. The fmt string consists of three parameters
countformatsize :
The count parameter is the number of items to be dumped.
The format can be x (hex), d (signed decimal), u (unsigned decimal), o (oc-
tal), c (char) or i (assembly instruction).
The size parameter can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits).
On x86, h or w can be specified with the i format to respectively select 16 or
32-bit code instruction size.
xp / fmt addr
Makes a physical memory dump starting at address addr and formatted ac-
cording to the fmt string. The fmt string consists of three parameters
countformatsize :
The count parameter is the number of the items to be dumped.
The format can be x (hex), d (signed decimal), u (unsigned decimal), o (oc-
tal), c (char) or i (asm instruction).
The size parameter can be b (8 bits), h (16 bits), w (32 bits) or g (64 bits).
On x86, h or w can be specified with the i format to respectively select 16 or
32-bit code instruction size.
Managing snapshots in QEMU monitor is not officially supported by SUSE yet. The
information found in this section may be helpful in specific cases.
Virtual Machine snapshots are snapshots of the complete virtual machine including
the state of CPU, RAM, and the content of all writable disks. To use virtual machine
snapshots, you must have at least one non-removable and writable block device us-
ing the qcow2 disk image format.
Snapshots are helpful when you need to save your virtual machine in a particular
state. For example, after you have configured network services on a virtualized
server and want to quickly start the virtual machine in the same state that was saved
last. You can also create a snapshot after the virtual machine has been powered off
to create a backup state before you try something experimental and possibly make
VM Guest unstable. This section introduces the former case, while the latter is de-
scribed in Section 28.2.3, “Managing Snapshots of Virtual Machines with qemu-img”.
The following commands are available for managing snapshots in QEMU monitor:
savevm name
Creates a new virtual machine snapshot under the tag name or replaces an ex-
isting snapshot.
loadvm name
Loads a virtual machine snapshot tagged name .
delvm
Deletes a virtual machine snapshot.
info snapshots
Prints information about available snapshots.
stop
Suspends the execution of the virtual machine.
cont
Resumes the execution of the virtual machine.
system_reset
Resets the virtual machine. The effect is similar to the reset button on a physical
machine. This may leave the file system in an unclean state.
system_powerdown
Sends an ACPI shutdown request to the machine. The effect is similar to the
power button on a physical machine.
q or quit
Terminates QEMU immediately.
Live migration is only possible between VM Host Servers with the same CPU
features.
AHCI interface, VirtFS feature, and the -mem-path command line option are
not compatible with migration.
The guest on the source and destination hosts must be started in the same
way.
-snapshot qemu command line option should not be used for migration
(and this qemu command line option is not supported).
The postcopy mode is not yet supported in SUSE Linux Enterprise Server. It is
released as a technology preview only. For more information about postcopy ,
see http://wiki.qemu.org/Features/PostCopyLiveMigration↗.
2. The virtual machine is started on the destination host in the frozen listening
mode. The parameters used are the same as on the source host plus the
-incoming tcp: ip : port parameter, where ip specifies the IP address
and port specifies the port for listening to the incoming migration. If 0 is
set as IP address, the virtual machine listens on all interfaces.
3. On the source host, switch to the monitor console and use the
migrate -d tcp: destination_ip : port command to initiate the mi-
gration.
4. To determine the state of the migration, use the info migrate command
in the monitor console on the source host.
6. To set the maximum tolerable downtime for migration in seconds, use the
migrate_set_downtime number_of_seconds command.
7. To set the maximum speed for migration in bytes per second, use the
migrate_set_speed bytes_per_second command.
# qemu-system-x86_64 [...] \
-chardev stdio,id=mon0 \
-mon chardev=mon0,mode=control,pretty=on
<- {
"QMP": {
"version": {
"qemu": {
"micro": 0,
"minor": 0,
"major": 2
},
"package": ""
},
"capabilities": [
]
}
}
When a new QMP connection is established, QMP sends its greeting message and
enters capabilities negotiation mode. In this mode, only the qmp_capabilities
command works. To exit capabilities negotiation mode and enter command mode,
the qmp_capabilities command must be issued first:
QMP's commands can have arguments. For example to eject a CD-ROM drive, enter
the following:
"event": "DEVICE_TRAY_MOVED",
"data": {
"device": "ide1-cd0",
"tray-open": true
}
}
{
"return": {
}
}
# qemu-system-x86_64 [...] \
-chardev socket,id=mon0,host=localhost,port=4444,server,nowait \
-mon chardev=mon0,mode=control,pretty=on
You can create several monitor interfaces at the same time. The following example
creates one HMP instance—human monitor which understands 'normal' QEMU
monitor's commands—on the standard input/output, and one QMP instance on lo-
calhost port 4444:
# qemu-system-x86_64 [...] \
-chardev stdio,id=mon0 -mon chardev=mon0,mode=readline \
-chardev socket,id=mon1,host=localhost,port=4444,server,nowait \
-mon chardev=mon1,mode=control,pretty=on
# qemu-system-x86_64 [...] \
-qmp unix:/tmp/qmp-sock,server --monitor stdio
To communicate with the QEMU instance via the /tmp/qmp-sock socket, use nc
(see man 1 nc for more information) from another terminal on the same host:
# nc -U /tmp/qmp-sock
<- {"QMP": {"version": {"qemu": {"micro": 0, "minor": 0, "major": 2} [...]
In the above example, we ran the simple command query-kvm which checks if the
host is capable of running KVM and if KVM is enabled.
To use the standard human-readable output format of QEMU instead of the JSON
format, use the --hmp option:
31 Linux Containers
31.1 Setting Up LXC Distribution Containers
31.2 Setting Up LXC Application Containers
31.3 Securing a Container Using AppArmor
31.4 Differences Between the libvirt LXC Driver and LXC
31.5 For More Information
There is currently no GUI to create a root file system. You will thus need to
open a terminal and use virt-create-rootfs as root to populate the new
root file system. In the following steps, the new root file system will be cre-
ated in /path/to/rootfs .
2. Change the root path to the root file system with the chroot command:
chroot /path/to/rootfs
useradd -m operator
passwd operator
3. Select the localhost (LXC) connection and click File New Virtual Machine menu.
5. Type the path to the root file system from Procedure 31.1, “Creating a Root
File System” and click the Forward button.
6. Choose the maximum amount of memory and CPUs to allocate to the con-
tainer. Then click the Forward button.
7. Type in a name for the container. This name will be used for all virsh com-
mands on the container.
Click Advanced options. Select the network to connect the container to and
click the Finish button: the container will then be created and started. A con-
sole will also be automatically opened.
3. Select the localhost (LXC) connection and click File New Virtual Machine menu.
5. Choose the maximum amount of memory and CPUs to allocate to the con-
tainer. Click Forward.
6. Type in a name for the container. This name will be used for all virsh com-
mands on the container.
Click Advanced options. Select the network to connect the container to and
click Finish. The container will be created and started. A console will be
opened automatically.
Note that the container will be destroyed after the application has finished
running.
2. Add the following to the XML configuration, save it and exit the editor.
<domain>
...
<seclabel type="dynamic" model="apparmor"/>
...
</domain>
3. With this configuration, an AppArmor profile for the container will be cre-
ated in the /etc/apparmor.d/libvirt directory. The default profile only
allows the minimum applications to run in the container. This can be
changed by modifying the libvirt- container-uuid file: this file is not
overwritten by libvirt.
The main difference is that domain configuration in libvirt is an XML file, while LXC
configuration is a properties file. Most of the LXC properties can be mapped to the
domain XML. The properties that cannot be migrated are:
lxc.devttydir: libvirt does not allow changing the location of the console de-
vices.
lxc.console: there is currently no way to log the output of the console into a
file on the host for libvirt LXC containers.
lxc.pivotdir: libvirt does not allow to fine-tune the directory used for the
pivot_root . /.olroot is used.
LXC VLAN networks automatically create the VLAN interface on the host and then
move it into the guest namespace. libvirt-lxc configuration can mention a VLAN tag
ID only for Open vSwitch tap devices or PCI pass-through of SR-IOV VF. The conver-
sion tool actually needs the user to manually create the VLAN interface on the host
side.
LXC rootfs can also be an image file, but LXC brute-forces the mount to try to detect
the proper file system format. libvirt-lxc can mount image files of several formats,
but the 'auto' value for the format parameter is explicitly not supported. This means
that the generated configuration will need to be tweaked by the user to get a proper
match in that case.
LXC can support any cgroup configuration, even future ones, while libvirt domain
configuration, needs to map each of them.
LXC can mount block devices in the rootfs, but it cannot mount raw partition files:
the file needs to be manually attached to a loop device. On the other hand libvirt-lxc
can mount block devices, but also partition files of any format.
Since SUSE Linux Enterprise Server 12, LXC is integrated into libvirt library. This
decision has several advantages over using LXC as a separate solution—such as a
unified approach with other virtualization solutions or independence on the kernel
used. This chapter describes steps needed to migrate an existing LXC environment
for use with the libvirt library.
1. Upgrade the host to SUSE Linux Enterprise Server 12 using the official DVD
media.
4. Check if the network configuration on the host is the same as in the con-
tainer configuration file, and fix it if needed.
1. The baseproduct file is missing (and zypper keeps complaining about it).
Create the relevant symbolic link:
# ROOTFS=/var/lib/lxc/lxc_container/rootfs
# ln -s $ROOTFS/etc/products.d/SUSE_SLES.prod $ROOTFS/etc/products.d/baseproduct
2. Add the DVD repository. Note that you need to replace the DVD device with
the one attached to your container:
If you need to get a console to view the logging messages produced by the con-
tainer, run:
Glossary
General
Create Virtual Machine Wizard
A software program available in YaST and Virtual Machine Manager that pro-
vides a graphical interface to guide you through the steps to create virtual ma-
chines. It can also be run in text mode by entering virt-install at a com-
mand prompt in the host environment.
Dom0
The term is used in Xen environments, and refers to a virtual machine. The host
operating system is actually a virtual machine running in a privileged domain
and can be called Dom0. All other virtual machines on the host run in unprivi-
leged domains and can be called domain U's.
hardware-assisted
Intel* and AMD* provide virtualization hardware-assisted technology. This re-
duces frequency of VM IN/OUT (fewer VM traps), because software is a major
source of overhead, and increases the efficiency (the execution is done by the
hardware). Moreover this reduces the memory footprint, provides better re-
source control, and allows secure assignment of specific I/O devices.
Host Environment
The desktop or command line environment that allows interaction with the host
computer's environment. It provides a command line environment and can also
include a graphical desktop, such as GNOME or IceWM. The host environment
runs as a special type of virtual machine that has privileges to control and man-
age other virtual machines. Other commonly used terms include Dom0, privi-
leged domain, and host operating system.
Hypervisor
The software that coordinates the low-level interaction between virtual ma-
chines and the underlying physical computer hardware.
KVM
See Chapter 3, Introduction to KVM Virtualization
VHS
Virtualization Host Server
The physical computer running a SUSE virtualization platform software. The vir-
tualization environment consists of the hypervisor, the host environment, vir-
tual machines, and associated tools, commands, and configuration files. Other
commonly used terms include host, Host Computer, Host Machine (HM), Virtual
Server (VS), Virtual Machine Host (VMH), and VM Host Server (VHS).
VirtFS
Virtual Machine
A virtualized PC environment (VM) capable of hosting a guest operating system
and associated applications. Could be also called a VM Guest.
Virtualized
A guest operating system or application running on a virtual machine.
Xen
See Chapter 2, Introduction to Xen Virtualization
xl
A set of commands for Xen that lets administrators manage virtual machines
from a command prompt on the host computer. It replaced the deprecated xm
tool stack.
CPU
CPU capping
Virtual CPU capping allows you to set vCPU capacity to 1–100 percent of the
physical CPU capacity.
CPU hotplugging
CPU hotplugging is used to describe the functions of replacing/adding/removing
a CPU without shutting down the system.
CPU over-commitment
Virtual CPU over-commitment is the ability to assign more virtual CPUs to VMs
than the actual number of physical CPUs present in the physical system. This
procedure does not increase the overall performance of the system, but might
be useful for testing purposes.
CPU pinning
Processor affinity, or CPU pinning enables the binding and unbinding of a
process or a thread to a central processing unit (CPU) or a range of CPUs.
Network
Bridged Networking
A type of network connection that lets a virtual machine be identified on an ex-
ternal network as a unique identity that is separate from and unrelated to its
host computer.
Empty Bridge
A type of network bridge that has no physical network device or virtual network
device provided by the host. This lets virtual machines communicate with other
virtual machines on the same host but not with the host or on an external net-
work.
External Network
The network outside a host's internal network environment.
Internal Network
A type of network configuration that restricts virtual machines to their host envi-
ronment.
Local Bridge
A type of network bridge that has a virtual network device but no physical net-
work device provided by the host. This lets virtual machines communicate with
the host and other virtual machines on the host. Virtual machines can communi-
cate on an external network through the host.
No Host Bridge
A type of network bridge that has a physical network device but no virtual net-
work device provided by the host. This lets virtual machines communicate on an
external network but not with the host. This lets you separate virtual machine
network communications from the host environment.
Traditional Bridge
A type of network bridge that has both a physical network device and a virtual
network device provided by the host.
Storage
AHCI
The Advanced Host Controller Interface (AHCI) is a technical standard defined by
Intel* that specifies the operation of Serial ATA (SATA) host bus adapters in a
non-implementation-specific manner.
Block Device
Data storage devices, such as CD-ROM drives or disk drives, that move data in
the form of blocks. Partitions and volumes are also considered block devices.
Raw Disk
A method of accessing data on a disk at the individual byte level instead of
through its file system.
xvda
The drive designation given to the first virtual disk on a paravirtual machine.
Linux Containers
cgroups
Kernel Control Groups (commonly called “cgroups”) are a Kernel feature that al-
lows aggregating or partitioning tasks (processes) and all their children into hier-
archical organized groups to isolate resources.
See also Book “System Analysis and Tuning Guide”, Chapter 9 “Kernel Control
Groups”.
chroot
A change root (chroot, or change root jail) is a section in the file system that is
isolated from the rest of the file system. For this purpose, the chroot or
pivot_root command is used to change the root of the file system. A program
that is executed in such a “chroot jail” cannot access files outside the designated
directory tree.
container
Can be seen as a kind of “virtual machine” on the host server that can run any
Linux system, for example openSUSE, SUSE Linux Enterprise Desktop, or SUSE
Linux Enterprise Server. The main difference with a normal virtual machine is
that the container shares its kernel with the host it runs on.
Kernel namespaces
A Kernel feature to isolate some resources like network, users, and others for a
group of processes.
Acronyms
ACPI
Advanced Configuration and Power Interface (ACPI) specification provides an
open standard for device configuration and power management by the operat-
ing system.
AER
Advanced Error Reporting
AER is a capability provided by the PCI Express specification which allows for re-
porting of PCI errors and recovery from some of them.
APIC
Advanced Programmable Interrupt Controller (APIC) is a family of interrupt con-
trollers.
BDF
Bus:Device:Function
Notation used to succinctly describe PCI and PCIe devices.
CG
Control Groups
Feature to limit, account and isolate resource usage (CPU, memory, disk I/O,
etc.).
EDF
Earliest Deadline First
This scheduler provides weighted CPU sharing in an intuitive way and uses
real-time algorithms to ensure time guarantees.
EPT
Extended Page Tables
Performance in a virtualized environment is close to that in a native environ-
ment. Virtualization does create some overheads, however. These come from
the virtualization of the CPU, the MMU, and the I/O devices. In some recent x86
processors AMD and Intel have begun to provide hardware extensions to help
bridge this performance gap. In 2006, both vendors introduced their first gener-
ation hardware support for x86 virtualization with AMD-Virtualization (AMD-V)
and Intel® VT-x technologies. Recently Intel introduced its second generation of
hardware support that incorporates MMU-virtualization, called Extended Page
Tables (EPT). EPT-enabled systems can improve performance compared to using
shadow paging for MMU virtualization. EPT increases memory access latencies
for a few workloads. This cost can be reduced by effectively using large pages in
the guest and the hypervisor.
FLASK
Flux Advanced Security Kernel
Xen implements a type of mandatory access control via a security architecture
called FLASK using a module of the same name.
HAP
High Assurance Platform
HAP combines hardware and software technologies to improve workstation and
network security.
HVM
Hardware Virtual Machine (commonly called like this by Xen).
IOMMU
Input/Output Memory Management Unit
IOMMU (AMD* technology) is a memory management unit (MMU) that connects
a direct memory access-capable (DMA-capable) I/O bus to the main memory.
KSM
Kernel Same Page Merging
KSM allows for automatic sharing of identical memory pages between guests to
save host memory. KVM is optimized to use KSM if enabled on the VM Host
Server.
MMU
Memory Management Unit
is a computer hardware component responsible for handling accesses to mem-
ory requested by the CPU. Its functions include translation of virtual addresses
to physical addresses (that is, virtual memory management), memory protec-
tion, cache control, bus arbitration and in simpler computer architectures (espe-
cially 8-bit systems) bank switching.
PAE
Physical Address Extension
32-bit x86 operating systems use Physical Address Extension (PAE) mode to en-
able addressing of more than 4 GB of physical memory. In PAE mode, page table
entries (PTEs) are 64 bits in size.
PCID
Process-context identifiers
These are a facility by which a logical processor may cache information for multi-
ple linear-address spaces so that the processor may retain cached information
when software switches to a different linear address space. INVPCID instruction
is used for fine-grained TLB flush, which is benefit for kernel.
PCIe
Peripheral Component Interconnect Express
PCIe was designed to replace older PCI, PCI-X and AGP bus standards. PCIe has
numerous improvements including a higher maximum system bus throughput,
a lower I/O pin count and smaller physical footprint. Moreover it also has a
more detailed error detection and reporting mechanism (AER), and a native hot-
plug functionality. It is also backward compatible with PCI.
PT
Page Table
A page table is the data structure used by a virtual memory system in a com-
puter operating system to store the mapping between virtual addresses and
physical addresses. Virtual addresses are those unique to the accessing process.
Physical addresses are those unique to the hardware (RAM).
QXL
QXL is a cirrus VGA framebuffer (8M) driver for virtualized environment.
RVI or NPT
Rapid Virtualization Indexing, Nested Page Tables
An AMD second generation hardware-assisted virtualization technology for the
processor memory management unit (MMU).
SATA
Serial ATA
SATA is a computer bus interface that connects host bus adapters to mass stor-
age devices such as hard disks and optical drives.
Seccomp2-based sandboxing
Sandboxed environment where only predetermined system calls are permitted
for added protection against malicious behavior.
SMEP
Supervisor Mode Execution Protection
This prevents the execution of user-mode pages by the Xen hypervisor, making
many application-to-hypervisor exploits much harder.
SPICE
Simple Protocol for Independent Computing Environments
SXP
An SXP file is a Xen Configuration File.
TCG
Tiny Code Generator
Instructions are emulated rather than executed by the CPU.
THP
Transparent Huge Pages
This allows CPUs to address memory using pages larger than the default 4 KB.
This helps reduce memory consumption and CPU cache usage. KVM is opti-
mized to use THP (via madvise and opportunistic methods) if enabled on the VM
Host Server.
TLB
Translation Lookaside Buffer
TLB is a cache that memory management hardware uses to improve virtual ad-
dress translation speed. All current desktop, notebook, and server processors
use a TLB to map virtual and physical address spaces, and it is nearly always
present in any hardware that uses virtual memory.
VCPU
A scheduling entity, containing each state for virtualized CPU.
VDI
Virtual Desktop Infrastructure
VFIO
Since kernel v3.6; a new method of accessing PCI devices from user space called
VFIO.
VHS
Virtualization Host Server
VM root
VMM will run in VMX root operation and guest software will run in VMX
non-root operation. Transitions between VMX root operation and VMX non-root
operation are called VMX transitions.
VMCS
Virtual Machine Control Structure
VMX non-root operation and VMX transitions are controlled by a data structure
called a virtual-machine control structure (VMCS). Access to the VMCS is man-
aged through a component of processor state called the VMCS pointer (one per
logical processor). The value of the VMCS pointer is the 64-bit address of the
VMCS. The VMCS pointer is read and written using the instructions VMPTRST
and VMPTRLD. The VMM configures a VMCS using the VMREAD, VMWRITE, and
VMCLEAR instructions. A VMM could use a different VMCS for each virtual ma-
chine that it supports. For a virtual machine with multiple logical processors (vir-
tual processors), the VMM could use a different VMCS for each virtual processor.
VMDq
Virtual Machine Device Queue
Multi-queue network adapters exist which support multiple VMs at the hard-
ware level, having separate packet queues associated to the different hosted
VMs (by means of the IP addresses of the VMs).
VMM
Virtual Machine Monitor (Hypervisor)
When the processor encounters an instruction or event of interest to the Hyper-
visor (VMM), it exits from guest mode back to the VMM. The VMM emulates the
instruction or other event, at a fraction of native speed, and then returns to
guest mode. The transitions from guest mode to the VMM and back again are
high-latency operations, during which guest execution is completely stalled.
VMX
Virtual Machine eXtensions
VPID
New support for software control of TLB (VPID improves TLB performance with
small VMM development effort).
VT-d
Virtualization Technology for Directed I/O
Like IOMMU for Intel*↗.
vTPM
Component to establish end-to-end integrity for guests via Trusted Computing.
The SUSE Linux Enterprise Virtual Machine Driver Pack (VMDP) contains 32-bit and
64-bit paravirtualized network, bus and block drivers for several Microsoft Windows
operating systems. These drivers bring many of the performance advantages of par-
avirtualized operating systems to unmodified operating systems because only the
paravirtualized device driver (not the rest of the operating system) is aware of the
virtualization platform. For example, a paravirtualized disk device driver appears as
a normal, physical disk to the operating system. However, the device driver interacts
directly with the virtualization platform (with no emulation) to efficiently deliver disk
access, allowing the disk and network subsystems to operate at near native speeds
in a virtualized environment, without requiring changes to existing operating sys-
tems.
The SUSE® Linux Enterprise Virtual Machine Driver Pack is available as an add-on
product for SUSE Linux Enterprise Server. For detailed information refer to
http://www.suse.com/products/vmdriverpack/↗.
B Appendix
B.1 Installing Paravirtualized Drivers
B.2 Generating x509 Client/Server Certificates
Export the client and server certificates to a temporary location (for exam-
ple, /tmp/x509/ ) by performing the following steps:
c. Open a terminal and change to the directory where you have saved
the certificate and issue the following commands to split it into certifi-
cate and key (this example splits the server key):
d. Repeat the procedure for each client and server certificate you want
to export.
Although SLES 11 SP3 contains Xen 4.2, SUSE retained the xend toolstack since
making such an invasive change in a service pack would be too disruptive for SUSE
Linux Enterprise customers. However, SLES 12 provides a suitable opportunity to
move to the new libxl toolstack and remove the deprecated, unmaintained xend
stack. Starting with SUSE Linux Enterprise Server 12 SP1, xend is no longer sup-
ported.
One of the major differences between xend and libxl is that the former is stateful,
while the latter is stateless. With xend , all client applications such as xm and
libvirt see the same system state. xend is responsible for maintaining state for
the entire Xen host. In libxl, client applications such as xl or libvirt must main-
tain state. Thus domains created with xl or not visible or known to other libxl ap-
plications such as libvirt . Generally, it is discouraged to mix and match libxl ap-
plications and is preferred that a single libxl application be used to manage a Xen
host. In SUSE Linux Enterprise 12 , it is recommended to use libvirt to manage
Xen hosts, allowing management of the Xen system through libvirt applications
such as virt-manager , virt-install , virt-viewer , libguestfs, etc. If xl is
used to manage the Xen host, any virtual machines under its management will not
be accessible to libvirt , and hence not accessible to any of the libvirt applica-
tions.
C.1.2 XL design
The basic structure of every xl command is:
DOMAIN is the numeric domain id, or the domain name (which will be internally
translated to domain id), and OPTIONS are subcommand specific options.
xl/libxl does not support Python code in the domain configuration files.
xl/libxl does not support creating domains from SXP format configuration
files ( xm create -F).
xl/libxl does not support sharing storage across DomU's via w! in domain
configuration files.
xl/libxl is relatively new and under heavy development, hence a few features are still
missing with regard to the xm/xend toolstack:
Support Direct Kernel Boot for fully virtualized Linux guests for Xen does not
work anymore.
You must remove any Python code from your xm domain configuration files.
It is recommended to capture the libvirt domain XML from all existing virtual
machines using virsh dumpxml DOMAIN_NAME DOMAIN_NAME.xml .
Note
Currently, live migrating virtual machines running on a SLES 11 SP3 Xen host to a
SLES 12 Xen host is not supported. The xend and libxl toolstacks are not run-
time-compatible. Virtual machine downtime will be required to move the virtual
machines from SLES 11 SP3 to a SLES 12 host.
-h , --help
Prints short information about xen2libvirt usage.
-c , --convert-only
Converts the domain configuration to the libvirt XML format, but does not
do the import to libvirt .
-r , --recursive
Converts and/or imports all domains configuration recursively, starting at the
specified path.
-f , --format
Specifies the format of the source domain configuration. Can be either xm , or
sexpr (S-expression format).
-v , --verbose
Prints more detailed information about the import process.
Suppose you have a Xen domain managed with xm with the following configu-
ration saved in /etc/xen/sle12.xm :
kernel = "/boot/vmlinuz-2.6-xenU"
memory = 128
name = "SLE12"
root = "/dev/hda1 ro"
disk = [ "file:/var/xen/sle12.img,hda1,w" ]
Convert it to libvirt XML without importing it, and look at its content:
To import the domain into libvirt , you can either run the same
xen2libvirt command without the -c option, or use the exported file
/etc/libvirt/qemu/sles12.xml and define a new Xen domain using
virsh :
You can also use the libvirt framework using the virsh command. In this docu-
mentation only the first OPTION for virsh will be shown. To get more help on this
option do a:
Notation Meaning
(-) minus Option exists in xm , but xl does not include it.
(+) plus Option exists in xl , but xm does not include it.
Op-
Task
tions
(+)
Verbose, increase the verbosity of the output
-v
(+)
Dry run, do not actually execute the command
-N
Force execution. xl will refuse to run some commands if it detects that
(+)
xend is also running, this option will force the execution of those com-
-f
mands, even though it is unsafe
sysrq
virsh send-keys can send Magic
DOMAIN <let-
Sys Req only for KVM
ter>
C.3.5.1 create
xl create CONFIG_FILE OPTIONS VARS
virsh create
C.3.5.2 console
xl console OPTIONS DOMAIN
virsh console
C.3.5.3 info
xl info
C.3.5.4 dump-core
xl dump-core DOMAIN FILENAME
virsh dump
C.3.5.5 list
xl list options DOMAIN
C.3.5.6 mem-*
virsh setmem
virsh setmaxmem
C.3.5.7 migrate
xl migrate OPTIONS DOMAIN HOST
virsh reboot
virsh save
virsh restore
virsh shutdown
C.3.5.9 xl sched-*
xl sched-credit OPTIONS
virsh schedinfo
xl sched-credit2 OPTIONS
xl sched-sedf OPTIONS
C.3.5.10 xl cpupool-*
xl cpupool-cpu-remove CPU_POOL <CPU nr>|node:<node nr>
virsh detach-device
C.3.5.12 Network
Removed Options
Option Task
(-) -l , --long
Options Task
Update the saved configuration for a running do-
main. This has no immediate effect but will be ap-
config-update DOMAIN
plied when the guest is next restarted. This com-
CONFIG_FILE OPTIONS
mand is useful to ensure that runtime modifications
VARS
made to the guest will be preserved when the guest
is restarted
migrate-receive
List count of shared pages.List specifically for that do-
sharing DOMAIN
main. Otherwise, list for all domains
Prints information about guests. This list excludes in-
vm-list formation about service or auxiliary domains such as
Dom0 and stubdoms
cpupool-rename
Renames a cpu-pool to newname
CPU_POOL NEWNAME
Splits up the machine into one cpu-pool per numa
cpupool-numa-split
node
Insert a CD-ROM into a guest domain's existing vir-
cd-insert DOMAIN <Virtu-
tual CD drive. The virtual drive must already exist but
alDevice> <type:path>
can be current empty
cd-eject DOMAIN <Virtu- Eject a CD-ROM from a guest's virtual CD drive. Only
alDevice> works with HVM domains
List all the assignable PCI devices. These are devices
in the system which are configured to be available
pci-assignable-list
for pass-through and are bound to a suitable PCI
back-end driver in Dom0 rather than a real driver
Make the device at PCI Bus/Device/Function BDF as-
pci-assignable-add
signable to guests.This will bind the device to the
<BDF>
pciback driver
Make the device at PCI Bus/Device/Function BDF as-
pci-assignable-remove
signable to guests. This will at least unbind the device
OPTIONS <BDF>
from pciback
Load FLASK policy from the given policy file. The ini-
tial policy is provided to the hypervisor as a multi-
loadpolicy
boot module; this command allows runtime updates
POLICY_FILE
to the policy. Loading new security policy will reset
runtime changes to device labels
XL in Xen
XL in Xen 4.2↗
xl command
XL↗ command line.
xl.cfg
xl.cfg↗ domain configuration file syntax.
xl disk
xl disk↗ configuration option.
XL vs Xend
XL vs Xend↗ feature comparison.
BDF doc
BDF documentation↗.
libvirt
virsh↗ command.
D Documentation Updates
D.1 November 2016 (Release of SUSE Linux Enterprise Server 12 SP2)
D.2 March 2016 (Maintenance Release of SUSE Linux Enterprise Server 12
SP1)
D.3 December 2015 (Initial Release of SUSE Linux Enterprise Server 12 SP1)
D.4 February 2015 (Documentation Maintenance Update)
D.5 October 2014 (Initial Release of SUSE Linux Enterprise Server 12)
Section D.3, “December 2015 (Initial Release of SUSE Linux Enterprise Server
12 SP1)”
Section D.5, “October 2014 (Initial Release of SUSE Linux Enterprise Server
12)”
General
Added tip about changing the default boot kernel in Section 6.2, “In-
stalling Xen”.
Moved and adjusted two network sections from Chapter 19, Virtual Net-
working to Section 13.2.3, “Using VLAN Interfaces” and Section 13.2.1.1,
“Adding a Network Bridge”.
Removed the deprecated tool vm-install across the whole guide (Fate
#319659).
Updated parts of the guide that refer to Virtual Machine Manager and
virt-viewer to work with versions 1.4 and 4.0 of those software pack-
ages, respectively (Fate #319990).
Extended the <dhcp> element with <host> for assigning the predefined
IP and host name in Example 13.1, “NAT Based Network” (Fate #320265).
Fixed loading igb driver Section 14.11.2, “Loading and Configuring the
SR-IOV Host Drivers”.
Use kvm-clock together with NTP (Section 16.1, “KVM: Using kvm_clock
”, https://bugzilla.suse.com/show_bug.cgi?id=994806↗).
Added Section 28.2.2.5, “Advanced Options for the qcow2 File Format”.
Bugfixes
Book “Subscription Management Tool for SLES 12 SP2” is now part of the
documentation for SUSE Linux Enterprise Server.
The registration service has been changed from Novell Customer Center
to SUSE Customer Center.
In YaST, you will now reach Network Settings via the System group. Net-
work Devices is gone (https://bugzilla.suse.com/show_bug.cgi?id=867809
↗).
General
Added Section 12.5, “ Sharing Directories between Host and Guests (File
System Pass-Through) ”.
Added new list item for hosts in different subnets in Section 23.3, “Mi-
grating Xen VM Guest Systems” (Fate #303927).
Added the whole chapter and moved virtio related KVM content to a
subsidiary Section 27.3, “KVM Host-Specific Features”.
Added support for e1000 network card variants in Section 29.4.1, “Defin-
ing a Network Interface Card”.
Bugfixes
Added Section 12.5, “ Sharing Directories between Host and Guests (File
System Pass-Through) ” (https://bugzilla.suse.com
/show_bug.cgi?id=783346↗).
Bugfixes
Removed all references to ISDN support, as ISDN support has been re-
moved (Fate #314594).
Btrfs has become the default file system for the root partition (Fate
#315901). Updated affected parts of the documentation.
syslog and syslog-ng have been replaced by rsyslog (Fate #316175). Up-
dated affected parts of the documentation.
Novell Customer Center has been replaced with SUSE Customer Center.
Updated affected parts of the documentation.
The following architectures are no longer supported: IA64 and x86. Up-
dated affected parts of the documentation.
The traditional method for setting up the network with ifconfig has
been replaced by wicked . Updated affected parts of the documenta-
tion.
Part I, “Introduction”
Bugfixes
E GNU Licenses
E.1 GNU Free Documentation License
This appendix contains the GNU Free Documentation License version 1.2.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other functional and useful document "free" in
the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or non-commercially. Secondarily, this License preserves for the author and
publisher a way to get credit for their work, while not being considered responsible for modifications made by
others.
This License is a kind of "copyleft", which means that derivative works of the document must themselves be
free in the same sense. It complements the GNU General Public License, which is a copyleft license designed
for free software.
We have designed this License to use it for manuals for free software, because free software needs free docu-
mentation: a free program should come with manuals providing the same freedoms that the software does.
But this License is not limited to software manuals; it can be used for any textual work, regardless of subject
matter or whether it is published as a printed book. We recommend this License principally for works whose
purpose is instruction or reference.
A "Modified Version" of the Document means any work containing the Document or a portion of it, either
copied verbatim, or with modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of the Document that deals exclusively
with the relationship of the publishers or authors of the Document to the Document's overall subject (or to re-
lated matters) and contains nothing that could fall directly within that overall subject. (Thus, if the Document is
in part a textbook of mathematics, a Secondary Section may not explain any mathematics.) The relationship
could be a matter of historical connection with the subject or with related matters, or of legal, commercial,
philosophical, ethical or political position regarding them.
The "Invariant Sections" are certain Secondary Sections whose titles are designated, as being those of Invariant
Sections, in the notice that says that the Document is released under this License. If a section does not fit the
above definition of Secondary then it is not allowed to be designated as Invariant. The Document may contain
zero Invariant Sections. If the Document does not identify any Invariant Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed, as Front-Cover Texts or Back-Cover Texts, in
the notice that says that the Document is released under this License. A Front-Cover Text may be at most 5
words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy, represented in a format whose speci-
fication is available to the general public, that is suitable for revising the document straightforwardly with
generic text editors or (for images composed of pixels) generic paint programs or (for drawings) some widely
available drawing editor, and that is suitable for input to text formatters or for automatic translation to a vari-
ety of formats suitable for input to text formatters. A copy made in an otherwise Transparent file format whose
markup, or absence of markup, has been arranged to thwart or discourage subsequent modification by read-
ers is not Transparent. An image format is not Transparent if used for any substantial amount of text. A copy
that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input format,
LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming simple HTML, Post-
Script or PDF designed for human modification. Examples of transparent image formats include PNG, XCF and
JPG. Opaque formats include proprietary formats that can be read and edited only by proprietary word proces-
sors, SGML or XML for which the DTD and/or processing tools are not generally available, and the machine-
generated HTML, PostScript or PDF produced by some word processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself, plus such following pages as are needed to
hold, legibly, the material this License requires to appear in the title page. For works in formats which do not
have any title page as such, "Title Page" means the text near the most prominent appearance of the work's ti-
tle, preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose title either is precisely XYZ or con-
tains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands for a specific
section name mentioned below, such as "Acknowledgements", "Dedications", "Endorsements", or "History".) To
"Preserve the Title" of such a section when you modify the Document means that it remains a section "Entitled
XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies to
the Document. These Warranty Disclaimers are considered to be included by reference in this License, but only
as regards disclaiming warranties: any other implication that these Warranty Disclaimers may have is void and
has no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or non-commercially, pro-
vided that this License, the copyright notices, and the license notice saying this License applies to the Docu-
ment are reproduced in all copies, and that you add no other conditions whatsoever to those of this License.
You may not use technical measures to obstruct or control the reading or further copying of the copies you
make or distribute. However, you may accept compensation in exchange for copies. If you distribute a large
enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have printed covers) of the Document, num-
bering more than 100, and the Document's license notice requires Cover Texts, you must enclose the copies in
covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover, and Back-Cover
Texts on the back cover. Both covers must also clearly and legibly identify you as the publisher of these copies.
The front cover must present the full title with all words of the title equally prominent and visible. You may add
other material on the covers in addition. Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed (as
many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either in-
clude a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque
copy a computer-network location from which the general network-using public has access to download using
public-standard network protocols a complete Transparent copy of the Document, free of added material. If
you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaque
copies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location until
at least one year after the last time you distribute an Opaque copy (directly or through your agents or retailers)
of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing any
large number of copies, to give them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and 3
above, provided that you release the Modified Version under precisely this License, with the Modified Version
filling the role of the Document, thus licensing distribution and modification of the Modified Version to who-
ever possesses a copy of it. In addition, you must do these things in the Modified Version:
1. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and from
those of previous versions (which should, if there were any, be listed in the History section of the Doc-
ument). You may use the same title as a previous version if the original publisher of that version gives
permission.
2. List on the Title Page, as authors, one or more persons or entities responsible for authorship of the
modifications in the Modified Version, together with at least five of the principal authors of the Docu-
ment (all of its principal authors, if it has fewer than five), unless they release you from this require-
ment.
3. State on the Title page the name of the publisher of the Modified Version, as the publisher.
5. Add an appropriate copyright notice for your modifications adjacent to the other copyright notices.
6. Include, immediately after the copyright notices, a license notice giving the public permission to use
the Modified Version under the terms of this License, in the form shown in the Addendum below.
7. Preserve in that license notice the full lists of Invariant Sections and required Cover Texts given in the
Document's license notice.
9. Preserve the section Entitled "History", Preserve its Title, and add to it an item stating at least the title,
year, new authors, and publisher of the Modified Version as given on the Title Page. If there is no sec-
tion Entitled "History" in the Document, create one stating the title, year, authors, and publisher of the
Document as given on its Title Page, then add an item describing the Modified Version as stated in the
previous sentence.
10. Preserve the network location, if any, given in the Document for public access to a Transparent copy of
the Document, and likewise the network locations given in the Document for previous versions it was
based on. These may be placed in the "History" section. You may omit a network location for a work
that was published at least four years before the Document itself, or if the original publisher of the ver-
sion it refers to gives permission.
11. For any section Entitled "Acknowledgements" or "Dedications", Preserve the Title of the section, and
preserve in the section all the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
12. Preserve all the Invariant Sections of the Document, unaltered in their text and in their titles. Section
numbers or the equivalent are not considered part of the section titles.
13. Delete any section Entitled "Endorsements". Such a section may not be included in the Modified Ver-
sion.
14. Do not retitle any existing section to be Entitled "Endorsements" or to conflict in title with any Invariant
Section.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections
and contain no material copied from the Document, you may at your option designate some or all of these
sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version's li-
cense notice. These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains nothing but endorsements of your Modi-
fied Version by various parties--for example, statements of peer review or that the text has been approved by
an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words as a
Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage of Front-Cover
Text and one of Back-Cover Text may be added by (or through arrangements made by) any one entity. If the
Document already includes a cover text for the same cover, previously added by you or by arrangement made
by the same entity you are acting on behalf of, you may not add another; but you may replace the old one, on
explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names for
publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under the terms defined
in section 4 above for modified versions, provided that you include in the combination all of the Invariant Sec-
tions of all of the original documents, unmodified, and list them all as Invariant Sections of your combined
work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections may
be replaced with a single copy. If there are multiple Invariant Sections with the same name but different con-
tents, make the title of each such section unique by adding at the end of it, in parentheses, the name of the
original author or publisher of that section if known, or else a unique number. Make the same adjustment to
the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History" in the various original documents, form-
ing one section Entitled "History"; likewise combine any sections Entitled "Acknowledgements", and any sec-
tions Entitled "Dedications". You must delete all sections Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under this License, and
replace the individual copies of this License in the various documents with a single copy that is included in the
collection, provided that you follow the rules of this License for verbatim copying of each of the documents in
all other respects.
You may extract a single document from such a collection, and distribute it individually under this License, pro-
vided you insert a copy of this License into the extracted document, and follow this License in all other re-
spects regarding verbatim copying of that document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if the Document
is less than one half of the entire aggregate, the Document's Cover Texts may be placed on covers that bracket
the Document within the aggregate, or the electronic equivalent of covers if the Document is in electronic
form. Otherwise they must appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the Document under the
terms of section 4. Replacing Invariant Sections with translations requires special permission from their copy-
right holders, but you may include translations of some or all Invariant Sections in addition to the original ver-
sions of these Invariant Sections. You may include a translation of this License, and all the license notices in
the Document, and any Warranty Disclaimers, provided that you also include the original English version of
this License and the original versions of those notices and disclaimers. In case of a disagreement between the
translation and the original version of this License or a notice or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements", "Dedications", or "History", the requirement (sec-
tion 4) to Preserve its Title (section 1) will typically require changing the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly provided for under this
License. Any other attempt to copy, modify, sublicense or distribute the Document is void, and will automati-
cally terminate your rights under this License. However, parties who have received copies, or rights, from you
under this License will not have their licenses terminated so long as such parties remain in full compliance.
Each version of the License is given a distinguishing version number. If the Document specifies that a particu-
lar numbered version of this License "or any later version" applies to it, you have the option of following the
terms and conditions either of that specified version or of any later version that has been published (not as a
draft) by the Free Software Foundation. If the Document does not specify a version number of this License, you
may choose any version ever published (not as a draft) by the Free Software Foundation.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the “with...Texts.” line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those two
alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples in
parallel under your choice of free software license, such as the GNU General Public License, to permit their use
in free software.