Chapter 10. Registering the Hypervisor and Virtual Machine Red Hat Enterprise Linux 6 and 7 require that every guest virtual machine is mapped to a specific hypervisor in order to ensure that every guest is allocated the same level of subscription service. To do this you need to install a subscription agent that automatically detects all guest Virtual Machines (VMs) on each KVM hypervisor that is installed and registered, which in turn will create a mapping file that sits on the host. This mapping file ensures that all guest VMs receive the following benefits: Subscriptions specific to virtual systems are readily available and can be applied to all of the associated guest VMs. All subscription benefits that can be inherited from the hypervisor are readily available and can be applied to all of the associated guest VMs. Note The information provided in this chapter is specific to Red Hat Enterprise Linux subscriptions only. If you also have a Red Hat Virtualization subscription, or a Red Hat Satellite subscription, you should also consult the virt-who information provided with those subscriptions. More information on Red Hat Subscription Management can also be found in the Red Hat Subscription Management Guide found on the customer portal. 10.1. Installing virt-who on the Host Physical Machine Register the KVM hypervisor Register the KVM Hypervisor by running the subscription-manager register [options] command in a terminal as the root user on the host physical machine. More options are available using the # subscription-manager register --help menu. In cases where you are using a user name and password, use the credentials that are known to the Subscription Manager application. If this is your very first time subscribing and you do not have a user account, contact customer support. For example to register the VM as 'admin' with 'secret' as a password, you would send the following command: Install the virt-who packages Install the virt-who packages, by running the following command on the host physical machine: Create a virt-who configuration file For each hypervisor, add a configuration file in the /etc/virt-who.d/ directory. At a minimum, the file must contain the following snippet: For more detailed information on configuring virt-who , see Section 10.1.1, "Configuring virt-who " . Start the virt-who service Start the virt-who service by running the following command on the host physical machine: Confirm virt-who service is receiving guest information At this point, the virt-who service will start collecting a list of domains from the host. Check the /var/log/rhsm/rhsm.log file on the host physical machine to confirm that the file contains a list of the guest VMs. For example: Procedure 10.1. Managing the subscription on the customer portal Subscribing the hypervisor As the virtual machines will be receiving the same subscription benefits as the hypervisor, it is important that the hypervisor has a valid subscription and that the subscription is available for the VMs to use. Log in to the Customer Portal Provide your Red Hat account credentials at the Red Hat Customer Portal to log in. Click the Systems link Go to the Systems section of the My Subscriptions interface. Select the hypervisor On the Systems page, there is a table of all subscribed systems. Click the name of the hypervisor (for example localhost.localdomain ). In the details page that opens, click Attach a subscription and select all the subscriptions listed. Click Attach Selected . This will attach the host's physical subscription to the hypervisor so that the guests can benefit from the subscription. Subscribing the guest virtual machines - first time use This step is for those who have a new subscription and have never subscribed a guest virtual machine before. If you are adding virtual machines, skip this step. To consume the subscription assigned to the hypervisor profile on the machine running the virt-who service, auto subscribe by running the following command in a terminal on the guest virtual machine. Subscribing additional guest virtual machines If you just subscribed a virtual machine for the first time, skip this step. If you are adding additional virtual machines, note that running this command will not necessarily re-attach the same subscriptions to the guest virtual machine. This is because removing all subscriptions then allowing auto-attach to resolve what is necessary for a given guest virtual machine may result in different subscriptions consumed than before. This may not have any effect on your system, but it is something you should be aware about. If you used a manual attachment procedure to attach the virtual machine, which is not described below, you will need to re-attach those virtual machines manually as the auto-attach will not work. Use the following command to first remove the subscriptions for the old guests, and then use the auto-attach to attach subscriptions to all the guests. Run these commands on the guest virtual machine. Confirm subscriptions are attached Confirm that the subscription is attached to the hypervisor by running the following command on the guest virtual machine: Output similar to the following will be displayed. Pay attention to the Subscription Details. It should say 'Subscription is current'. The ID for the subscription to attach to the system is displayed here. You will need this ID if you need to attach the subscription manually. Indicates if your subscription is current. If your subscription is not current, an error message appears. One example is Guest has not been reported on any host and is using a temporary unmapped guest subscription. In this case the guest needs to be subscribed. In other cases, use the information as indicated in Section 10.5.2, "I have subscription status errors, what do I do?" . Register additional guests When you install new guest VMs on the hypervisor, you must register the new VM and use the subscription attached to the hypervisor, by running the following commands on the guest virtual machine: 10.1.1. Configuring virt-who The virt-who service is configured using the following files: /etc/virt-who.conf - Contains general configuration information including the interval for checking connected hypervisors for changes. /etc/virt-who.d/ hypervisor_name .conf - Contains configuration information for a specific hypervisor. A web-based wizard is provided to generate hypervisor configuration files and the snippets required for virt-who.conf . To run the wizard, browse to Red Hat Virtualization Agent (virt-who) Configuration Helper on the Customer Portal. On the second page of the wizard, select the following options: Where does your virt-who report to? : Subscription Asset Manager Hypervisor Type : libvirt Follow the wizard to complete the configuration. If the configuration is performed correctly, virt-who will automatically provide the selected subscriptions to existing and future guests on the specified hypervisor. For more information on hypervisor configuration files, see the virt-who-config man page.

Commands:
subscription-manager register --username= admin --password= secret --auto-attach
yum install virt-who
[libvirt] type=libvirt
systemctl start virt-who.service systemctl enable virt-who.service
2015-05-28 12:33:31,424 DEBUG: Libvirt domains found: [{'guestId': '58d59128-cfbb-4f2c-93de-230307db2ce0', 'attributes': {'active': 0, 'virtWhoType': 'libvirt', 'hypervisorType': 'QEMU'}, 'state': 5}]
subscription-manager attach --auto
subscription-manager remove --all subscription-manager attach --auto
subscription-manager list --consumed
subscription-manager list --consumed +-------------------------------------------+ Consumed Subscriptions +-------------------------------------------+ Subscription Name: Awesome OS with unlimited virtual guests Provides: Awesome OS Server Bits SKU: awesomeos-virt-unlimited Contract: 0 Account: ######### Your account number ##### Serial: ######### Your serial number ###### Pool ID: XYZ123 Provides Management: No Active: True Quantity Used: 1 Service Level: Service Type: Status Details: Subscription is current Subscription Type: Starts: 01/01/2015 Ends: 12/31/2015 System Type: Virtual
subscription-manager register subscription-manager attach --auto subscription-manager list --consumed