第9章 Provisioning Virtual Machines on KVM (libvirt)
Kernel-based Virtual Machines (KVMs) use an open source virtualization daemon and API called libvirt running on Red Hat Enterprise Linux. Red Hat Satellite can connect to the libvirt API on a KVM server, provision hosts on the hypervisor, and control certain virtualization functions.
You can use KVM provisioning to create hosts over a network connection or from an existing image.
Prerequisites
- Synchronized content repositories for Red Hat Enterprise Linux. For more information, see Synchronizing Red Hat Repositories in the Content Management Guide.
- An activation key for host registration. For more information, see Creating An Activation Key in the Content Management guide.
- A Capsule Server managing a network on the KVM server. Ensure no other DHCP services run on this network to avoid conflicts with the Capsule Server. For more information about network service configuration for Capsule Servers, see 3章Configuring Networking.
- A Red Hat Enterprise Linux server running KVM virtualization tools (libvirt daemon). For more information, see the Red Hat Enterprise Linux 7 Virtualization Getting Started Guide.
-
An existing virtual machine image if you want to use image-based provisioning. Ensure that this image exists in a storage pool on the KVM host. The
defaultstorage pool is usually located in/var/lib/libvirt/images. Only directory pool storage types can be managed through Satellite. Optional: The examples in these procedures use the root user for KVM. If you want to use a non-root user on the KVM server, you must add the user to the
libvirtgroup on the KVM server:useradd -a -G libvirt non_root_user
useradd -a -G libvirt non_root_userCopy to Clipboard Copied! Toggle word wrap Toggle overflow A Satellite user account with the following roles:
- Edit hosts
View hosts
For more information, see Assigning Roles to a User in the Administering Red Hat Satellite guide.
A custom role in Satellite with the following permissions:
- view_compute_resources
- destroy_compute_resources_vms
- power_compute_resources_vms
- create_compute_resources_vms
- view_compute_resources_vms
- view_locations
view_subnets
For more information about creating roles, see Creating a Role in the Administering Red Hat Satellite guide. For more information about adding permissions to a role, see Adding Permissions to a Role in the Administering Red Hat Satellite guide.
Procedure Overview
- 「Configuring Satellite Server for KVM Connections」.
- 「Adding a KVM Connection to Satellite Server」.
- Optional: 「Adding KVM Images to Satellite Server」. Use this procedure if you want to use image-based provisioning.
- 「Adding KVM Details to a Compute Profile」.
- 「Creating Hosts on KVM」.
9.1. Configuring Satellite Server for KVM Connections リンクのコピーリンクがクリップボードにコピーされました!
Before adding the KVM connection, create an SSH key pair for the foreman user to ensure a secure connection between Satellite Server and KVM.
Procedure
On Satellite Server, switch to the
foremanuser:su foreman -s /bin/bash
# su foreman -s /bin/bashCopy to Clipboard Copied! Toggle word wrap Toggle overflow Generate the key pair:
ssh-keygen
$ ssh-keygenCopy to Clipboard Copied! Toggle word wrap Toggle overflow Copy the public key to the KVM server:
ssh-copy-id root@kvm.example.com
$ ssh-copy-id root@kvm.example.comCopy to Clipboard Copied! Toggle word wrap Toggle overflow Exit the bash shell for the
foremanuser:exit
$ exitCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the
libvirt-clientpackage:satellite-maintain packages install libvirt-client
# satellite-maintain packages install libvirt-clientCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following command to test the connection to the KVM server:
su foreman -s /bin/bash -c 'virsh -c qemu+ssh://root@kvm.example.com/system list'
# su foreman -s /bin/bash -c 'virsh -c qemu+ssh://root@kvm.example.com/system list'Copy to Clipboard Copied! Toggle word wrap Toggle overflow