31 Xen: converting a paravirtual (PV) guest into a fully virtual (FV/HVM) guest #
This chapter explains how to convert a Xen paravirtual machine into a Xen fully virtualized machine.
In order to start the guest in FV mode, you need to run the following steps inside the guest.
- Prior to converting the guest, apply all pending patches and reboot the guest. 
- FV machines use the - -defaultkernel. If this kernel is not already installed, install the- kernel-defaultpackage (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 and 15 only)
 Note: Prefer UUIDs- 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 - initrdwith the required modules, you can create a symbolic link from- /dev/hda2to- /dev/xvda2etc. 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_genericand- libata, should be added automatically.Tip: Adding modules to the initrd- On SLES 11, you can add modules to the - INITRD_MODULESline in the- /etc/sysconfig/kernelfile. For example:- INITRD_MODULES="xen-vbd xen-vnif" - Run - dracutto build a new initrd containing the modules.
- On SLES 12 and 15, open or create - /etc/dracut.conf.d/10-virt.confand add the modules with- force_driversby adding a line as in the example below (mind the leading whitespace):- force_drivers+=" xen-vbd xen-vnif" - Run - dracut -f --kver KERNEL_VERSION-defaultto build a new initrd (for the default version of the kernel) that contains the required modules.- Find your kernel version. Use the - uname -rcommand to get the current version used on your system.
 
- Before shutting down the guest, set the default boot parameter to the - -defaultkernel using- yast bootloader.
- Under SUSE Linux Enterprise Server 11, if you have an X server running on your guest, you need to adjust the - /etc/X11/xorg.conffile in order to adjust the X driver. Search for- fbdevand change to- cirrus.- Section "Device" Driver "cirrus" ...... EndSectionNote: SUSE Linux Enterprise Server 12/15 and Xorg- Under SUSE Linux Enterprise Server 12/15, Xorg will automatically adjust 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 - loaderentries in the OS section are changed from- xenpvto- 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 - xendisk bus with- ide, and the- vdatarget device with- hda. The changes should look similar to:- <target dev='hda' bus='ide'/> 
- Change the bus for the mouse and keyboard from - xento- 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 - xento- serial:- <console type='pty'> <target type='serial' port='0'/> </console>
- Change the video configuration from - xento- cirrus, with 8 MB of VRAM:- <video> <model type='cirrus' vram='8192' heads='1' primary='yes'/> </video>
- If desired, add - acpiand- apicto the features of the VM:- <features> <acpi/> <apic/> </features>
 
- Start the guest (using - virshor- 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 19.3, “Guestfs tools” for more information). Numerous tools exist there to help modify disk images.