Bug 1192217

Summary: [RFE] Provide a means for virt-who to query only specific virtualization clusters
Product: Red Hat Enterprise Linux 6 Reporter: Rich Jerrido <rjerrido>
Component: virt-whoAssignee: Radek Novacek <rnovacek>
Status: CLOSED ERRATA QA Contact: gaoshang <sgao>
Severity: unspecified Docs Contact: Laura Novich <lnovich>
Priority: unspecified    
Version: 6.8CC: gxing, jherrman, jhradile, ovasik, rbalakri, shihliu, tlavigne, wlehman
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: virt-who-0.12-1.el6 Doc Type: Release Note
Doc Text:
virt-who supports cluster filtering With this update, the virt-who service introduces a filtering mechanism for the Subscription Manager reports. As a result, users can now choose which clusters virt-who should display according to the specified parameters. For example, hosts that do not run any Red Hat Enterprise Linux guests, or hosts that run guests of a specified version of Red Hat Enterprise Linux.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:15:50 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rich Jerrido 2015-02-12 21:52:03 UTC
Description of problem:
As a user of virt-who, I would like the ability to limit the virtualization clusters that virt-who queries for host/guest mapping. 

Currently today, in large virtualization environments, virt-who reports all hypervisors to the subscription management system (SAM/Satellite). This becomes very messy in the UI as it shows systems that the end-user does not (and the user does not plan to) have RHEL guests running on. 

This RFE requests the ability to configure virt-who to support a subset of clusters, provided in a list format. 

Version-Release number of selected component (if applicable):
virt-who-0.10-8.el6.noarch

Expected results:

A new option, such as 

VIRTWHO_ESX_CLUSTERS=ClusterA,ClusterB,foo,bar,baz

Is what is desired.

Comment 2 Radek Novacek 2015-02-27 11:15:32 UTC
This feature is now implemented upstream like this: there are two options that affects which hosts are filtered according to its parent:

filter_host_parents - if provided, only hosts with parent name (usually ComputeResource) in this list will be reported,
exclude_host_parents - do not report hosts with parent name in this list.

There are also similar options for filtering by host uuids.

Is this acceptable?

Comment 3 Radek Novacek 2015-02-27 19:42:59 UTC
Fixed by rebase to virt-who-0.12-1.el6.

Comment 5 Liushihui 2015-04-10 08:02:35 UTC
Verified it on virt-who-0.12-2.el6.noarch, virt-who can filter out specific ComputeResource with "filter_host_parents" and "exclude_host_parents".

Verified version:
virt-who-0.12-2.el6.noarch
subscription-manager-1.14.1-1.el6.x86_64

Verified process:
Precondition:There are two esx hosts under two datacenter in the vcenter.
1.Register system to SAM server
2.Configure virt-who run at esx mode and configure a computerResource which can be filtered.
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/vir 
[test-esx1]
type=esx
server=10.66.79.72
username=Administrator
password=qwer1234P!
owner=ACME_Corporation
env=Library
filter_host_parents="domain-s98"
3.Check the virt-who's log, virt-who can send the specific computerResource to SAM
2015-04-10 15:52:39,299 [DEBUG]  @virtwho.py:84 - Using config named 'test-esx1'
2015-04-10 15:52:39,300 [INFO]  @virtwho.py:475 - Using configuration "test-esx1" ("esx" mode)
2015-04-10 15:52:39,300 [DEBUG]  @virtwho.py:131 - Starting infinite loop with 10 seconds interval
2015-04-10 15:52:39,430 [DEBUG]  @esx.py:51 - Log into ESX
2015-04-10 15:52:40,528 [DEBUG]  @esx.py:54 - Creating ESX event filter
2015-04-10 15:52:40,849 [DEBUG]  @esx.py:131 - Skipping host 'host-124' because its parent 'domain-c122' is not included
2015-04-10 15:52:40,849 [DEBUG]  @esx.py:113 - Waiting for ESX changes
2015-04-10 15:52:40,871 [INFO]  @subscriptionmanager.py:124 - Sending update in hosts-to-guests mapping: {86b2bd00-8bad-11e2-87f4-6c3be514699d: [4224e5d2-4fcf-2bc2-2559-5846035d3a78, 4224a77f-1c50-42cb-3507-2b68b447ed60]}
2015-04-10 15:52:40,871 [DEBUG]  @subscriptionmanager.py:76 - Authenticating with certificate: /etc/pki/consumer/cert.pem
4. stop virt-who service, then configure virt-who filter out two computerResource.
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/vir 
[test-esx1]
type=esx
server=10.66.79.72
username=Administrator
password=qwer1234P!
owner=ACME_Corporation
env=Library
filter_host_parents="domain-s98","domain-c122"
5. Restart virt-who service can check the virt-who's log, virt-who can send the two specific computerResource to SAM 
2015-04-10 15:48:39,885 [DEBUG]  @virtwho.py:84 - Using config named 'test-esx1'
2015-04-10 15:48:39,886 [INFO]  @virtwho.py:475 - Using configuration "test-esx1" ("esx" mode)
2015-04-10 15:48:39,886 [DEBUG]  @virtwho.py:131 - Starting infinite loop with 10 seconds interval
2015-04-10 15:48:40,019 [DEBUG]  @esx.py:51 - Log into ESX
2015-04-10 15:48:41,117 [DEBUG]  @esx.py:54 - Creating ESX event filter
2015-04-10 15:48:41,443 [DEBUG]  @esx.py:113 - Waiting for ESX changes
2015-04-10 15:48:41,461 [INFO]  @subscriptionmanager.py:124 - Sending update in hosts-to-guests mapping: {aee4ff00-8c33-11e2-994a-6c3be51d959a: [], 86b2bd00-8bad-11e2-87f4-6c3be514699d: [4224e5d2-4fcf-2bc2-2559-5846035d3a78, 4224a77f-1c50-42cb-3507-2b68b447ed60]}
2015-04-10 15:48:41,462 [DEBUG]  @subscriptionmanager.py:76 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2015-04-10 15:48:42,615 [INFO]  @virtwho.py:127 - Created host: 2c90b4ac-a1e1-4ac8-8606-2ee84cec0803 with guests: [4224e5d2-4fcf-2bc2-2559-5846035d3a78, 4224a77f-1c50-42cb-3507-2b68b447ed60]
2015-04-10 15:48:42,615 [INFO]  @virtwho.py:127 - Created host: 8adaae82-83af-4357-9a8b-2cc9a5c1cdfe with guests: []
6. stop virt-who service, then configure virt-who filter out two computerResource.
[root@hp-z220-06 virt-who.d]# cat /etc/virt-who.d/vir 
[test-esx1]
type=esx
server=10.66.79.72
username=Administrator
password=qwer1234P!
owner=ACME_Corporation
env=Library
exclude_host_parents="domain-s98"
7. Restart virt-who service, check the virt-who's log, virt-who can't send specific computerResource to SAM 
2015-04-10 15:57:50,195 [DEBUG]  @virtwho.py:84 - Using config named 'test-esx1'
2015-04-10 15:57:50,195 [INFO]  @virtwho.py:475 - Using configuration "test-esx1" ("esx" mode)
2015-04-10 15:57:50,195 [DEBUG]  @virtwho.py:131 - Starting infinite loop with 10 seconds interval
2015-04-10 15:57:50,324 [DEBUG]  @esx.py:51 - Log into ESX
2015-04-10 15:57:51,428 [DEBUG]  @esx.py:54 - Creating ESX event filter
2015-04-10 15:57:51,752 [DEBUG]  @esx.py:128 - Skipping host 'host-100' because its parent 'domain-s98' is excluded
2015-04-10 15:57:51,753 [DEBUG]  @esx.py:113 - Waiting for ESX changes
2015-04-10 15:57:51,769 [INFO]  @subscriptionmanager.py:124 - Sending update in hosts-to-guests mapping: {aee4ff00-8c33-11e2-994a-6c3be51d959a: []}
2015-04-10 15:57:51,770 [DEBUG]  @subscriptionmanager.py:76 - Authenticating with certificate: /etc/pki/consumer/cert.pem

Result: According to step3,step5,step7's result, virt-who can query specific computerResource with "filter_host_parents" and "exclude_host_parents". Therefore, Verify it on virt-who-0.12-2.el6.noarch

Comment 7 errata-xmlrpc 2015-07-22 07:15:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-1377.html