Virtualization With Xen and KVM

Xen and KVM virtualized clients can be managed directly in Uyuni.

To begin, you need to set up a virtual host on your Uyuni Server. You can then set up autoinstallation using AutoYaST or Kickstart for additional virtual hosts and for virtual guests.

This section also includes information about administering virtual guests after they have been installed.

1. Host setup

The way that you set up Xen or KVM on a VM host depends on operating system you want to use on its associated guests:

The Virtualization Host formula will help you with initializing the host. For more information, see Initialize Virtualization Host.

1.1. Background Information

Uyuni uses libvirt to install and manage guests. You must have the libvirt-daemon package installed on your host. In most cases, the default settings are sufficient and you do not need to adjust them. However, if you want to access the VNC console on your guests as a non-root user, you need to perform some configuration changes. For more information about how to set up the VNC console, see the documentation for your operating system.

You need a bootstrap script on the Uyuni Server. The bootstrap script must include the activation key for your host. We also recommend that you include your GPG key for additional security. For more on creating a bootstrap script, see Register Clients With a Bootstrap Script.

When the bootstrap script is ready, use it to register the host with the Uyuni Server. For more information about client registration, see Client Registration.

1.2. Initialize Virtualization Host

With the Virtualization Host formula, initialize the host:

Procedure: Initializing Virtualization Host
  1. In the Uyuni Web UI, navigate to the System Details page for the host, and click the Formulas tab.

  2. Select the Virtualization Host formula, and click Save.

  3. Click the Virtualization Host subtab.

  4. Check the settings, and click Save Formula.

  5. Apply the Highstate for the changes to take effect.

  6. Restart the salt-minion service to activate the new configuration:

    systemctl restart salt-minion

2. Autoinstall VM Guests

You can use AutoYaST or Kickstart to automatically install and register Xen and KVM guests.

You need an activation key for the VM host you want to register the guests to, and for each guest. The activation key must have the provisioning and Virtualization Platform entitlements. For more information about creating activation keys, see Activation Keys.

If you want to automatically register the guests with Uyuni after installation, you need to create a bootstrap script. For more information about creating a bootstrap script, see Register Clients With a Bootstrap Script.

2.1. Create an Autoinstallable Distribution

You need to create an autoinstallable distribution on the VM host to be able to autoinstall clients from Uyuni. The distribution can be made available from a mounted local or remote directory, or on a loop-mounted ISO image.

The configuration of the autoinstallable distribution differs depending on whether you are using a Red Hat Enterprise Linux or SUSE operating system on your guests. The packages for a Red Hat Enterprise Linux installation are fetched from the associated base channel. Packages for installing SUSE systems are fetched from the autoinstallable distribution. Therefore, for SUSE systems, the autoinstallable distribution must be a complete installation source.

Table 1. Paths for Autoinstallable Distributions
Operating System Type Kernel Location initrd Location

Red Hat Enterprise Linux

images/pxeboot/vmlinuz

images/pxeboot/initrd.img

SUSE

boot/<arch>/loader/initrd

boot/<arch>/loader/linux

In all cases, ensure that the base channel matches the autoinstallable distribution.

Before you begin, ensure you have a installation media available to your VM Host. It can be on a remote resource, a local directory, or a loop-mounted ISO image. Additionally, ensure that all files and directories are world-readable.

Procedure: Creating an Autoinstallable Distribution
  1. In the Uyuni Web UI, navigate to Systems  Autoinstallation  Distributions and click Create Distribution.

  2. In the Create Autoinstallable Distribution section, use these parameters:

    • In the Distribution Label section, type a unique name for the distribution. Use only letters, numbers, hyphens (-), periods (.), and underscores (_), and ensure the name is longer than four characters.

    • In the Tree Path field, type an absolute path to the installation source.

    • In the Base Channel field, select the channel that matches the installation source. This channel is used as the package source for non-SUSE installations.

    • In the Installer Generation field, select the operating system version that matches the installation source.

    • In the Kernel Options field, type any options to be passed to the kernel when booting for the installation. The install= parameter and the self_update=0 parameter are added by default.

    • In the Post Kernel Options section, type any options to be passed to the kernel when booting the installed system for the first time.

  3. Click Create Autoinstallable Distribution to save.

When you have created an autoinstallable distribution, you can edit it by navigating to Systems  Autoinstallation  Distributions and selecting the distribution you want to edit.

2.2. Create and Upload an Autoinstallation Profile

Autoinstallation profiles contain all the installation and configuration data needed to install a system. They can also contain scripts to be executed after the installation is complete.

Kickstart profiles can be created using the Uyuni Web UI, by navigating to Systems  Autoinstallation  Profiles, clicking Create New Kickstart File, and following the prompts.

You can also create AutoYaST or Kickstart autoinstallation profiles by hand. SUSE provides templates of AutoYaST installation files that you can use as a starting point for your own custom files. You will find them at https://github.com/SUSE/manager-build-profiles.

If you are using AutoYaST to install SLES, you also need to include this snippet:

<products config:type="list">
  <listentry>SLES</listentry>
</products>
Procedure: Uploading an Autoinstallation Profile
  1. In the Uyuni Web UI, navigate to Systems  Autoinstallation  Profiles and click Upload Kickstart/AutoYaST File.

  2. In the Create Autoinstallation Profile section, use these parameters:

    • In the Label field, type a unique name for the profile. Use only letters, numbers, hyphens (-), periods (.), and underscores (_), and ensure the name is longer than six characters.

    • In the Autoinstall Tree field, select the autoinstallable distribution you created earlier.

    • In the Virtualization Type field, select the relevant Guest type (for example, KVM Virtualized Guest. Do not choose Xen Virtualized Host here.

    • OPTIONAL: If you want to manually create your autoinstallation profile, you can type it directly into the File Contents field. If you have a file already created, leave the File Contents field blank.

    • In the File to Upload field, click Choose File, and use the system dialog to select the file to upload. If the file is successfully uploaded, the filename is shown in the File to Upload field.

    • The contents of the uploaded file is shown in the File Contents field. If you need to make edits, you can do so directly.

  3. Click Create to save your changes and store the profile.

When you have created an autoinstallation profile, you can edit it by navigating to Systems  Autoinstallation  Profiles and selecting the profile you want to edit. Make the desired changes and save your settings by clicking Create.

If you change the Virtualization Type of an existing Kickstart profile, it might also modify the bootloader and partition options, potentially overwriting any custom settings. Carefully review the Partitioning tab to verify these settings before making changes.

2.3. Automatically Register Guests

When you install VM guests automatically, they are not registered to Uyuni. If you want your guests to be automatically registered as soon as they are installed, you can add a section to the autoinstallation profile that invokes a bootstrap script, and registers the guests.

This section gives instructions for adding a bootstrap script to an existing AutoYaST profile.

For more information about creating a bootstrap script, see Register Clients With a Bootstrap Script. For instructions on how to do this for Kickstart, refer to the Red Hat documentation for your installation.

Procedure: Adding a Bootstrap Script to an AutoYaST Profile
  1. Ensure your bootstrap script contains the activation key for the VM guests you want to register with it, and that is located on the host at /srv/www/htdocs/pub/bootstrap_vm_guests.sh.

  2. In the Uyuni Web UI, navigate to Systems  Autoinstallation  Profiles, and select the AutoYaST profile to associate this script with.

  3. In the File Contents field, add this snippet at the end of the file, immediately before the closing </profile> tag. Ensure you replace the example IP address 192.168.1.1 in the snippet with the correct IP address for your Uyuni Server:

    <scripts>
      <init-scripts config:type="list">
        <script>
          <interpreter>shell</interpreter>
          <location>
            http://192.168.1.1/pub/bootstrap/bootstrap_vm_guests.sh
          </location>
        </script>
      </init-scripts>
    </scripts>
  4. Click Update to save your changes.

If your AutoYaST profile already contains a <scripts> section, do not add a second one. Place the bootstrap snippet inside the existing <scripts> section.

2.4. Autoinstall VM Guests

When you have everything set up, you can start to autoinstall your VM guests.

Each VM host can only install one guest at a time. If you are scheduling more than one autoinstallation, make sure you time them so that the next installation does not begin before the previous one has completed. If a guest installation starts while another one is still running, the running installation is canceled.

  1. In the Uyuni Web UI, navigate to Systems  Overview, and select the VM host you want to install guests on.

  2. Navigate to the Virtualization tab, and the Provisioning subtab.

  3. Select the autoinstallation profile you want to use, and specify a unique name for the guest.

  4. Choose a proxy if applicable and enter a schedule.

  5. To change the guest’s hardware profile and configuration options, click Advanced Options.

  6. Click Schedule Autoinstallation and Finish to complete.

3. Manage VM Guests

You can use the Uyuni Web UI to manage your VM Guests, including actions like shutting down, restarting, and adjusting CPU, and memory allocations.

To do this, you need your Xen or KVM VM host registered to the Uyuni Server, and have the libvirtd service running on the host.

In the Uyuni Web UI, navigate to Systems  System List, and click on the VM host for the guests you want to manage. Navigate to the Virtualization tab to see all guests registered to this host, and access the management functions.

For more information about managing VM guests using the Web UI, see Virtualization.