Bug 783461

Summary: Could not find ESX host on SAM WebUI
Product: [Retired] Subscription Asset Manager Reporter: Keqin Hong <khong>
Component: katelloAssignee: Bryan Kearney <bkearney>
Status: CLOSED CURRENTRELEASE QA Contact: Eric Sammons <esammons>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.0.0CC: huiwang, inecas, mstead, tomckay, yuzheng
Target Milestone: ---Keywords: TestBlocker
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 783529 (view as bug list) Environment:
Last Closed: 2012-02-08 04:49:16 UTC Type: ---
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: 703617, 783529    
Attachments:
Description Flags
no esx host found on SAM WebUI none

Description Keqin Hong 2012-01-20 14:19:05 UTC
Description of problem:
After virt-who successfully sending esx hostid:guestids mappings to SAM, we could find the esx host on SAM WebUI. However, we could see the esx guest was associated with the esx host.

See attached screenshot for more info.

Version-Release number of selected component (if applicable):
virt-who-0.5-5.el5
ESX4.1
katello-headpin-0.1.126-2.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-cli-headpin-0.1.13-2.el6.noarch
katello-configure-0.1.52-2.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
katello-cli-common-0.1.34-2.el6.noarch
katello-common-0.1.180-2.el6.noarch
katello-headpin-all-0.1.126-2.el6.noarch
katello-glue-candlepin-0.1.180-2.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-certs-tools-1.0.1-2.el6.noarch
candlepin-0.5.10-1.el6.noarch
candlepin-tomcat6-0.5.10-1.el6.noarch
katello-glue-candlepin-0.1.180-2.el6.noarch
thumbslug-0.0.21-1.el6.noarch


How reproducible:


Step to Reproduce:
Following steps are copied from https://bugzilla.redhat.com/show_bug.cgi?id=783355#c0

1. prepared one rhel5.8-snapshot4.0 host, and register to SAM:
#subscription-namager register --org=ACME_Corporation --environment=env1
--username=$username --password=$password

2.Deployed the env of ESX as following:
Set the vcenter's username/password 
Vcenter username : Administrator
Vcenter password :123qweP
Vcenter server IP : 10.66.5.106
Vsphere client Ip : 10.66.6.128
ESX IP: 10.66.6.66
ESX username=$username
ESX password=$password
Installed some Guests on ESX

3.Set the /etc/sysconfig/virt-who on rhel5.8-snapshot5.0 host (or on one of the
guests that is installed on ESX).

#vim /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=env1
VIRTWHO_ESX_SERVER=10.66.5.106
VIRTWHO_ESX_USERNAME=Administrator
VIRTWHO_ESX_PASSWORD=123qweP

4.Restart virt-who service
#service virt-who restart

5.Log in SAM WebUI and look for esx host under "Systems" tab

Actual results:
no esx host found

Expected results:
esx host found, and can add subscriptions for the esx host

Additional info:

Comment 1 Keqin Hong 2012-01-20 14:22:57 UTC
Created attachment 556516 [details]
no esx host found on SAM WebUI

Comment 2 Michael Stead 2012-01-20 17:34:10 UTC
I have concluded that the esx host reported by virt-who was created and associated with the reported guests in candlepin (according to the database).

After looking at the katelloschema database, I have noticed that a 'system' entry was not created for the host's consumer that was created in candlepin.

When virt-who reports the host/guest mapping to candlepin, candlepin will create the new Host consumer associate its guests, and then return some metadata about what happened (consumers created, guests associated and any failures).

From what I understand, katello should have looked at candlepins's response, seen that the host consumer was created, and (I'm assuming katello logic here) create a new system entry doing the environment association ect...

Someone more familiar with the katello side of this process would likely be better to look at this issue.

Comment 4 Ivan Necas 2012-01-23 08:39:15 UTC
@michael - that's correct understanding.

@keqin - if you have the Katello system still running, or if you can reproduce, would you try to list systems through katello cli? 
  
  katello systems list --org OrgName

Alternatively, you could list the systems table from katello database to see, if records are there.

On my system I have (maybe) the same issue. The ESX doesn't show up in Katello UI, but there is a record database and it shows up in CLI. Let's ask somebody from UI what issue there might be. Maybe something with elastic search. Maybe the issuce is caused by the fact that the hypervisor created has different type (systems#type = 'Hypervisor').

Comment 6 Ivan Necas 2012-01-23 14:44:53 UTC
Looking into the log of that machine I see following stack trace. This issue was solved in Katello in commit 6e16ef90476800ca00a40f1a9662e05cb413a10b. It's a one-liner.

Started POST "/headpin//api/hypervisors?owner=ACME_Corporation&env=env1" for 10.66.5.42 at Sat Jan 21 02:52:50 +0800 2012
  Processing by Api::SystemsController#hypervisors_update as JSON
  Parameters: {"44454c4c-4c00-1031-8053-b8c04f4e3258"=>[], "env"=>"env1", "owner"=>"ACME_Corporation"}
TypeError: can't convert nil into Array
/usr/share/katello/app/models/indexed_model.rb:57:in `+'
/usr/share/katello/app/models/indexed_model.rb:57:in `indexed_attributes'
/usr/share/katello/app/models/indexed_model.rb:73:in `to_indexed_json'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/index.rb:296:in `convert_document_to_json'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/index.rb:54:in `store'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/model/search.rb:134:in `update_index'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:414:in `_run_update_elasticsearch_index_callbacks'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/model/search.rb:130:in `send'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/model/search.rb:130:in `update_index'
/usr/lib/ruby/gems/1.8/gems/tire-0.3.12/lib/tire/model/callbacks.rb:21:in `_callback_after_525'
/usr/lib/ruby/gems/1.8/gems/activesupport-3.0.10/lib/active_support/callbacks.rb:443:in `_run_save_callbacks'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/callbacks.rb:273:in `create_or_update'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/persistence.rb:60:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/validations.rb:49:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/attribute_methods/dirty.rb:30:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:245:in `save!'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:292:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:207:in `transaction'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:290:in `with_transaction_returning_status'
/usr/lib/ruby/gems/1.8/gems/activerecord-3.0.10/lib/active_record/transactions.rb:245:in `save!'
/usr/share/katello/app/models/lazy_accessor.rb:109:in `save!'
/usr/share/katello/app/models/glue/candlepin/consumer.rb:341:in `create_hypervisor'
/usr/share/katello/app/models/glue/candlepin/consumer.rb:348:in `register_hypervisors'
/usr/share/katello/app/models/glue/candlepin/consumer.rb:347:in `map'
/usr/share/katello/app/models/glue/candlepin/consumer.rb:347:in `register_hypervisors'

Comment 7 Ivan Necas 2012-01-23 14:59:08 UTC
For the issue with Katello not showing ESX in UI, but showing in cli I've filed another bug: https://bugzilla.redhat.com/show_bug.cgi?id=784009

Comment 8 Hui Wang 2012-02-06 10:48:52 UTC
I verified the issue.The result is PASS.
The ESX host can be saw on SAM WEB UI of "Systems" tab.

Version of verification:
katello-configure-0.1.55-2.el6.noarch
katello-httpd-ssl-key-pair-1.0-1.noarch
katello-headpin-0.1.130-2.el6.noarch
katello-trusted-ssl-cert-1.0-1.noarch
katello-certs-tools-1.0.2-2.el6.noarch
katello-cli-headpin-0.1.15-2.el6.noarch
katello-glue-candlepin-0.1.211-2.el6.noarch
katello-headpin-all-0.1.130-2.el6.noarch
katello-cli-common-0.1.40-2.el6.noarch
katello-common-0.1.211-2.el6.noarch
katello-qpid-broker-key-pair-1.0-1.noarch
thumbslug-0.0.21-1.el6.noarch
gthumb-2.10.11-8.el6.x86_64
candlepin-tomcat6-0.5.15-1.el6.noarch
katello-glue-candlepin-0.1.211-2.el6.noarch
candlepin-0.5.15-1.el6.noarch

Step
1. prepared one rhel5.8-snapshot4.0 host, and register to SAM:
#subscription-namager register --org=ACME_Corporation --environment=env1
--username=$username --password=$password

2.Deployed the env of ESX as following:
Set the vcenter's username/password 
Vcenter username : Administrator
Vcenter password :123qweP
Vcenter server IP : 10.66.5.106
Vsphere client Ip : 10.66.6.128
ESX IP: 10.66.6.66
ESX username=$username
ESX password=$password
Installed some Guests on ESX

3.Set the /etc/sysconfig/virt-who on rhel5.8-snapshot5.0 host (or on one of the
guests that is installed on ESX).

#vim /etc/sysconfig/virt-who
VIRTWHO_BACKGROUND=1
VIRTWHO_DEBUG=1
VIRTWHO_ESX=1
VIRTWHO_ESX_OWNER=ACME_Corporation
VIRTWHO_ESX_ENV=env1
VIRTWHO_ESX_SERVER=10.66.5.106
VIRTWHO_ESX_USERNAME=Administrator
VIRTWHO_ESX_PASSWORD=123qweP

4.Restart virt-who service
#service virt-who restart
....
Sending updates in hosts-to-guests mapping: {None: [], 44454c4c-4400-104d-8036-b2c04f583258: [564de060-fa51-849d-d4bd-18bc8d840c98, 42175cbd-64c2-da7f-93d5-3b6236ac9f1c, 564d0ffe-a533-b2d5-5084-13490b17cc6f, 42372c55-ea2d-52dc-9ab1-960940e04acb, 423773ac-894d-8444-9520-2c55876f1b9e]}
Updated host: 44454c4c-4400-104d-8036-b2c04f583258 with guests: [564de060-fa51-849d-d4bd-18bc8d840c98, 42175cbd-64c2-da7f-93d5-3b6236ac9f1c, 564d0ffe-a533-b2d5-5084-13490b17cc6f, 564d0cd9-5b06-70d9-9b9a-e00c9f7207cb,   423773ac-894d-8444-9520-2c55876f1b9e]
Updated host: null with guests: []

5.Log in SAM WebUI and check for esx host under "Systems" tab

Comment 9 Keqin Hong 2012-02-08 04:49:16 UTC
Closed as per comment 8.