Bug 1368341

Summary: Virt-who still send mapping info to stage candlepin although run virt-who with --sam/--satellite6
Product: Red Hat Enterprise Linux 7 Reporter: Liushihui <shihliu>
Component: virt-whoAssignee: Nikos Moumoulidis <nmoumoul>
Status: CLOSED ERRATA QA Contact: Eko <hsun>
Severity: low Docs Contact:
Priority: low    
Version: 7.3CC: csnyder, ldai, nmoumoul, sgao, wpoteat, yuefliu
Target Milestone: rcKeywords: EasyFix, Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1409055 (view as bug list) Environment:
Last Closed: 2018-10-30 10:47:13 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:
Bug Depends On:    
Bug Blocks: 1409055    

Description Liushihui 2016-08-19 06:34:39 UTC
Description of problem:
When system registered to stage candlepin, run virt-who with --sam/satellite6 in CLI,virt-who still can send mapping info to stage candlepin.

Version-Release number of selected component (if applicable):
virt-who-0.17-7.el7.noarch
subscription-manager-1.17.10-1.el7.x86_64
python-rhsm-1.17.6-1.el7.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Register system to stage candlepin
2. Run virt-who in CLI with --sam/--satellite6
[root@cloud-qe-16-vm-03 ~]# virt-who --hyperv --hyperv-owner=8036391 --hyperv-env=Library --hyperv-server=10.73.5.203 --hyperv-username=administrator --hyperv-password=Welcome1 -o -d --sam
or 
[root@cloud-qe-16-vm-03 ~]# virt-who --hyperv --hyperv-owner=8036391 --hyperv-env=Library --hyperv-server=10.73.5.203 --hyperv-username=administrator --hyperv-password=Welcome1 -o -d --satellite6
2016-08-19 02:19:54,065 [virtwho.init INFO] MainProcess(15478):MainThread @main.py:main:160 - Using configuration "env/cmdline" ("hyperv" mode)
2016-08-19 02:19:54,066 [virtwho.init INFO] MainProcess(15478):MainThread @main.py:main:162 - Using reporter_id='cloud-qe-16-vm-03.idmqe.lab.eng.bos.redhat.com-41e2151a02208a886d33766e1c88c11e'
2016-08-19 02:19:54,109 [virtwho.env_cmdline DEBUG] MainProcess(15478):MainThread @hyperv.py:__init__:472 - Hyper-V url: http://10.73.5.203:5985/wsman
2016-08-19 02:19:54,115 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @virt.py:run:364 - Virt backend 'env/cmdline' started
2016-08-19 02:19:54,761 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @hyperv.py:retry_ntlm_negotitate:64 - Using NTLM authentication
2016-08-19 02:19:55,382 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @hyperv.py:retry_ntlm_authenticate:77 - Sending NTLM authentication data
2016-08-19 02:19:55,706 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @hyperv.py:retry_ntlm_authenticate:100 - NTLM authentication successful
2016-08-19 02:19:55,715 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @hyperv.py:getHostGuestMapping:520 - Unable to enumerate using root/virtualization namespace, trying root/virtualization/v2 namespace
2016-08-19 02:20:02,162 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @virt.py:enqueue:357 - Report for config "env/cmdline" gathered, putting to queue for sending
2016-08-19 02:20:02,166 [virtwho.env_cmdline DEBUG] HyperV-1(15485):MainThread @virt.py:run:385 - Virt backend 'env/cmdline' stopped after sending one report
2016-08-19 02:20:02,193 [virtwho.main DEBUG] MainProcess(15478):MainThread @subscriptionmanager.py:_connect:123 - Authenticating with certificate: /etc/pki/consumer/cert.pem
2016-08-19 02:20:02,737 [virtwho.main DEBUG] MainProcess(15478):MainThread @subscriptionmanager.py:hypervisorCheckIn:171 - Checking if server has capability 'hypervisor_async'
2016-08-19 02:20:03,279 [virtwho.main DEBUG] MainProcess(15478):MainThread @subscriptionmanager.py:hypervisorCheckIn:183 - Server does not have 'hypervisors_async' capability
2016-08-19 02:20:03,280 [virtwho.main INFO] MainProcess(15478):MainThread @subscriptionmanager.py:hypervisorCheckIn:194 - Sending update in hosts-to-guests mapping for config "env/cmdline": 1 hypervisors and 2 guests found
2016-08-19 02:20:03,281 [virtwho.main DEBUG] MainProcess(15478):MainThread @subscriptionmanager.py:hypervisorCheckIn:195 - Host-to-guest mapping: {
    "564D900A-2E82-672D-2CB7-C17F0B3FF876": [
        {
            "guestId": "EBBF4A99-85AD-0947-AB31-45DD18FE96E5", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "hyperv"
            }
        }, 
        {
            "guestId": "3A830D1F-AC88-EA45-94D2-9AF69CCEAE6D", 
            "state": 1, 
            "attributes": {
                "active": 1, 
                "virtWhoType": "hyperv"
            }
        }
    ]
}
2016-08-19 02:20:03,873 [virtwho.main DEBUG] MainProcess(15478):MainThread @executor.py:send_report:101 - Report for config "env/cmdline" sent
2016-08-19 02:20:03,875 [virtwho.main DEBUG] MainProcess(15478):MainThread @__main__.py:main:19 - virt-who terminated
2016-08-19 02:20:03,876 [virtwho.main DEBUG] MainProcess(15478):MainThread @executor.py:terminate:303 - virt-who is shutting down

Actual results:
virt-who can report host/guest associations to stage candlepin.

Expected results:
Virt-who shouldn't report host/guest associations to stage candlepin since virt-who run with --sam/--satellite6, it should show some remind info. such as:
"--sam/--satellite6 is not supported on stage candlepin, exiting"

Additional info:

Comment 1 Radek Novacek 2016-08-23 11:23:33 UTC
I don't understand why virt-who should threat stage candlepin differently. It uses the same API.

Is there any reason why should virt-who behave differently with stage candlepin?

Comment 2 Liushihui 2016-08-30 06:21:09 UTC
Radek, As I noticed that "--satellite6/--sam" option hasn't taken any effect, virt-who can send mapping info to the registered server no matter what server options has been specified in the CLI command. Meanwhile, these two options' functions are different from it on the virt-who man page.

please see the instances as the following:
1. Register to stage candlepin, run virt-who with "--satellite6/--sam", virt-who can send mapping info to stage candlepin.
# virt-who --sam -o -d 
# virt-who --satellite6 -o -d 
2. Register to SAM, run virt-who with "--satellite6/--sam", virt-who can send mapping info to SAM.
# virt-who --sam -o -d 
# virt-who --satellite6 -o -d 
3. Register to Satellite6, run virt-who with "--satellite6/--sam", virt-who can send mapping info to Satellite6.

However, in the virt-who man page ,I notice these two options explanation as the following, There are two differences.
1. It hasn't reminded with "--satellite6/--sam" can reported mapping to stage candlepin. 
2. It hasn't reminded with "--satellite6" can reported to SAM.
# man virt-who
--satellite6 Report host/guest associations to the Satellite 6 server
--sam  Report host/guest associations to the Subscription Asset Manager or Satellite 6 [default]

Therefore, I suggest two types of updating.
1. Update the virt-who man page to make it the same as the actual result
--satellite6 Report host/guest associations to the SAM, Satellite 6 server or Stage Candlepin.
--sam  Report host/guest associations to the SAM,Satellite 6 server or Stage Candlepin.[default]
2. Remove --sam/satellite6 since it hasn't taken any effect.

Comment 3 Chris Snyder 2016-12-22 16:33:42 UTC
I believe the fix for this is to do one of the following:
1) Remove those options (as the APIs are the same either way)
2) Improve them to be useful.

My preference would be option 1.

Some brief investigation leads me to believe not much (aside from some config validation) is done with those options (--sam/--satellite6).

Comment 4 Chris Snyder 2017-06-08 21:04:37 UTC
After looking at this again, I still think the best solution will be to output a warning that the '--sam' and '--satellite6' options specify the default behaviour and as such are not actually used.

In addition to that change we should update the man page to reflect the fact that these options are the default behaviour and their use is deprecated.

Comment 5 yuefliu 2017-11-17 07:56:09 UTC
By checking with virt-who-0.21.0-1.el7.noarch, in virt-who man page there have been [Deprecated] warning for the options, but no related reminder info in rhsm log.

# man virt-who

   --sam  [Deprecated] Report host/guest associations to the Subscription Asset Manager or Satellite 6 [default]

   --satellite5 [Deprecated] Report host/guest associations to the Satellite 5 server

  --satellite6 [Deprecated] Report host/guest associations to the Satellite 6 server

Comment 12 errata-xmlrpc 2018-10-30 10:47:13 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://access.redhat.com/errata/RHBA-2018:3169