libvirt
This chapter explains how to convert a Xen paravirtual machine into a Xen fully virtualized machine.
To start the guest in FV mode, you need to run the following steps inside the guest.
Before converting the guest, apply all pending patches and reboot the guest.
FV machines use the -default
kernel. If this kernel
is not already installed, install the kernel-default
package (while running in PV mode).
PV machines typically use disk names such as vda*
.
These names must be changed to the FV hd*
syntax.
This change must be done in the following files:
/etc/fstab
/boot/grub/menu.lst
(SLES 11 only)
/boot/grub*/device.map
/etc/sysconfig/bootloader
/etc/default/grub
(SLES 12, 15, openSUSE)
You should use UUIDs or logical volumes within your
/etc/fstab
. Using UUIDs simplifies the use of
attached network storage, multipathing and virtualization. To find
the UUID of your disk, use the command blkid
.
To avoid any error regenerating the initrd
with
the required modules, you can create a symbolic link from
/dev/hda2
to /dev/xvda2
etc.
by using the ln
:
ln -sf /dev/xvda2 /dev/hda2 ln -sf /dev/xvda1 /dev/hda1 .....
PV and FV machines use different disk and network driver modules. These
FV modules must be added to the initrd manually. The expected modules
are xen-vbd
(for disk) and
xen-vnif
(for network). These are the only PV
drivers for a fully virtualized VM Guest. All other modules, such as
ata_piix
, ata_generic
and
libata
, should be added automatically.
On SLES 11, you can add modules to the
INITRD_MODULES
line in the
/etc/sysconfig/kernel
file. For example:
INITRD_MODULES="xen-vbd xen-vnif"
Run dracut
to build a new initrd containing
the modules.
On SLES 12, 15, and openSUSE open or create
/etc/dracut.conf.d/10-virt.conf
and add the
modules with force_drivers
by adding a line as
in the example below (mind the leading whitespace):
force_drivers+=" xen-vbd xen-vnif"
Run dracut -f --kver
KERNEL_VERSION-default
to
build a new initrd (for the default version of the kernel) that
contains the required modules.
Find your kernel version.
Use the uname -r
command to get the current
version used on your system.
Before shutting down the guest, set the default boot parameter to the
-default
kernel using yast
bootloader
.
Under openSUSE Leap 11, if you have an X server running on your guest,
you need to adjust the /etc/X11/xorg.conf
file to
adjust the X driver. Search for fbdev
and change to
cirrus
.
Section "Device" Driver "cirrus" ...... EndSection
Under openSUSE Leap 12/15, Xorg automatically adjusts the driver needed to be able to get a working X server.
Shut down the guest.
The following steps explain the action that you need to perform on the host.
To start the guest in FV mode, the configuration of the VM must be
modified to match an FV configuration. Editing the configuration of the
VM can easily be done using virsh edit [DOMAIN]
. The
following changes are recommended:
Make sure the machine, the type, and the loader
entries in the OS section are changed from xenpv
to xenfv
. The updated OS section should look
similar to:
<os> <type arch='x86_64' machine='xenfv'>hvm</type> <loader>/usr/lib/xen/boot/hvmloader</loader> <boot dev='hd'/> </os>
In the OS section, remove anything that is specific to PV guests:
<bootloader>pygrub</bootloader>
<kernel>/usr/lib/grub2/x86_64-xen/grub.xen</kernel>
<cmdline>xen-fbfront.video=4,1024,768</cmdline>
In the devices section, add the qemu emulator as:
<emulator>/usr/lib/xen/bin/qemu-system-i386</emulator>
Update the disk configuration so the target device and bus use the
FV syntax. This requires replacing the xen
disk
bus with ide
, and the vda
target device with hda
. The changes should look
similar to:
<target dev='hda' bus='ide'/>
Change the bus for the mouse and keyboard from
xen
to ps2
. Also add a new
USB tablet device:
<input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <input type='tablet' bus='usb'/>
Change the console target type from xen
to
serial
:
<console type='pty'> <target type='serial' port='0'/> </console>
Change the video configuration from xen
to
cirrus
, with 8 MB of VRAM:
<video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> </video>
If desired, add acpi
and apic
to the features of the VM:
<features> <acpi/> <apic/> </features>
Start the guest (using virsh
or
virt-manager
). If the guest is running
kernel-default (as verified through uname -a
), the
machine is running in Fully Virtual mode.
To script this process, or work on disk images directly, you can use the guestfs-tools suite (see Section 18.3, “Guestfs tools” for more information). Several tools exist to help modify disk images.