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:
-
For SUSE operating systems, see the SLES Virtualization Guide available from https://documentation.suse.com/sles/15-SP4/html/SLES-all/book-virtualization.html.
-
For Red Hat Enterprise Linux operating systems, refer to the Red Hat documentation for your version.
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:
Virtualization Host
-
In the Uyuni Web UI, navigate to the
System Details
page for the host, and click theFormulas
tab. -
Select the
Virtualization Host
formula, and click Save. -
Click the
Virtualization Host
subtab. -
Check the settings, and click Save Formula.
-
Apply the Highstate for the changes to take effect.
-
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.
Operating System Type | Kernel Location | initrd Location |
---|---|---|
Red Hat Enterprise Linux |
|
|
SUSE |
|
|
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.
-
In the Uyuni Web UI, navigate to
and click Create Distribution. -
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. Theinstall=
parameter and theself_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.
-
-
Click Create Autoinstallable Distribution to save.
When you have created an autoinstallable distribution, you can edit it by navigating to
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
, 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>
-
For more on AutoYaST, see client-configuration:autoinst-profiles.adoc#autoyast.
-
For more on Kickstart, see client-configuration:autoinst-profiles.adoc#kickstart, or refer to the Red Hat documentation for your installation.
-
In the Uyuni Web UI, navigate to
and click Upload Kickstart/AutoYaST File. -
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 chooseXen 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 theFile 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 theFile 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.
-
-
Click Create to save your changes and store the profile.
When you have created an autoinstallation profile, you can edit it by navigating to
and selecting the profile you want to edit. Make the desired changes and save your settings by clicking Create.
If you change the |
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.
-
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
. -
In the Uyuni Web UI, navigate to
, and select the AutoYaST profile to associate this script with. -
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 address192.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>
-
Click Update to save your changes.
If your AutoYaST profile already contains a |
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. |
-
In the Uyuni Web UI, navigate to
, and select the VM host you want to install guests on. -
Navigate to the
Virtualization
tab, and theProvisioning
subtab. -
Select the autoinstallation profile you want to use, and specify a unique name for the guest.
-
Choose a proxy if applicable and enter a schedule.
-
To change the guest’s hardware profile and configuration options, click Advanced Options.
-
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 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.