How to configure virt-who for a KVM host?
Environment
- A Red Hat Enterprise Linux (RHEL) server, registered to a Satellite 6 server, configured to be a Kernel-based Virtual Machine (KVM) hypervisor that is not part of a:
- This content is not included.Red Hat Enterprise Virtualization (RHEV) cluster,
- This content is not included.Red Hat Virtualization (RHV) cluster or
- This content is not included.Red Hat OpenStack Platform (RHOSP) cluster.
- Red Hat Satellite 6
Issue
- How do I setup virt-who for a KVM host?
- How do I configure virt-who for a KVM host and Satellite 6?
- I am following VMware or Hyper-V guest to "Red Hat Enterprise Linux for Virtual Datacenters and I want to apply the same for a KVM host.
- I am following How to configure "virt-who" service to use "Virtual Data Center" subscriptions, when it needs to report to a Red Hat Satellite 6 server? and I want to apply the same for a KVM host.
Resolution
Scenario 1: virt-who running on the KVM host, itself.
Note: Red Hat instructs users to install virt-who on each RHEL-based KVM host. This is true for RHEL-based RHEV, RHV and RHOSP hypervisors, even though this Knowledge Centered Support (KCS) solution does not directly apply to them. Please see the following KCS solutions if your RHEL-based KVM host is part of a RHEV, RHV or RHOSP cluster:
- Configuration of virt-who to support Red Hat Virtualization.
- This content is not included.Configure virt-who for OpenStack
If the virt-who service used to report the KVM host's virtual guests is not run on that KVM host, but instead run from somewhere else (like on the satellite) -- it will create a second profile for the KVM host in Satellite's hosts list. For example, the host list will contain both a kvmhost.example.com entry and a virt-who-kvmhost.example.com entry.
To prevent that, install virt-who, create a /etc/virt-who.d/kvm.conf file, enable and start the virt-who service on the already-registered-to-the-satellite KVM host:
# yum -y install virt-who
# cat > /etc/virt-who.d/kvm.conf << EOF
[kvm]
type=libvirt
server=qemu:///system
owner=(YOUR_ORG_ID_HERE)
hypervisor_id=hostname
EOF
# systemctl enable virt-who.service
# systemctl start virt-who.service
Please know that:
- The owner value is one of the organizations IDs that has been defined in Satellite 6. One can see the list of possible values by running
subscription-manager orgson the KVM host after having registered it to the Satellite. - The env value is the Satellite 6 environment in which virtual machines running on this KVM host should be placed. One can see the list of possible values by running
subscription-manager environmentson the KVM host after having registered it to the Satellite. - The above
systemctlcommands are for a RHEL7-based KVM host. For a RHEL6-based KVM host, please instead use:chkconfig virt-who onservice virt-who start
Scenario 2: virt-who not running on the KVM host.
Note 1: Often this means the virt-who instance reporting the KVM host's guests is running on the satellite, itself. But it could run elsewhere -- on a machine that is neither the KVM host nor the satellite. These instructions will call it the virt-who host.
Note 2: This is not a supported configuration, due to the double-profile issue described above.
Scenario 2.1: For Satellite 6.2 and below.
One can use the Virt-Who Configuration Helper lab app to create a configuration file.
For this to work, virt-who must read the KVM host's libvirt's socket. It can do this by accessing the KVM host over SSH. Yet, it cannot login with a username and password. Thus, one will need to setup a SSH passwordless login for the virt-who host's root user (because virt-who runs as the root user) to access the KVM host's root account. The SSH key must not have a passphrase and must be named one of the usual key names. (I.e. ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, ~/.ssh/id_ed25519 or ~/.ssh/id_rsa.)
After the SSH key has been configured for the virt-who host's root user's account, install virt-who on that host.
# yum -y install virt-who
Then follow the instructions from the output of the configuration helper. An example of the virt-who configuration file outputted from that helper is:
[kvm]
type=libvirt
hypervisor_id=hostname
server=kvmhost.example.com
owner="Default Organization"
env=Library
rhsm_hostname=satellite.example.com
rhsm_username=admin
rhsm_encrypted_password=75fa176aecdc7a1b6b53778b38eac87c7152d5c916a755cb56071a93c01e040d
rhsm_prefix=/rhsm
If one does not want to use the KVM's host's root account, one can instead use any account on the KVM host. This is because libvirt's local socket allows all users to read it. To do that, add the virt-who host's root user's public SSH key to the ~/.ssh/authorized_keys file of the KVM host's non-root account and add a username= line with the name of that user to the virt-who configuration file that was output by the helper.
Finally, enable and start the virt-who service on the virt-who host.
# systemctl enable virt-who.service
# systemctl start virt-who.service
The above systemctl commands are for a RHEL7-based virt-who host. For a RHEL6-based one, please instead use:
chkconfig virt-who onservice virt-who start
Scenario 2.2: For Satellite 6.3 and above.
Please refer to the Red Hat Satellite 6.3 Virtual Instances Guide's Chapter 3. Configuring virt-who.
Note that this method's default virt-who installation & execution location is the satellite server. Make sure to follow the specific instructions in 3.3. Deploying virt-who Configuration to install & execute it on designated virt-who host.
Again, this entire scenario is not supported for RHEL-based KVM hosts registered to the Satellite server. Please see note 2, above.
For more KB articles/solutions related to Virt-who and Virtual Datacenter (VDC) Subscriptions Issues, please refer to the Consolidated Troubleshooting Article for Virt-who and Virtual Datacenter (VDC) Subscriptions Issues
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.