Virtualization with Xen and KVM

Xen and KVM virtualized clients can be managed directly in SUSE Manager.

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

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

Host Setup

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

For SUSE operating systems, see the SLES Virtualization Guide available from https://www.suse.com/documentation/sles-15/book_virt/data/book_virt.html.

For Red Hat Enterprise Linux operating systems, refer to the Red Hat documentation for your version.

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

You will require a bootstrap script on the SUSE Manager Server. Your 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 client-configuration:registration-bootstrap.adoc.

When your bootstrap script is ready, execute it on the host to register it with the SUSE Manager Server. For more on client registration, see client-configuration:manual-registration-overview.adoc.

For Salt clients, you will need to enable the Virtualization Host entitlement. This allows you to see VM changes instantly. To do this, in the SUSE Manager Web UI, navigate to the System Details page for the host, and click on the Properties tab. In the Add-On System Types section, check Virtualization Host, and click Update Properties to save the changes. You will need to schedule a hardware refresh to activate the change. Navigate to System Details  Hardware, and click Schedule Hardware Refresh.

By default, VM hosts use the rhnsd service to check for scheduled actions every four hours, in order to load balance in environments where there are a lot of clients. This can create delays of up to four hours before an action is carried out. When you are managing VM guests, this long delay is not always ideal, especially for actions like rebooting a guest. To address this, you can disable the rhnsd service, and enable the osad service. The osad service receives commands using a jabber protocol, and will execute commands instantly.

To disable the rhnsd service, and enable the osad daemon, run these commands as the root user:

service rhnsd stop
service rhnsd disable
service osad enable
service osad start

Autoinstallation

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

You will require an activation key for the VM host you want to register the guests to, and for each guest. Your activation key must have the provisioning and Virtualization Platform entitlements. Your activation key must also have access to the mgr-virtualization-host and mgr-osad packages. For more on creating activation keys, see client-configuration:clients-and-activation-keys.adoc.

If you want to automatically register the guests with SUSE Manager after installation, you will need to create a bootstrap script. For more on creating a bootstrap script, see client-configuration:registration-bootstrap.adoc.

Autoinstallation of VM guests works only if they are configured as Traditional clients. Salt clients can be created using a template disk image, but not by using AutoYaST or Kickstart.

Create an Autoinstallable Distribution

You will need to create an autoinstallable distribution on the VM host to be able to autoinstall clients from SUSE Manager. 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 will differ depending on whether you are using a SLES or Red Hat Enterprise Linux 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 SLES 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

SLES

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 network resource, a local directory, or an loop-mounted ISO image. Additionally, ensure that all files and directories are world-readable.

Procedure: Creating an Autoinstallable Distribution
  1. In the SUSE Manager 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 pt.options=self_update 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.

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 SUSE Manager 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.

An example AutoYaST profile that includes a script for registering the client with SUSE Manager is available in administration:autoyast-example.adoc. If you are using AutoYaST to install SLES, you will also need to include this snippet:

<products config:type="list">
  <listentry>SLES</listentry>
</products>

For more on AutoYaST, see client-configuration:autoyast.adoc.

For more on Kickstart, see client-configurastion:kickstart.adoc, or refer to the Red Hat documentation for your installation.

Procedure: Uploading an Autoinstallation Profile
  1. In the SUSE Manager 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 will be shown in the File to Upload field.

    • The contents of the uploaded file will be 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.

Automatically Register Guests

When you install VM guests automatically, they are not registered to SUSE Manager. 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 on creating a bootstrap script, see client-configuration:registration-bootstrap.adoc. 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 SUSE Manager 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 in the snippet with the correct IP address for your SUSE Manager 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.

Autoinstall VM Guests

Once 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 will be canceled.

  1. In the SUSE Manager 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.

Manage VM Guests

You can use the SUSE Manager Web UI to manage your VM Guests, including actions like shutting downa nd restarting, and adjusting CPU and memory allocations.

To do this, you will need your Xen or KVM VM host registered to the SUSE Manager Server, and have the libvirtd service running on the host. You will also need the mgr-cfg-actions package installed on your SUSE Manager Server.

In the SUSE Manager 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 on managing VM guests using the Web UI, see reference:systems/system-details/sd-virtualization.adoc.