book virtualization xen
TRANSCRIPT
-
8/12/2019 Book Virtualization Xen
1/98
SUSE Linux EnterpriseServer
-
8/12/2019 Book Virtualization Xen
2/98
Virtualization with Xen
All content is copyright Novell, Inc.
Legal Notice
This manual is protected under Novell intellectual property rights. By reproducing, duplicating or
distributing this manual you explicitly agree to conform to the terms and conditions of this license
agreement.
This manual may be freely reproduced, duplicated and distributed either as such or as part of a bundled
package in electronic and/or printed format, provided however that the following conditions are ful-lled:
That this copyright notice and the names of authors and contributors appear clearly and distinctively
on all reproduced, duplicated and distributed copies. That this manual, specically for the printed
format, is reproduced and/or distributed for noncommercial use only. The express authorization of
Novell, Inc must be obtained prior to any other use of any manual or part thereof.
For Novell trademarks, see the Novell Trademark and Service Mark list http://www.novell
.com/company/legal/trademarks/tmlist.html . * Linux is a registered trademark of
Linus Torvalds. All other third party trademarks are the property of their respective owners. A trademark
symbol (, etc.) denotes a Novell trademark; an asterisk (*) denotes a third party trademark.
All information found in this book has been compiled with utmost attention to detail. However, this
does not guarantee complete accuracy. Neither Novell, Inc., SUSE LINUX Products GmbH, the authors,
nor the translators shall be held liable for possible errors or the consequences thereof.
http://www.novell.com/company/legal/trademarks/tmlist.htmlhttp://www.novell.com/company/legal/trademarks/tmlist.htmlhttp://www.novell.com/company/legal/trademarks/tmlist.htmlhttp://www.novell.com/company/legal/trademarks/tmlist.html -
8/12/2019 Book Virtualization Xen
3/98
Contents
Preface v
1 Introduction to Xen Virtualization 1
1.1 Basic Components . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Understanding Virtualization Modes . . . . . . . . . . . . . . . . . 2
1.3 Xen Virtualization Architecture . . . . . . . . . . . . . . . . . . . . 3
1.4 The Virtual Machine Host . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Supported Virtualization Limits . . . . . . . . . . . . . . . . . . . . 5
2 Setting Up a Virtual Machine Host 7
2.1 Best Practices and Suggestions . . . . . . . . . . . . . . . . . . . . 92.2 Setting Up a 32-Bit Domain 0 on a 64-Bit Hypervisor . . . . . . . . . . 10
2.3 Managing Domain 0 Memory . . . . . . . . . . . . . . . . . . . . 11
2.4 Networks Card in Fully Virtualized Guests . . . . . . . . . . . . . . . 12
2.5 Starting the Virtual Machine Host . . . . . . . . . . . . . . . . . . 13
3 Setting Up Virtual Machines 15
3.1 Creating a Virtual Machine . . . . . . . . . . . . . . . . . . . . . 153.2 Installing an Operating System . . . . . . . . . . . . . . . . . . . 17
3.3 Including Add-On Products in the Installation . . . . . . . . . . . . . 21
3.4 Using the Command Line to Create Virtual Machines . . . . . . . . . . 22
3.5 Deleting Virtual Machines . . . . . . . . . . . . . . . . . . . . . 23
3.6 Using an Existing SUSE Linux Enterprise Server Virtual Machine . . . . . 23
3.7 Troubleshooting . . . . . . . . . . . . . . . . . . . . . . . . . 24
-
8/12/2019 Book Virtualization Xen
4/98
4 Managing a Virtualization Environment 27
4.1 Virtual Machine Manager . . . . . . . . . . . . . . . . . . . . . 28
4.2 Controlling the Host by Modifying xend Settings . . . . . . . . . . . . 294.3 Conguring a Virtual Machine by Modifying its xend Settings . . . . . . 30
4.4 The xm Command . . . . . . . . . . . . . . . . . . . . . . . . 31
5 Virtualization: Conguration Options and Settings 33
5.1 Virtual CD Readers . . . . . . . . . . . . . . . . . . . . . . . . 33
5.2 Remote Access Methods . . . . . . . . . . . . . . . . . . . . . . 38
5.3 VNC Viewer . . . . . . . . . . . . . . . . . . . . . . . . . . . 395.4 The Boot Loader Program . . . . . . . . . . . . . . . . . . . . . 42
5.5 Changing the Hosts Desktop from Text Mode to GUI Mode . . . . . . . 45
5.6 Paravirtual Mode and Journaling File Systems . . . . . . . . . . . . . 46
5.7 Virtual Machine Initial Startup Files . . . . . . . . . . . . . . . . . 47
5.8 Sparse Image Files and Disk Space . . . . . . . . . . . . . . . . . . 49
5.9 Virtual Keyboards . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.10 Mapping Physical Storage to Virtual Disks . . . . . . . . . . . . . . . 52
5.11 Virtual Disks . . . . . . . . . . . . . . . . . . . . . . . . . . . 535.12 Migrating Virtual Machines . . . . . . . . . . . . . . . . . . . . . 54
5.13 Passing Key Combinations to Virtual Machines . . . . . . . . . . . . . 54
5.14 xm block-list Device Numbers . . . . . . . . . . . . . . . . . . . . 55
5.15 File-Backed Virtual Disks and Loopback Devices . . . . . . . . . . . . 56
5.16 Saving Virtual Machines . . . . . . . . . . . . . . . . . . . . . . 56
5.17 Restoring Virtual Machines . . . . . . . . . . . . . . . . . . . . . 57
5.18 Virtual Machine States . . . . . . . . . . . . . . . . . . . . . . . 59
6 Xen Guest Systems 61
6.1 NetWare Virtual Machines . . . . . . . . . . . . . . . . . . . . . 61
6.2 OES Linux Virtual Machines . . . . . . . . . . . . . . . . . . . . . 61
6.3 SUSE Linux Virtual Machines . . . . . . . . . . . . . . . . . . . . 61
6.4 Windows Virtual Machines . . . . . . . . . . . . . . . . . . . . . 70
7 Virtual Machine Drivers 71
7.1 Buying a Support Subscription . . . . . . . . . . . . . . . . . . . 72
7.2 Loading the Driver Pack . . . . . . . . . . . . . . . . . . . . . . 73
7.3 SUSE Drivers for Red Hat Enterprise Linux 4 on Xen . . . . . . . . . . 73
7.4 SUSE Drivers for Red Hat Enterprise Linux 5 on Xen . . . . . . . . . . 77
7.5 SUSE Drivers for Windows on Xen . . . . . . . . . . . . . . . . . . 81
7.6 SUSE Drivers for SUSE Linux Enterprise Server on Xen . . . . . . . . . 89
-
8/12/2019 Book Virtualization Xen
5/98
PrefaceThis manual offers an introduction to virtualization technology of your SUSE Linux
Enterprise Server. It features an overview of the various elds of application and instal-
lation types of each of the platforms supported by SUSE Linux Enterprise Server as
well as a short description of the installation procedure.
Quality service is also available. Experts can answer questions about installation or
conguration, make reliable security updates available, and support developmentprojects.
1 Feedback
We want to hear your comments and suggestions about this manual and the other doc-
umentation included with this product. Please use the User Comments feature at thebottom of each page of the online documentation and enter your comments there.
2 Additional Documentation
For additional documentation on this product, refer to http://www.novell.com/documentation/sles10/index.html :
Architecture-Specic Information
Architecture-specic information needed to prepare a SUSE Linux Enterprise
Server target for installation.
Installation and Administration
In-depth installation and administration for SUSE Linux Enterprise Server.
For a documentation overview on the SUSE Linux Enterprise Desktop product, refer
to http://www.novell.com/documentation/sled10/index.html.
Documentation regarding the Open Enterprise Server 2 is found at http://www
.novell.com/documentation/oes2/index.html .
http://www.novell.com/documentation/sles10/index.htmlhttp://www.novell.com/documentation/sles10/index.htmlhttp://www.novell.com/documentation/sled10/index.htmlhttp://www.novell.com/documentation/oes2/index.htmlhttp://www.novell.com/documentation/oes2/index.htmlhttp://www.novell.com/documentation/oes2/index.htmlhttp://www.novell.com/documentation/oes2/index.htmlhttp://www.novell.com/documentation/sled10/index.htmlhttp://www.novell.com/documentation/sles10/index.htmlhttp://www.novell.com/documentation/sles10/index.html -
8/12/2019 Book Virtualization Xen
6/98
3 Documentation Conventions
The following typographical conventions are used in this manual:
/etc/passwd: lenames and directory names
placeholder: replaceplaceholderwith the actual value
PATH: the environment variable PATH
ls,--help: commands, options, and parameters
user: users or groups
Alt,Alt+F1: a key to press or a key combination; keys are shown in uppercase as
on a keyboard
File,File> Save As: menu items, buttons
This paragraph is only relevant for the specied architectures. The arrows mark the
beginning and the end of the text block.
This paragraph is only relevant for the specied architectures. The arrows mark the
beginning and the end of the text block.
Dancing Penguins(ChapterPenguins, Another Manual): This is a reference to a
chapter in another manual.
vi Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
7/98
1Introduction to XenVirtualizationVirtualization of operating systems is used in many different computing areas. It nds
its applications in server consolidation, energy saving efforts, or the ability to run older
software on new hardware, for example. This chapter introduces and explains the
components and technologies you need to understand to set up and manage a Xen-basedvirtualization environment.
1.1 Basic Components
The basic components of a Xen-based virtualization environment are theXen hypervisor,
theDomain0, any number of otherVM Guests, and the tools, commands, and congu-ration les that let you manage virtualization. Collectively, the physical computer run-
ning all these components is referred to as a virtual machine hostbecause together these
components form a platform for hosting virtual machines.
The Xen Hypervisor
The Xen hypervisor, sometimes referred to generically as a virtual machine monitor,
is an open-source software program that coordinates the low-level interaction be-tween virtual machines and physical hardware.
The Domain0
The virtual machine host environment, also referred to as domain0or controlling
domain, is comprised of several components, such as:
Introduction to Xen Virtualization 1
-
8/12/2019 Book Virtualization Xen
8/98
The SUSE Linux operating system, which gives the administrator a graphical
and command line environment to manage the virtual machine host components
and its virtual machines.
NOTE
The term Domain0 refers to a special domain that provides the man-
agement environment. This may be run either in graphical or in command
line mode.
The xend daemon (xend), which stores conguration information about each
virtual machine and controls how virtual machines are created and managed.
A modied version of QEMU, which is an open-source software program that
emulates a full computer system, including a processor and various peripherals.
It provides the ability to host operating systems in full virtualization mode.
Xen-Based Virtual Machines
A Xen-based virtual machine, also referred to as a domain, consists of the follow-
ing components:
At least one virtual disk that contains a bootable operating system. The virtual
disk can be based on a le, partition, volume, or other type of block device.
Virtual machine conguration information, which can be modied by exportinga text-based conguration le from xend or through Virtual Machine Manager.
Management Tools, Commands, and Conguration Files
There is a combination of GUI tools, commands, and conguration les to help
you manage and customize your virtualization environment.
1.2 Understanding Virtualization
Modes
Guest operating systems are hosted on virtual machines in either full virtualization
mode or paravirtual mode. Each virtualization mode has advantages and disadvantages.
2 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
9/98
Full virtualization mode lets virtual machines run unmodied operating systems,
such as Windows* Server 2003 and Windows XP, but requires the computer running
as the virtual machine host 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 congured
to run SUSE Linux Enterprise Virtual Machine Drivers instead of operating-system-
specic drivers. Running virtual machine drivers improves performance dramatically
on guest operating systems, such as Windows XP and Windows Server 2003. For
more information, seeChapter 7,Virtual Machine Drivers(page 71).
Paravirtual mode does not require the host computer to support hardware-assisted
virtualization technology, but does require the guest operating system to be modied
for the virtualization environment. Typically, operating systems running in paravir-
tual mode enjoy better performance than those requiring full virtualization mode.
Operating systems currently modied to run in paravirtual mode are referred to as
paravirtualized operating systems and include SUSE Linux Enterprise Server 10 andNetWare 6.5 SP7.
1.3 Xen Virtualization Architecture
The following graphic depicts a virtual machine host with four virtual machines. The
Xen hypervisor is shown as running directly on the physical hardware platform. Note,
that the controlling domain is also just a virtual machine, although it has several addi-
tional management tasks compared to all other virtual machines.
Introduction to Xen Virtualization 3
-
8/12/2019 Book Virtualization Xen
10/98
Figure 1.1 Virtualization Architecture
On the left, the virtual machine hosts Domain0 is shown running the SUSE Linux op-
erating system. The two virtual machines shown in the middle are running paravirtualizedoperating systems. The virtual machine on the right shows a fully virtual machine run-
ning an unmodied operating system, such as Windows Server 2003 or Windows XP.
1.4 The Virtual Machine Host
After you install the virtualization components and reboot the computer, the GRUB
boot loader menu should display a Xen menu option. Selecting the Xen menu option
loads the Xen hypervisor and starts the Domain0 running the SUSE Linux operating
system.
Running on domain 0, the SUSE Linux operating system displays the installed text
console or desktop environment, such as GNOME or KDE. When opened, each virtual
machine is displayed in its own window inside the controlling domain 0.
4 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
11/98
Figure 1.2 Desktop Showing Virtual Machine Manager and Virtual Machines
1.5 Supported Virtualization Limits
The following virtualization limits are supported by SUSE Linux Enterprise Server.
These limits have been tested to ensure the host system and and the virtual machinesinstall and work successfully, even when reaching the limits. It has also been ensured
that there are are no major performance regressions (cpu, memory, disk, network) since
the last service pack release.For more details on the support status refer to http://
www.novell.com/partners/xen_yes.html .
Supported Limits for Virtual Machine (VM)
Max. virtual CPUs per VM: 32 Paravirtualized, 8 fully virtualized
Introduction to Xen Virtualization 5
http://www.novell.com/partners/xen_yes.htmlhttp://www.novell.com/partners/xen_yes.htmlhttp://www.novell.com/partners/xen_yes.htmlhttp://www.novell.com/partners/xen_yes.html -
8/12/2019 Book Virtualization Xen
12/98
Max. memory per VM: 16GB for 32bit, 64GB for 64bit guests
Max. virtual block devices per VM: 16 paravirtualized, 16 fully virtualized with
paravirtualized drivers, 4 fully virtualized
Max. virtual network devices per VM: 8
Supported Limits for Virtual Hosts Systems (VHS)
Max. physical CPUs: 32 for 32bit, 64 for 64bit
Max. domain 0 virtual CPUs: 32
Max. physical memory: 16GB for 32bit, 1TB for 64bit
Max. domain 0 physical memory: 16GB for 32bit, 480GB for 64bit
Max. block devices: up to 12,000 SCSI logical units
Max. iSCSI devices: 128
Max. network cards: 8
Max. VMs per host: 64
Max. VMs per CPU core: 8
Max. virtual network cards: 64 across all VMs in the system
6 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
13/98
2Setting Up a Virtual MachineHostThis section documents how to set up and use SUSE Linux Enterprise Server 10 SP4as a virtual machine host.
In most cases, the hardware requirements for the Domain0 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
Remember that VM Guest systems, just like physical machines, perform better
when they run on faster processors and have access to more system memory.
The following table lists the minimum hardware requirements for running a typical
virtualized environment. Additional requirements have to be added for the number and
type of the respective guest systems.
Table 2.1 Hardware Requirements
Minimum RequirementsSystem Compo-
nent
Computer with Pentium II or AMD K7 450 MHz processorComputer
512 MB of RAM for the hostMemory
Setting Up a Virtual Machine Host 7
-
8/12/2019 Book Virtualization Xen
14/98
Minimum RequirementsSystem Compo-
nent
7 GB of available disk space for the host.Free Disk Space
DVD-ROM DriveOptical Drive
20 GBHard Drive
Ethernet 100 MbpsNetwork Board
IP Address One IP address on a subnet for the host.
One IP address on a subnet for each VM Guest.
Xen virtualization technology is available in SUSE Linux Enterprise Server productsbased on code path 10 and later. Code path 10 products include Open Enterprise Server
2 Linux, SUSE Linux Enterprise Server 10, SUSE Linux Enterprise Desktop 10, and
openSUSE 10.x.
The virtual machine host requires a number of software packages and their dependencies
to be installed. To install all necessary packages, run YaST Software Management, select
the lterPatternsand chooseXen Virtual Machine Host Serverfor installation.
After the Xen software is installed, restart the computer.
IMPORTANT: Boot Issues on 64bit Machines with more than 480 GB RAM
64bit Machines with more than 480 GB RAM may refuse to boot with the fol-
lowing error message:
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) Not enough RAM for DOM0 reservation.
(XEN) ****************************************
To avoid this error, it is recommended to always specify the Domain 0 Memory
size with the boot parameter dom0_mem=VALUEon machine equipped with
large amounts of RAM. Set the VALUEat or below the boundary of 480 GBthedifference is reserved for the hypervisor (to be used for guest VMs).
8 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
15/98
Permanently add this parameter to your boot loader conguration by adding
the parameter dom0_mem=VALUEto your Xen kernel boot conguration. Either
useYaST>System>Boot Loaderor edit /boot/grub/menu.lst. SeeSec-tion 2.3, Managing Domain 0 Memory(page 11) for more information.
Updates are available through your update channel. To be sure to have the latest updates
installed, run YaSTOnline Updateafter the installation has nished.
2.1 Best Practices and SuggestionsWhen installing and conguring the SUSE Linux Enterprise operating system on the
host, be aware of the following best practices and suggestions:
If the host should always run as Xen host, run YaSTSystem>Boot Loaderand acti-
vate the Xen boot entry as default boot section.
In YaST, clickSystem > Boot Loader.
Change the default boot to theXen label, then clickSet as Default.
ClickFinish.
Disable powersave functionality on the host and all guest operating systems. On the
host computer and other Linux computers, you can use thechkconfig
powersaved offcommand.
Close Virtual Machine Manager if you are not actively using it and restart it when
needed. Closing Virtual Machine Manager does not affect the state of virtual machines.
For best performance, only the applications and processes required for virtualization
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 may not be met. To recon-
gure this timeout, run/etc/init.d/o2cb configureor edit
O2CB_HEARTBEAT_THRESHOLD in the system conguration.
Setting Up a Virtual Machine Host 9
-
8/12/2019 Book Virtualization Xen
16/98
2.2 Setting Up a 32-Bit Domain 0 on
a 64-Bit HypervisorA virtual machine host running on a 64-bit platform can access much more memory
than hosts running on a 32-bit platform. However, there might be circumstances where
you want to run the 32-bit version of the SUSE Linux operating system (as domain
0) on the 64-bit Xen hypervisor.
1 On 64-bit hardware, start the 32-bit SUSE Linux operating system installationprogram.
2 SelectInstallation Settings> Softwareto include theXen Virtual Machine Host
Serversoftware package selection.
3 SelectSoftware>Software Selection and System Tasks and clickDetailsto view
all packages.
4 In theFilterdrop-down list, selectSearch, then search for kernel-xen. Make
sure that kernel-xenpaeis selected for installation and that kernel-xen is
not selected.
5 Complete the SUSE Linux installation program.
The installation program copies les, reboots, and prompts you for additional
setup information.
6 After entering the additional setup information, log in to the computer.
7 Access the SUSE Linux installation source media.
The 64-bit Xen hypervisor RPM is included in both 32-bit and 64-bit versions ofthe SUSE Linux installation media.
8 On the SUSE Linux installation source media, nd the x86_64 directory that
containsxen.rpm.
9 Use the following command to install the RPM:
rpm -U xen.rpm --ignorearch --force
10 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
17/98
10 Edit the GRUB boot loader settings by runningYaST>System>Boot Loaderor
editing the le at /boot/grub/menu.lst.
11 Change Hypervisor to/boot/xen.gz.
The xen.gz hypervisor is the 64-bit hypervisor.
12 Reboot the computer.
13 During the boot process, select the Xen option from the GRUB boot loader.
14 Verify that the computer is running the 32-bit Domain 0 by entering:
uname -m
It should report a 32-bit machine name, such as i686.
15 Verify that the computer is running the 64-bit hypervisor by entering:
xm info | grep xen_caps
It should report a 64-bit Xen hypervisor, such as xen-3.0-x86_64.
2.3 Managing Domain 0 MemoryWhen the host is set up, a percentage of system memory is reserved for the hypervisor,
and all remaining memory is automatically allocated to Domain0.
A better solution is to set a minimum and maximum amount of memory for domain 0,
so the memory can be allocated appropriately to the hypervisor. An appropriate minimum
amount would at least be 512 MB.
On 64bit machine with more than 480 GB RAM Setting a maximum amount needs to
be set, otherwise the machine may refuse to boot. Set the value at or below the boundary
of 480 GBthe difference is reserved for the hypervisor (to be used for guest VMs).
Setting Up a Virtual Machine Host 11
-
8/12/2019 Book Virtualization Xen
18/98
2.3.1 Setting a Maximum Amount of
Memory1 Determine the amount of memory to set for domain 0.
2 At Domain0, typexm list to view the currently allocated memory.
3 RunYaST> Boot Loader.
4 Select the Xen section.
5 InAdditional Xen Hypervisor Parameters, add dom0_mem= mem_amount where
mem_amount is the maximum amount of memory to allocate to Domain0. Add
K,M, orG, to specify the size, for example,dom0_mem=768M.
6 Restart the computer to apply the changes.
2.3.2 Setting a Minimum Amount of Memory
To set a minimum amount of memory for Domain0, edit the dom0-min-mem param-
eter in the /etc/xen/xend-config.sxp le and restart xend. For more informa-
tion, seeSection 4.2, Controlling the Host by Modifying xend Settings(page 29).
2.4 Networks Card in Fully Virtualized
Guests
In a fully virtualized guest, the default network card is an emulated Realtek network
card. However, it also possible to use the split network driver to run the communication
between Domain0 and a VM Guest. By default, both interfaces are presented to the
VM Guest, because the drivers of some operating systems require both to be present.
When using SUSE Linux Enterprise, both network cards are available for the VM Guest.
The MAC addresses of both cards are identical in this case, which leads to problems
when running the network. The following network options are available:
12 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
19/98
emulated
To use a emulated network interface like an emulated Realtek card, specify
type=ioemu on the vif line. In /etc/xen/vm/this
would look like:
vif=[ 'mac=00:16:3e:62:f4:f3,type=ioemu' ]
paravirtualized
Specify the parameter type=netfront to the vif line to use the paravirtualized
network interface. In /etc/xen/vm/ this would look like:
vif=[ 'mac=00:16:3e:62:f4:f3,type=netfront' ]
emulated and paravirtualized
If the administrator should be offered both options, simply do not specify a type.
In /etc/xen/vm/this would look like:
vif=[ 'mac=00:16:3e:62:f4:f3,model=rtl8139' ]
In this case, one of the network interfaces should be disabled.
If you are using the Virtual Machine Manager, you may also recongure the guests by
modifying the respective .sxp conguration. For more about this conguration option,
see alsoSection 4.3, Conguring a Virtual Machine by Modifying its xend Settings
(page 30).
2.5 Starting the Virtual Machine Host
If virtualization software is correctly installed, the computer boots to display the GRUB
boot loader with aXen option on the menu. Select this option to start the virtual machine
host.
NOTE: Xen and Kdump
In Xen, the hypervisor manages the memory resource. If you need to reserve
system memory for a recovery kernel in Domain0, this memory has to be re-
served by the hypervisor. Thus, it is necessary to add the parameter
crashkernel=size@offset to thekernelline instead of using the line
with the other boot options. For more about Kdump, see also http://www
Setting Up a Virtual Machine Host 13
http://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdfhttp://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdf -
8/12/2019 Book Virtualization Xen
20/98
.novell.com/rc/docrepository/public/37/basedocument.2007
-09-13.2960758124/4622069_f_en.pdf .
If theXenoption is not on the GRUB menu, review the steps for installation and verify
that the GRUB boot loader has been updated. If the installation has been done without
selecting the Xen pattern, run the YaST Software Management, select the lterPatterns
and chooseXen Virtual Machine Host Serverfor installation.
After booting the hypervisor, the Domain0 virtual machine starts and displays its
graphical desktop environment. If you did not install a graphical desktop, the command
line environment appears.
Before starting to install virtual guests, make sure that the system time is correct. To
do this, congure NTP (Network Time Protocol) on the controlling domain:
1 In YaST selectNetwork Services> NTP Conguration.
2 Select the option to automatically start the NTP daemon during boot. Provide the IPaddress of an existing NTP time server, then clickFinish.
NOTE: Time Services on Virtual Guests
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
additional time source. To get the correct time on all VM Guest systems, alsoactivate 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 seeSection 6.3.4, Virtual Machine
Clock Settings(page 67).
For more information about managing virtual machines, see Chapter 4,Managing a
Virtualization Environment(page 27).
14 Virtualization with Xen
http://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdfhttp://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdfhttp://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdfhttp://www.novell.com/rc/docrepository/public/37/basedocument.2007-09-13.2960758124/4622069_f_en.pdf -
8/12/2019 Book Virtualization Xen
21/98
3Setting Up Virtual MachinesA virtual machine is comprised of data and operating system les that dene the virtualenvironment. Virtual machines are hosted and controlled by the virtual machine host.
This section provides generalized instructions for installing virtual machines.
Virtual machines have few if any requirements above those required to run the operating
system. If the operating system has not been optimized for the virtual machine host
environment, the unmodied OS can run only on hardware-assisted virtualization
computer hardware, in full virtualization mode, and requires specic device drivers to
be loaded.
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 licenseagreement for more information.
NOTE: Virtual Machine Architectures
The virtual machine host runs only on x86, AMD64 and Intel 64 hardware. It
does not run on other system architectures such as Itanium, or POWER. A 64-
bit virtual machine host can also run a 32-bit operating system, while a 32-bithost cannot run a 64-bit client. This holds true for both, the controlling domain
and all further guests.
3.1 Creating a Virtual Machine
Before creating a virtual machine, you need the following:
Setting Up Virtual Machines 15
-
8/12/2019 Book Virtualization Xen
22/98
Install a host server as described inChapter 2,Setting Up a Virtual Machine Host
(page 7).
If you want to use an automated installation le (AutoYaST, NetWare ResponseFile, or RedHat Kickstart), you should create and download it to a directory on the
host machine server or make it available on the network.
For NetWare and OES Linux virtual machines, you need a static IP address for each
virtual machine you create.
If you are installing Open Enterprise Server (OES) 2 Linux, you need a network in-stallation source for OES 2 Linux software including the SUSE Linux Enterprise
Server 10 SP4 media and the OES 2 Linux add-on CD. For procedures to create the
installation sources, see "Setting Up the Server Holding the Installation Sources" in
theSUSE Linux Enterprise Server 10 Installation and Administration Guide
[http://www.novell.com/documentation/sles10/sles_admin/
data/sec_deployment_remoteinst_instserver.html ]
For further prerequisites, consult the manuals of the respective operating system to in-
stall.
The Create Virtual Machine Wizard helps you through the steps required to create a
virtual machine and install its operating system. The information that follows is gener-
alized for installing any operating system. In addition to these instructions, you should
consult Chapter 6,Xen Guest Systems (page 61) for information specic to the operatingsystem you are installing.
The actual conguration les for the Xen guests are stored at/etc/xen/vm/. The
default location for image les is /var/lib/xen/images.
Launch theCreate Virtual Machine Wizardby using one of the following methods:
From the virtualization host server desktop, clickYaST> Virtualization> CreateVirtual Machine
From within Virtual Machine Manager, clickNew.
At the command line, entervm-install.
16 Virtualization with Xen
http://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_instserver.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_instserver.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_instserver.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_instserver.html -
8/12/2019 Book Virtualization Xen
23/98
If the wizard does not appear or the vm-installcommand does not work, review
the process of installing and starting the virtualization host server. The virtualization
software might not be installed properly.
3.2 Installing an Operating System
You can choose to run an installation program or choose a disk or disk image that already
has an installed and bootable operating system.
Figure 3.1 Installing an Operating System
If you choose to run an installation program, you are presented with a list of operating
systems. Select the one you want to install.
The Summary page shows you a summary of the virtual machine you are creating. You
can click on any of the headings to edit the information. As you edit the information in
the Summary, consult Chapter 6,Xen Guest Systems (page 61) for instructions specic
to the operating system you are installing.
Setting Up Virtual Machines 17
-
8/12/2019 Book Virtualization Xen
24/98
Figure 3.2 Summary
Information about the following operating systems is included:
OES NetWare Virtual Machines, seeSection 6.1, NetWare Virtual Machines
(page 61).
OES Linux Virtual Machines, seeSection 6.2, OES Linux Virtual Machines
(page 61).
SUSE Linux Virtual Machines, seeSection 6.3, SUSE Linux Virtual Machines
(page 61).
Windows Virtual Machines, see Section 6.4, Windows Virtual Machines (page 70).
When running through the creation of a VM Guest, the following steps have to be ac-
complished:
1 Select if the VM Guest should run as full or paravirtualized guest.
If your computer supports hardware-assisted virtualization, you can create a virtual
machine that runs in fully virtual mode. If you are installing an operating system
that is modied for virtualization, you can create a virtual machine that runs in par-
avirtual mode. For more information about virtualization modes, see Section 1.2,
Understanding Virtualization Modes(page 2).
18 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
25/98
2 Each virtual machine must have a unique name. The name entered on this page is
used to create and name the virtual machines conguration le. The conguration
le contains parameters that dene the virtual machine and is saved to the/etc/
xen/vm/directory.
3 The Hardware page allows you to specify the amount of memory and number of
virtual processors for your virtual machine.
Initial Memory
The amount of memory initially allocated to the virtual machine (specied in
megabytes).
Maximum Memory
The largest amount of memory the virtual machine will ever need.
Virtual Processors
If desired, you can specify that the virtual machine has more virtual CPUs than
the number of physical CPUs. You can specify up to 32 virtual CPUs: however,for best performance, the number of virtual processors should be less than or
equal to the number of physical processors.
4 Select the graphics mode to use:
No Graphics Support
The virtual machine operates like a server without a monitor. You can access
the operating system through operating system supported services, such as SSH
or VNC.
Paravirtualized Graphics Adapter
Requires that an appropriate graphics driver is installed in the operating system.
5 A virtual machine must have at least one virtual disk. Virtual disks can be:
File backed, which means that the virtual disk is a single image le on a larger
physical disk.
A sparse image le, which means that the virtual disk is a single image le, but
the space is not preallocated.
Congured from a block device, such as an entire disk, partition, or volume.
Setting Up Virtual Machines 19
-
8/12/2019 Book Virtualization Xen
26/98
For best performance, create each virtual disk from an entire disk or a partition. For
the next best performance, create an image le but do not create it as a sparse image
le. A virtual disk based on a sparse image le delivers the most disk-space exibil-
ity but slows installation and disk access speeds.
By default, a single, le-backed virtual disk is created as a sparse image le in
/var/lib/xen/images/vm_name where vm_name is the name of the virtual
machine. You can change this conguration to meet your specic requirements.
6 If you want to install from DVD or CD-Rom, add the drive to the list of available
hard disks. To learn about device names of the available optical drives, run hwinfo--cdromand search for the line starting with Device File:. Add this device
le to the available hard disks of the VM Guest.
7 By default, a single virtual network card is created for the virtual machine. It has a
randomly generated MAC address that you can change to t your desired congura-
tion. The virtual network card will be attached to a default bridge congured in the
host. You can also create additional virtual network cards in the Network Adapterspage of vm-install.
NOTE: Using Arbitrary Bridge Names
If installing a fully virtualized guest and you are using a bridge name that is
different than the default names, explicitly specify the bridge by selecting
the bridge name from the Sourcemenu on the Virtual Network Adapterpage. Paravirtual guests by denition are aware they are running on a virtu-
alization platform and therefore, do not need to have the bridge explicitly
specied, thus leaving SourceasDefaultwill sufce.
8 The operating system can be installed from a CD/DVD device or an ISO image le.
In addition, if you are installing a SUSE Linux operating system, you can install the
operating system from a network installation source.
If you are installing a paravirtual machine's operating system from CD, you should
remove the virtual CD reader from the virtual machine after completing the installa-
tion, because the virtual machine assumes that the original CD is still in the CD
reader, even if it is ejected. If it is ejected, the virtual machine cannot access the CD
(or any other newly inserted CD) and receives I/O errors.
20 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
27/98
WARNING: Changing CD-Roms
On paravirtual guests, it is currently not possible to go on with the installation
of a system after changing the CD-Rom. Instead, you should use a DVD or
a network based installation. For a workaround to this problem, see Sec-
tion 5.1.1, Virtual CD Readers on Paravirtual Machines(page 34).
If the installation program is capable of recognizing an installation prole, response
le, or script, you can automate the installation settings by specifying the location
of the prole, response le, or script you want to use. For example, SUSE Linux
uses an AutoYaST prole, NetWare uses a NetWare Response File, and Red Hat
uses a Kickstart le to move through the installation screens with no interaction.
You can also pass instructions to the kernel at install time by entering parameters
for theAdditional Argumentseld. These arguments may either be kernel options,
or options forlinuxrc. More information aboutlinuxrccan be found at
http://www.novell.com/documentation/sles10/sles_admin/
data/sec_deployment_remoteinst_bootinst.html
If all the information on the Summaryscreen is correct, clickOKto create the virtual
machine. A TightVNC screen appears and at this point you begin the installation of
your OS. From this point on, follow the regular installation instructions for installing
your OS. More information for any instructions that might be different for installing
your OS in a virtualized environment may be found inChapter 6,Xen Guest Systems
(page 61).
3.3 Including Add-On Products in the
Installation
In order to include an Add-On product in the installation process of a VM Guest, it is
necessary to provide the installation system with both, the standard installation images
and the image for the Add-On product.
First, add the system disk, the SUSE Linux Enterprise Server 10 SP4 installation image
and the physical CD-Rom or Add-On image as disks to the VM Guest. For example,
you may have:
Setting Up Virtual Machines 21
http://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_bootinst.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_bootinst.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_bootinst.htmlhttp://www.novell.com/documentation/sles10/sles_admin/data/sec_deployment_remoteinst_bootinst.html -
8/12/2019 Book Virtualization Xen
28/98
xvda
Main system disk.
xvdbISO image of the installation medium.
xvdc
ISO image of the Add-On product.
During the installation, add the Add-On product to the installation by entering the device
path. Commonly, this path looks like hd:///?device=/dev/xvd. Inthe special example with xvdc as Add-On product, this would look like:
hd:///?device=/dev/xvdc
3.4 Using the Command Line to
Create Virtual MachinesFrom the command line, you can enter vm-install to run a text version of the Create
Virtual Machine Wizard. The text version of the wizard is helpful in environments
without a graphical user interface. This command defaults to using a graphical user
interface if available and if no options were given on the command line.
For information on scripting a virtual machine installation, see the man pages of
vm-install and vm-install-jobs.
22 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
29/98
Figure 3.3 Command Line Interface
3.5 Deleting Virtual Machines
When you use Virtual Machine Manager or the xm command to delete a virtual machine,
it no longer appears as a virtual machine, but its initial startup le and virtual disks are
not automatically deleted.
To delete all components of a virtual machine congured with a le-backed virtual
disk, you must manually delete its virtual disk image le (/var/lib/xen/images/)
and its initial startup le (/etc/xen/vm).
3.6 Using an Existing SUSE Linux
Enterprise Server Virtual Machine
In SUSE Linux Enterprise Server 10, the device naming is different than the devicenaming of SUSE Linux Enterprise Server 9. Therefore, a SUSE Linux Enterprise
Setting Up Virtual Machines 23
-
8/12/2019 Book Virtualization Xen
30/98
Server 9 VM Guest will not be able to nd its root le system when running on a SUSE
Linux Enterprise Server 10 VM Host Server.
To be able to still boot the system, you must know which device is used for the rootpartition of your virtual system. For example,hdaxxwill be changed to xvdaxx
wherexxis the partition number.
When booting the system, you have to append an extra root option to the kernel com-
mand line, that tells the system about its root le system. If your VM Guest used to
live on /dev/hda2, append the string root=/dev/xvda2 to the kernel command
line. This option should enable you to boot the system, although additional lesystemsstill will not be available to the system.
To make all the needed le systems available to the VM Guest, do the following:
In order to have a valid initial ramdisk that knows about the new location of the root
lesystem, run the commandmkinitrd.
1 Start the VM Guest with the extraroot=command line as explained above.
2 Log into the system as userroot.
3 Edit the le/etc/fstaband correct all device entries.
4 Edit the virtual machines /boot/grub/menu.lstle. At the kernel line, xtheroot=and theresume=parameters according the new naming schema.
5 Reboot the virtual machine.
3.7 Troubleshooting
In some circumstances, problems may occur during the installation of the VM Guest.
This section describes some known problems and their solutions.
During boot, the system hangs
The software I/O translation buffer allocates a large chunk of low memory early
in the bootstrap process. If the requests for memory exceed the size of the buffer
it usually results in a hung boot process. To check if this is the case, switch toconsole 10 and check the output there for a message similar to
24 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
31/98
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 onthe Domain0 cmdline. Note that the number can be adjusted up or down to nd
the optimal size for the machine.
Setting Up Virtual Machines 25
-
8/12/2019 Book Virtualization Xen
32/98
-
8/12/2019 Book Virtualization Xen
33/98
4Managing a Virtualization
Environment
Graphical utilities, text-based commands, and modied conguration les are methods
you can choose from to manage your virtualization environment.Virtual Machine
Manager is a graphical utility available in YaST that can be launched from the virtual
machine Domain0.
Figure 4.1 Desktop Showing Virtual Machine Manager and Virtual Machines
Managing a Virtualization Environment 27
-
8/12/2019 Book Virtualization Xen
34/98
From a command line interface on the virtual machine host, you can use the vm-install
program andxm commands to create and manage virtual machines. You can also edit
conguration les to change the settings of the virtual machine host or a virtual machine.
4.1 Virtual Machine Manager
From the desktop of the management virtual machine, the YaST Virtual Machine
Manager provides a graphical user interface you can use to create and manage virtual
machines.
NOTE
Close Virtual Machine Manager if you are not actively using it and restart it
when needed. Closing Virtual Machine Manager does not affect the state of
virtual machines.
Figure 4.2 Virtual Machine Manager Main Console
Selecting a virtual machine and clickingOpendisplays the virtual machine window
showing the virtual machines current state.
ClickingRunon the virtual machine window boots the virtual machine and displays
the user interface or text console running on the virtual machine.
Selecting a virtual machine and clickingDetailslets you view performance andcongure hardware details associated with the virtual machine.
28 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
35/98
ClickingNewin Virtual Machine Manager launches theCreate Virtual Machine
Wizard, which walks you through the steps required to set up a virtual machine. See
alsoSection 3.1, Creating a Virtual Machine(page 15).
4.2 Controlling the Host by Modifying
xend Settings
The xend is a key component of Xen virtualization. It performs management functionsand stores settings that relate to the host environment and each virtual machine. You
can customize xend to meet your specic conguration requirements.
To specify xend operating parameters, edit the /etc/xen/xend-config.sxp
le. The settings take effect the next time xend starts.
# -*- sh -*-
#
# Xend configuration file.
#
# This example configuration is appropriate for an installation that
# utilizes a bridged network configuration. Access to xend via http
# is disabled.
# Commented out entries show the default for that entry, unless otherwise# specified.
#(logfile /var/log/xen/xend.log)
#(loglevel DEBUG)
# The Xen-API server configuration.
#
# This value configures the ports, interfaces, and access controls for the# Xen-API server. Each entry in the list starts with either unix, or a port
To start the xend daemon, enterrcxend start.
To stop the xend daemon, enterrcxend stop.
To restart the xend daemon, enterrcxend restart.
Managing a Virtualization Environment 29
-
8/12/2019 Book Virtualization Xen
36/98
To check the status of the xend daemon, enterrcxend status.
The parameters in the xend-config.sxple can be customized to meet your re-
quirements for virtualization. For a full list of all available options, read the manualpage of xend-config.sxp.
4.3 Conguring a Virtual Machine by
Modifying its xend SettingsThe machine settings of each virtual guest are stored in an internal database managed
by xend. You can change a virtual machines settings by modifying the settings stored
in xend. This process requires you to export a virtual machines settings from the xend
database to a text le, edit the settings in the le to meet your conguration requirements,
import the le back into xend, and restart the virtual machine.
NOTE
It is no longer recommended that you edit the initial startup les stored in
/etc/xen/vm, because they are used only during the creation of a new virtual
machine.
To modify a virtual machines settings that is administrated with the virtual machinemanager:
1 At Domain0, enter
xm list -l vm_name > filename
where vm_name is the name of the virtual machine you want to modify and
filename is whatever you want to name the text le.
2 Use a text editor to make and save any desired changes.
(domain
(domid 1)
(on_crash destroy)
(memory 384)(uuid 4fbcb943-871c-9a51-3a48-3ad99d933841)
30 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
37/98
(bootloader_args '- -entry=xvda2:/boot/vmlinuz-xen,/boot/initrd-xen')
(name SLES10withOES2) (maxmem 512)
(on_reboot restart)
(on_poweroff destroy)
(vcpus 1)(bootloader /usr/lib/xen/boot/domUloader.py)
(shadow_memory 0)
(cpu_weight 256)
(cpu_cap 0)
(features )
(on_xend_start ignore)
(on_xend_stop ignore)
(start_time 1178219902.47)
(cpu_time 4574.26779201)(online_vcpus 1)
(image
(linux
(kernel /var/lib/xen/tmp/kernel.Bg0o6h)
(ramdisk /var/lib/xen/tmp/ramdisk.Bch8YM)
(args 'TERM=xterm ')
)
)
(status 2)
....
3 Delete the existing conguration from xenstore with the commandxm del
vm_name
4 Enter xm new -F filename to import the virtual machines new settings into
xend.
5 Enterxm start vm_name to start the virtual machine with its new settings.
You should repeat the entire process of exporting the le each time you want to
make changes to a virtual machines settings.
4.4 The xm CommandThexm command provides a command line interface for managing virtual machines.
It can be used to create, pause, and shut down virtual machines. It can also be used to
list the current domains, enable or pin virtual CPUs, and attach or detach block devices.
For example, thexm listcommand displays the status of all virtual machines.
# xm list
Managing a Virtualization Environment 31
-
8/12/2019 Book Virtualization Xen
38/98
Name ID Mem VCPUs State Time(s)
Domain-0 0 457 2 r----- 2712.9
OES 7 512 1 -b---- 16.3
SLES10 512 1 12.9
The syntax of the xm command usually follows the format:
xm [domain-id] [OPTIONS]
where subcommand is the xm command to run, domain-id is the ID number assigned
to a domain or the name of the virtual machine, and OPTIONS indicates subcommand-
specic options.
Other usefulxm commands include:
xm startstarts a virtual machine
xm reboot reboots a virtual machine
xm destroyimmediately terminates a virtual machine
xm block-listdisplays all virtual block devices attached to a virtual machine
Allxm operations require that the Xen control daemon, xend, be running. For this
reason, you should make sure xend starts whenever the host boots.
Most xm commands require root privileges to allow interaction with the Xen hyper-
visor. Entering the xm command when you are not logged in as root returns an error.
Somexm commands return no information even though the action is completed. In
some instances, for example, when shutting down a virtual machine, the action can
take several seconds to complete. To verify that the action has completed, you might
need to view its status another way, such as, using the xm listcommand.
For a complete list ofxm command parameters, enterxm helpat the command line
or read the manual page ofxm.
32 Virtualization with Xen
-
8/12/2019 Book Virtualization Xen
39/98
5Virtualization: Conguration
Options and Settings
The documentation in this section, describes advanced management tasks and congu-
ration options that might help technology innovators implement leading-edge virtual-
ization solutions. It is provided as a courtesy and does not imply that all documented
options and tasks are supported by Novell, Inc.
Virtualization technology is being rapidly developed. In an effort to keep you up to
date on the most current information, this documentation will be updated more often
than traditional Novell product documentation. To create a more dynamic environment,
it will quickly include any feedback and new virtualization discoveries made by you
and other users through the User Comments feature at the bottom of each page.
Although a more dynamic documentation environment can be benecial, there will alsobe some drawbacks. The information might not have gone through a formal editing
cycle before being published. The information might be less authoritative, might not
completely cover obvious topics, and could have more typos than traditional product
documentation. It might also include untested instructions for virtualization procedures
you might want to try.
5.1 Virtual CD Readers
Virtual CD readers can be set up when a virtual machine is created or added to an ex-
isting virtual machine. A virtual CD reader can be based on a physical CD/DVD, or
based on an ISO image. Virtual CD readers work differently depending on whether
they are paravirtual or fully virtual.
Virtualization: Conguration Options and Settings 33
-
8/12/2019 Book Virtualization Xen
40/98
NOTE
Only limited support for virtual machine removable media is available in the
original version of SUSE Linux Enterprise Server. Much of the following infor-mation pertains to functionality available in maintenance updates.
If you are installing drivers from the SUSE Linux Enterprise Virtual Machine
Driver Pack, proceed by completing one of the following:
If you have updated to Virtual Machine Manager 0.3.1-0.24 or later, complete
the instructions inSection 5.1.3, Adding Virtual CD Readers(page 35) toset up the ISO image le as a virtual CD reader.
The most recent Virtual Machine Manager package is available through the
SUSE Linux Enterprise Server update channel.
If you are running an earlier version of Virtual Machine Manager, you must
set up the ISO image le as a virtual CD reader when you create the virtual
machine, or add a virtual CD reader based on the ISO image le following
the instructions inSection 5.1.4, Adding Virtual CD Readers (Command Line
Method)(page 37).
5.1.1 Virtual CD Readers on ParavirtualMachines
A paravirtual machine can have up to 16 block devices comprised of virtual CD readers
and virtual disks. On paravirtual machines, virtual CD readers present the CD as a vir-
tual disk with read-only access. Unless you remove the virtual CD reader, the virtual
machine assumes that the originally-inserted CD is still in the CD reader, even if you
have ejected it. If it has been ejected, the virtual machine will not be able to access theCD (or any other newly-inserted CD) and will receive I/O errors. Virtual CD readers
cannot be used to write data to a CD. They are congured as read-only devices.
After you have nished accessing a CD on a paravirtual machine, it is recommended
that you remove the virtual CD reader from the virtual machine.
If several CDs are needed for the installation of an operating system, make all of themavailable to the paravirtual machine and change the path to the data on request. If you
34 Virtualization with Xen
do not have enough CD readers create image les from the CDs and make those
-
8/12/2019 Book Virtualization Xen
41/98
do not have enough CD readers, create image les from the CDs and make those
available. To create an image le, the following command may be used:
dd if=/dev/cdrom of=/cdimage.iso
On request of the installation system, press Detailsand manually point to the correct
disk by changingxvdbto xvdc,xvdcto xvddand so on.
5.1.2 Virtual CD Readers on Fully Virtual
MachinesA fully virtual machine can have up to four block devices comprised of virtual CD
readers and virtual disks. A virtual CD reader on a fully virtual machine interacts with
the inserted CD in the way you expect a physical CD reader to interact. For example,
in a Windows* XP* virtual machine, the inserted CD appears in the Devices with
Removable Storagesection ofMy Computer.
When a CD is inserted in the physical CD reader on the host computer, all virtual ma-
chines with virtual CD readers based on the physical CD reader, such as /dev/cdrom/,
are able to read the inserted CD. Assuming the operating system has automount func-
tionality, the CD should automatically appear in the le system. Virtual CD readers
cannot be used to write data to a CD. They are congured as read-only devices.
5.1.3 Adding Virtual CD Readers
Virtual CD readers can be based on a CD inserted into the CD reader or on an ISO
image le.
1 Make sure that the virtual machine is running and the operating system has nished
booting.
2 Insert the desired CD into the physical CD reader or copy the desired ISO image
to a location available to the virtual machines le system.
3 Run Virtual Machine Manager.
4 Select the virtual machine, then clickDetails.
Virtualization: Conguration Options and Settings 35
5 Click Hardware > Disk.
-
8/12/2019 Book Virtualization Xen
42/98
5 ClickHardware Disk.
6 ClickCD-ROM.
7 Specify the path to the physical CD reader, such as/dev/cdrom. If you are
adding a virtual CD reader based on an ISO, specify the path to the ISO image
le.
8 ClickOKto apply the changes.
A new block device, such as /dev/xvdb, is added to the virtual machine.
9 If the virtual machine is running Linux, complete the following:
9a Open a terminal in the virtual machine and enter fdisk -l to verify that
the device was properly added. You can also enter ls /sys/blockto
see all disks available to the virtual machine.
The CD is recognized by the virtual machine as a virtual disk with a drive
designation, for example,
/dev/xvdb
9b Enter the command to mount the CD or ISO image using its drive designa-
tion. For example,
mount -o ro /dev/xvdb /cd1
mounts the CD to a mount point named/cd1.
The CD or ISO image le should be available to the virtual machine at
the specied mount point.
10 If the virtual machine is running Windows, reboot the virtual machine.
Verify that the virtual CD reader appears in its My Computersection
36 Virtualization with Xen
5 1 4 Adding Virtual CD Readers (Command
-
8/12/2019 Book Virtualization Xen
43/98
5.1.4 Adding Virtual CD Readers (Command
Line Method)
1 Make sure that the virtual machine is running and the operating system has nished
booting.
2 Insert the CD into the physical CD reader or copy the ISO image to the host.
3 In a terminal on the host, enter the appropriate command
To set up an ISO image le, enter:
xm block-attach vm_id file:/mycd.iso hdc:cdrom r
where vm_id is the virtual machine ID, mycd.iso is the path to the ISO image
le, andhdcis the drive designation presented to the virtual machine.
If the virtual machine is paravirtual, replace the device designation with a vdb
x device designation, such as
xm block-attach vm_id file:/mycd.iso xvdb:cdrom r
To set up a physical CD reader, enter:
xm block-attach vm_id phy:/dev/cdrom hdc:cdrom r
where vm_id is the virtual machine ID, dev/cdrom is the path to the physical
CD reader,hdcis the physical drive designation to be presented to the virtual
machine, andcdromis the name you specify for the device.
If the virtual machine is paravirtual, replace the hdc drive designation with a vdbx drive designation, such as
xm block-attach vm_id phy:/dev/cdrom xvdb:cdrom r
4 If running full virtualization mode, rebooting the virtual machine is obligatory.
Virtualization: Conguration Options and Settings 37
The CD or ISO image le should appear in the virtual machines operating system.
-
8/12/2019 Book Virtualization Xen
44/98
pp p y
5.1.5 Removing Virtual CD Readers1 Make sure that the virtual machine is running and the operating system has nished
booting.
2 If the virtual CD reader is mounted, unmount it from within the virtual machine.
TIP
You can enter fdisk -lin the virtual machines terminal to view its block
devices.
3 Run Virtual Machine Manager.
4 Select the virtual machine, then clickDetails.
5 ClickHardware> Disk.
6 Select the virtual CD-ROM device to remove.
7 ClickRemoveto remove the virtual CD-ROM device.
8 Press the hardware eject button to eject the CD.
5.2 Remote Access Methods
Some congurations, such as those that include rack-mounted servers, require a com-
puter to run without a video monitor, keyboard, or mouse. This type of conguration
is often referred to as headless and requires the use of remote administration
technologies.
Typical conguration scenarios and technologies include:
38 Virtualization with Xen
Graphical Desktop with X Window Server
-
8/12/2019 Book Virtualization Xen
45/98
If a graphical desktop, such as GNOME or KDE, is installed on the virtual machine
host you can use a remote viewer, such as a VNC viewer. On a remote computer,
log in and manage the host environment by using graphical tools, such as VirtualMachine Manager.
Text and Graphical Applications
If neither a graphical desktop nor the X Window Server, but the X Windows libraries
are installed on the virtual machine host, you can use the ssh -X command from
the remote computer to log in and manage the virtualization host environment. You
can then use Virtual Machine Manager and the xm command to manage virtualmachines and thevm-installcommand to create them.
Text Only
You can use the sshcommand from a remote computer to log in to a virtual ma-
chine host and access its text-based console. You can then use the xmcommand
to manage virtual machines and the vm-install command to create new virtual
machines.
5.3 VNC Viewer
By default, Virtual Machine Manager uses the VNC viewer to show the display of a
virtual machine. You can also use VNC viewer from Domain0 (known as local access
or on-box access) or from a remote computer.
You can use the IP address of a VM Guest and a VNC viewer to view the display of
this VM Guest. When a virtual machine is running, the VNC server on the host assigns
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 machines,
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 different port
number to the virtual machine.
Virtualization: Conguration Options and Settings 39
To use the VNC viewer from a remote computer, remote administration must be enabled
h h h d d l
-
8/12/2019 Book Virtualization Xen
46/98
on the host. You can use the YaST Remote Administration module.
Figure 5.1 YaST Remote Administration
In addition to this, changevnc-listenin /etc/xen/xend-config.sxptoopen the access to the VM Guest. This is necessary, if you encounter messages like
vncviewer: ConnectToTcpAddr: connect: Connection refused
from a remote host. For more information about modifying xend-config.sxp see
Section 4.2, Controlling the Host by Modifying xend Settings (page 29).
To access the virtual machine from the local console or a remote computer running a
VNC viewer client, enter one of the following commands:
vncviewer host_ip::590#
vncviewer host_ip:#
wherehost_ipis the IP address of the virtual machine host and # is the VNC
viewer port number assigned to the virtual machine.
# vncviewer 192.168.3.100::5901
If you are using the built-in VNC viewer of an Internet browser, such as Internet Ex-
plorer* or Mozilla* Firefox*, use580#as the port number, where # is the VNC
viewer port number assigned to the virtual machine.
40 Virtualization with Xen
Figure 5.2 Mozilla Firefox VNC Viewer
-
8/12/2019 Book Virtualization Xen
47/98
When successfully connected, the VNC viewer shows the display of the running virtual
machine.
5.3.1 Assigning VNC Viewer Port Numbers
to Virtual MachinesAlthough the default behavior of VNC viewer is to assign the rst available port number,
you might want to assign a specic VNC viewer port number to a specic virtual ma-
chine.
To assign a specic port number on a fully virtualized guest, edit the virtual machines
setting (/etc/xen/vm/name) by including(vncdisplay #)where
vnc=1
vncdisplay=#
vncunused=0
vncmust be set to 1,# is the assigned port number and vncunusedmust exist and
be set to0 in order to make this work.
On a paravirtualized guest, edit the line vfb=['type=vnc,vncdisplay=#'] to
set the viewer port number to the desired value.
TIP
Assign higher port numbers to avoid conict with port numbers assigned by
the VNC viewer, which uses the lowest available port number.
Virtualization: Conguration Options and Settings 41
5.3.2 Using SDL instead of a VNC Viewer
-
8/12/2019 Book Virtualization Xen
48/98
g
If you access a virtual machines display from the virtual machine host console (known
as local or on-box access), you might want to use SDL instead of VNC viewer. VNC
viewer is faster for viewing desktops over a network, but SDL is faster for viewing
desktops from the same computer.
To set the default to use SDL instead of VNC, change the virtual machines conguration
information to the following. For instructions, seeSection 4.3, Conguring a Virtual
Machine by Modifying its xend Settings(page 30).
If it is a fully virtual machine, usevnc=0and sdl=1.
If it is a paravirtual virtual machine, use vfb=["type=sdl"].
Remember that, unlike a VNC viewer window, closing an SDL window terminates the
virtual machine.
5.4 The Boot Loader Program
The boot loader controls how the virtualization software boots and runs. You can
modify the boot loader properties by using YaST, or by directly editing the boot loader
conguration le.
The YaST boot loader program is located at YaST> System> Boot Loader. The Boot
Loader Settings screen lists the sections that appear as options on the boot menu. From
this screen, you can change the boot loader so it auto-selects the virtual machine host
option when booting.
42 Virtualization with Xen
Figure 5.3 Boot Loader Settings
-
8/12/2019 Book Virtualization Xen
49/98
Select theXen section, then clickEditto manage the way the boot loader and Xen
function.
Figure 5.4 Boot Loader Settings: Section Management
You can use the Boot Loader program to specify functionality, such as:
Pass kernel command line parameters
Specify the kernel image and intial RAM disk
Virtualization: Conguration Options and Settings 43
Select a specic hypervisor
-
8/12/2019 Book Virtualization Xen
50/98
Pass additional parameters to the hypervisor (see /usr/share/doc/packages/
xen/pdf/user.pdf section Xen Boot Options after installing the packagexen-doc-pdf).
You can customize your virtualization environment by editing the /boot/grub/
menu.lstle.
If the Xen option does not appear on the GRUB boot menu, you can compare your up-
dated GRUB boot loader le with the examples below to conrm that it was updatedcorrectly.
The rst example shows a typical GRUB boot loader le updated to load the kernel
that supports virtualization software. The second example shows a GRUB boot loader
le that loads the PAE-enabled virtualization kernel.
Example 5.1 Xen Section in the menu.lst File (Typical)
title XEN
root (hd0,5)
kernel /boot/xen.gz hyper_parameters
module /boot/vmlinuz-xen kernel_parameters
module /boot/initrd-xen
Example 5.2 Xen Section in the menu.lst File (PAE)
title XEN
root (hd0,5)
kernel /boot/xen-pae.gz hyper_parameters
module /boot/vmlinuz-xenpae kernel_parameters
module /boot/initrd-xenpae
The title line denes sections in the boot loader le. Do not change this line, because
YaST looks for the wordXENto verify that packages are installed.
The root line species which partition holds the boot partition and /boot directory.
Replace hd0,5 with the correct partition. For example, if the drive designated as hda1
holds the/bootdirectory, the entry would be hd0,0.
Thekernelline species the directory and lename of the hypervisor. Replace
hyper_parameters with the parameters to pass to the hypervisor. A common pa-
44 Virtualization with Xen
rameter is dom0_mem=, which species how much memory
to allocate to Domain0. The amount of memory is specied in KB, or you can specify
-
8/12/2019 Book Virtualization Xen
51/98
to allocate to Domain0. The amount of memory is specied in KB, or you can specify
the units with a K, M, or G sufx, for example 128M. If the amount is not specied,
the Domain0 takes the maximum possible memory for its operations.
For more information about hypervisor parameters, see /usr/share/doc/
packages/xen/pdf/user.pdf section Xen Boot Options after installing the
packagexen-doc-pdf.
The rst module line species the directory and lename of the Linux kernel to load.
Replace kernel_parameterswith the parameters to pass to the kernel. Theseparameters are the same parameters as those that can be passed to a standard Linux
kernel on physical computer hardware.
The secondmoduleline species the directory and lename of the RAM disk used
to boot the virtual machine host.
To set the GRUB boot loader to automatically boot the Xen virtualization software,change the default entry from 0, which means the rst title entry, to the number
that corresponds to thetitle XENentry. In the example le, Xen is the second
titleline, so to specify it, change the value ofdefault from 0to 1.
5.5 Changing the Hosts Desktop from
Text Mode to GUI Mode
If selecting the Xen option from the boot loader starts SUSE Linux desktop environment
(domain 0) in text mode, the graphics card is probably not congured correctly. To
properly congure the graphics card so you can switch to graphical mode, complete
the following steps:
1 When the computer boots and loads the boot loader menu, select the option that in-
cludes the wordXen.
The computer boots and displays a command prompt.
2 At the command prompt, entertelinit 3to make sure you are in text mode.
Virtualization: Conguration Options and Settings 45
3 Entersax2to run the SaX2 graphical conguration module.
-
8/12/2019 Book Virtualization Xen
52/98
4 Congure the GUI as desired.
5 Entertelinit 5to switch to GUI mode.
5.6 Paravirtual Mode and Journaling
File Systems
It is recommended that operating systems running in paravirtual mode set up their kernel
on a separate partition that uses a non-journaling le system, such as ext2.
Before a paravirtualized operating system can boot, the management domain must
construct a virtual machine and place the paravirtualized kernel in it. Then, the paravir-
tualized operating system boots. To retrieve the kernel during the bootstrapping process,
the virtual machines boot disk is mounted in read-only mode, the kernel is copied tothe virtual machines memory, and then the boot disk is unmounted.
When a virtual machines operating system crashes, its disks are not shut down in an
orderly manner. This should not pose a problem to a virtual machine running in full
virtualization mode because the pending disk entries are checked and corrected the next
time the operating system starts. If the disk is using a journaling le system, the journal
is replayed to update and coordinate any pending disk entries.
This type of system crash poses a potential problem for paravirtualized operating sys-
tems. If a paravirtualized operating system using a journaled le system crashes, any
pending disk entries cannot be updated and coordinated because the le system is ini-
tially mounted in read-only mode.
Therefore, it is recommended that you set virtual machine boot les, such as the kerneland ramdisk, on a separate partition that is formatted with a non-journaling le system,
such as ext2.
46 Virtualization with Xen
5.7 Virtual Machine Initial Startup
-
8/12/2019 Book Virtualization Xen
53/98
FilesDuring the process of creating a new virtual machine, initial startup settings are written
to a le created at /etc/xen/vm/. During the creation process, the virtual machine
starts according to settings in this le, but the settings are then transferred and stored
in xend for ongoing operations.
IMPORTANT
Modifying the initial startup le to create or make changes to a virtual machine
is not recommended. The preferred method for changing a virtual machines
settings is to use Virtual Machine Manager as described inSection 4.3, Cong-
uring a Virtual Machine by Modifying its xend Settings(page 30) or to follow
the instructions inSection 5.4, The Boot Loader Program(page 42).
When a virtual machines settings are stored in xend, it is referred to as a
xen-managed domain or xen-managed virtual machine. Whenever the
xen-managed virtual machine starts, it takes its settings from information stored in the
xend database, not from settings in the initial startup le.
Although it is not recommended, you might need to start an existing virtual machine
based on settings in the initial startup le. If you do this, any xend settings stored forthe virtual machine are overwritten by the startup le settings. Initial startup les are
saved to/etc/xen/vm/vm_name. Values must be enclosed in single quotes, such
aslocaltime = '0'.
Table 5.1 Initial Startup File Entries and Descriptions
DescriptionEntry
Virtual disks for the virtual machine.disk =
For example:
disk = [ 'file:/var/lib/xen/images/VM1_SLES10/hda,xvda,w'
]
Virtualization: Conguration Options and Settings 47
DescriptionEntry
-
8/12/2019 Book Virtualization Xen
54/98
This entry species a virtual disk based on a le ( file:)
namedhdaand located at
/var/lib/xen/images/VM1_SLES10/ . It presents itself
as the rst drive (xvda) and has read/write access (w).
Disks can also be based on a block device.
Virtual memory in Mb.memory =
Number of virtual CPUs.vcpus =
Species paravirtual mode (Linux) or full virtualization mode
(hvm).builder =
Name of the virtual machine.name =
Randomly-assigned MAC addresses and bridges assigned to
use the virtual machines network addresses.vif =
Species a localtime (0) or UTC (1) time setting.localtime =
Species the action that the virtual machine performs when the
operating system is powered off.on_poweroff =
Species the action that the virtual machine performs when the
operating system reboots.on_reboot =
Species the action that the virtual machine performs when the
operating system crashes.on_crash =
Parameters passed to the kernel.extra =
Location and lename of the domU boot loader.bootloader =
Location of the kernel and initial ramdisk.bootentry =
48 Virtualization with Xen
DescriptionEntry
-
8/12/2019 Book Virtualization Xen
55/98
Type of operating system.ostype =
Identication number for a virtual drive.uuid =
5.8 Sparse Image Files and Disk Space
If the hosts physical disk reaches a state where it has no available space, a virtual ma-
chine using a virtual disk based on a sparse image le is unable to write to its disk.
Consequently, it reports I/O errors.
The Reiser le system, perceiving a corrupt disk environment, automatically sets the
le system to read-only. If this situation happens, you should free up available space
on the physical disk, remount the virtual machines le system, and set the le system
back to read-write.
To check the actual disk requirements of a sparse image le, use the command du -h
.
5.9 Virtual KeyboardsWhen a virtual machine is started, the host creates a virtual keyboard that matches the
keymap entry according to the virtual machines settings. If there is no keymap entry
in the virtual machines settings, the host uses thekeymapentry specied in hosts
xend le ( xend-config.sxp). If there is no keymapentry in either the hosts
xend le or the virtual machines settings, the virtual machines keyboard defaults to
English (US).
Unless you manually specify it, a keymap entry is not specied in the hosts xend le
or for any virtual machine. Therefore, by default, all virtual machine settings use the
English (US) virtual keyboard. It is recommended that you specify a keymapsetting
for xend and for each virtual machine, especially, if you want to migrate virtual machines
to different hosts
Virtualization: Conguration Options and Settings 49
To view a virtual machines current keymapentry, enter the following command on
the Domain0:
-
8/12/2019 Book Virtualization Xen
56/98
xm list -l vm_name | grep keymap
You can specify a keymap entry to be used for all virtual machines and keymap entries
for specic machines.
To specify a global keymap entry for virtual machines on the host, edit the hosts
xend-config.sxp le.
To specify a keymap entry for a specic virtual machine, edit the virtual machines
settings by following instructions inSection 4.3, Conguring a Virtual Machine by
Modifying its xend Settings(page 30).
In the device > vfb section, add the desired keymap entry to the le. For example,
you can specify a German keyboard. Make sure the virtual machines operating system
is set to use the specied keyboard. After you specify the hosts keymapsetting, all
virtual machines created by using the Create Virtual Machine Wizard on the host add
the hostskeymapentry to their virtual machine settings.
Virtual machines created before a hosts keymapentry is specied are not automati-
cally updated. These virtual machines start with the keyboard specied by the host, but
the keymapentry is not a permanent part of the virtual machines settings. For the
entry to be permanent, it must be explicitly stated in the virtual machines settings.
Table 5.2 Language and Keymap Settings
Keymap SettingLanguage
daDanish
deGerman
de-chSwiss-German
en-gbEnglish (UK)
en-usEnglish (US)
50 Virtualization with Xen
Keymap SettingLanguage
-
8/12/2019 Book Virtualization Xen
57/98
esSpanish
Finnish
frFrench
fr-beFrench-Belgium
fr-caFrench-Canada
fr-chFrench-Switzerland
huHungarian
isIcelandic
itItalian
jaJapanese
nlDutch
nl-beDutch-Belgium
noNorwegian
plPolish
ptPortuguese
pt-brPortuguese-Brazil
ruRussian
svSwedish
Virtualization: Conguration Options and Settings 51
5.10 Mapping Physical Storage to
-
8/12/2019 Book Virtualization Xen
58/98
Virtual DisksTo specify a mapping between physical storage and the virtual disk, you might need to
edit the virtual machines disk information. Follow the instructions inSection 4.3,
Conguring a Virtual Machine by Modifying its xend Settings(page 30), to change
the respective device entry to the desired setting.
Example 5.3 Example: Virtual Machine Output from Xend
(vbd
(dev xvda:disk)
(uname file:/var/lib/xen/images/oes2l/disk0)
(mode w)
(type disk)
(backend 0)
)
Table 5.3 uname Settings
ExampleDescriptionProtocol
phy:/dev/xvdaBlock devices, such as a physical disk,
in domain 0
phy:
file:/path/fileRaw disk images accessed by using
loopback
le:
tap:aio:/path/fileRaw disk images accessed by using
blktap. Similar to loopback but with
better performance
tap:aio:
tap:vmdk:/path/fileVMware disk images accessed by using
blktap
tap:vmdk:
ndb: ip_portRaw disk images accessed by using NBDnbd:
tap:qcow/path/fileQEMU disk images accessed by using
blktap
tap:qcow:
52 Virtualization with Xen
ExampleDescriptionProtocol
i iiSCSI t t i ti i iti t di i
-
8/12/2019 Book Virtualization Xen
59/98
iscsi:IQN,LUNiSCSI targets using connections initiated
from domain 0
iscsi:
npiv:NPIV,LUNFibre Channel connections initiated from
domain 0
npiv:
5.11 Virtual DisksVirtual disks can be based on the following types of physical devices and les. Each
type includes an example statement.
A physical disk device, such as a DVD, that is accessible as a device to the host.
phy:/dev/cdrom
A le that contains a disk image accessible from the le system of the host. Disk
images can be encoded as raw, QEMU, or VMware.
file:/mnt/disks/sles10sp1.iso
tap:aio:/mnt/disks/sles10sp1.iso species a raw disk that might betaken from a different virtualization platform.
tap:qcow:/mnt/disks/sles10sp1.iso.qcow
tap:vmdk:/mnt/disks/sles10sp1.iso.vmdk
A remote storage device specied using the Internet SCSI (iSCSI) protocol.
iscsi:iqn.2001-04.com.acme@0ac47ee2-216e-452a-a341-a12624cd0225
A remote storage device specied using a Fibre Channel (NPIV) protocol.
npiv:210400e08b80c40f
Virtualization: Conguration Options and Settings 53
5.12 Migrating Virtual Machines
-
8/12/2019 Book Virtualization Xen
60/98
A running virtual machine can be migrated from its source virtual machine host to an-
other virtual machine host. This functionality is referred to aslive migration. For live
migration to work, the virtual machine being migrated must have access to its storage
in exactly the same location on both, source and destination host platforms.
Live migration only works wh