Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
documentation.suse.com / SUSE Linux Enterprise Server-Dokumentation / Virtualization Guide / Managing virtual machines with Xen / Xen: converting a paravirtual (PV) guest into a fully virtual (FV/HVM) guest
Applies to SUSE Linux Enterprise Server 15 SP3

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.

Procedure 31.1: Guest side

In order to start the guest in FV mode, you need to run the following steps inside the guest.

  1. Prior to converting the guest, apply all pending patches and reboot the guest.

  2. FV machines use the -default kernel. If this kernel is not already installed, install the kernel-default package (while running in PV mode).

  3. 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
    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.

  4. 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
    .....
  5. 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.

    Tip
    Tip: Adding modules to the initrd
    • 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 mkinitrd to build a new initrd containing the modules.

    • On SLES 12 and 15, 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.

  6. Before shutting down the guest, set the default boot parameter to the -default kernel using yast bootloader.

  7. Under SUSE Linux Enterprise Server 11, if you have an X server running on your guest, you need to adjust the /etc/X11/xorg.conf file in order to adjust the X driver. Search for fbdev and change to cirrus.

    Section "Device"
              Driver       "cirrus"
              ......
              EndSection
    Note
    Note: 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.

  8. Shut down the guest.

Procedure 31.2: Host side

The following steps explain the action that you need to perform on the host.

  1. 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>
  2. 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.

Note
Note: guestfs-tools

To script this process, or work on disk images directly, you can use the guestfs-tools suite (see Section 20.3, “Guestfs tools” for more information). Numerous tools exist there to help modify disk images.