Bug 1349310

Summary: Since update cannot obtain tenant inventory data from OpenStack ( NON RH OPENSTACK VERSION! )
Product: Red Hat CloudForms Management Engine Reporter: Johnny Westerlund <jwesterl>
Component: ProvidersAssignee: Ladislav Smola <lsmola>
Status: CLOSED CURRENTRELEASE QA Contact: Ola Pavlenko <opavlenk>
Severity: high Docs Contact:
Priority: high    
Version: 5.5.0CC: cpelland, gblomqui, jfrey, jhajyahy, jhardy, lsmola, obarenbo, simaishi
Target Milestone: GAKeywords: TestOnly, ZStream
Target Release: 5.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.7.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1349482 1349483 (view as bug list) Environment:
Last Closed: 2017-01-11 20:09:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: Openstack Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1349482, 1349483    

Description Johnny Westerlund 2016-06-23 08:15:35 UTC
Description of problem:
Due to known bug in 5.5.3.something our retirement command in Heat template was not working. So we updated to 5.5.4.2.20160517154712_629f93b, but since than we totally lost control over OpenStack, "Refresh relationships" is not working, machines are not able to be managed

Version-Release number of selected component (if applicable):
5.5.4.2.20160517154712_629f93b

THIS IS A NON RH PRODUCT!
OpenStack is Kilo release by TCPCloud (now Openstack Salt)


How reproducible:
We did full reinstallation, PoC instance in version 5.5.2.4.20160127105142_395c086 is still behaving well against the same OpenStack.


Steps to Reproduce:
1.
2.
3.

Actual results:
[----] E, [2016-06-22T10:57:59.880107 #29309:4cb990] ERROR -- : MIQ(ManageIQ::Providers::Openstack::CloudManager::Refresher#refresh) EMS: [TietoOS-EC], id: [2000000000001] Refresh failed
[----] E, [2016-06-22T10:57:59.880272 #29309:4cb990] ERROR -- : [NoMethodError]: undefined method `[]' for nil:NilClass  Method:[rescue in block in refresh]
[----] E, [2016-06-22T10:57:59.880423 #29309:4cb990] ERROR -- : /var/www/miq/vmdb/app/models/ems_refresh/save_inventory.rb:62:in `block (2 levels) in save_vms_inventory'


Expected results:
A working refresh of the provider

Additional info:

Comment 2 Johnny Westerlund 2016-06-23 08:17:33 UTC
Hi, did small investigation:

-  added .to_yaml for problematic object to _log.debug message: ( _log.debug "#{log_header} LOOOOOOOO: #{key_backup.to_yaml}” )
- differ object, which not causing issue and one that did and here is differences:

correct one contains non-empty cloud_tenants structure:

:cloud_tenants:
- :type: ManageIQ::Providers::Openstack::CloudManager::CloudTenant
  :name: demo-cfme
  :description: Development of OpenStack CloudForms integration. Resp. Lubomír Moric
  :enabled: true
  :ems_ref: 4dc9995bdb804c4184372e4043de92d3
  :id: 2000000000001
  :_object: !ruby/object:ManageIQ::Providers::Openstack::CloudManager::CloudTenant
    raw_attributes:
      ems_id: '2000000000001'
      ems_ref: 4dc9995bdb804c4184372e4043de92d3
      id: '2000000000001'
      name: demo-cfme
      description: Development of OpenStack CloudForms integration. Resp. Lubomír
        Moric
      enabled: true
      created_at: '2016-06-22 08:55:51.832354'
      updated_at: '2016-06-22 08:55:51.832354'
      type: ManageIQ::Providers::Openstack::CloudManager::CloudTenant
    attributes: !ruby/object:ActiveRecord::AttributeSet
      attributes: !ruby/object:ActiveRecord::LazyAttributeHash
        types: *8
        values:
          id: '2000000000001'
          name: demo-cfme
          description: Development of OpenStack CloudForms integration. Resp. Lubomír
            Moric
          enabled: t
          ems_ref: 4dc9995bdb804c4184372e4043de92d3
          ems_id: '2000000000001'
          created_at: '2016-06-22 08:55:51.832354'
          updated_at: '2016-06-22 08:55:51.832354'
          type: ManageIQ::Providers::Openstack::CloudManager::CloudTenant
        additional_types: *9
        materialized: true
….
….

object, on which we fails:

:cloud_tenants:
- *8
-

cloud_tenants is empty structure. 


Attached part of log with one valid and non valid object.

Comment 5 Ladislav Smola 2016-06-23 09:25:58 UTC
Fix is here https://github.com/ManageIQ/manageiq/pull/9378

I believe this occurs when Image have a tenant_id, that ManageIQ doesn't have rights for, therefore it's not able to connect it to tenant in ManageIQ. Which produces nils in array of the tenants.

So, this is actual bug, not related to OpenStack version or distribution.

Comment 8 CFME Bot 2016-06-23 14:11:29 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/53eaebf4b8a7a9d65ade83c59e7f1f78f6273eb4

commit 53eaebf4b8a7a9d65ade83c59e7f1f78f6273eb4
Author:     Ladislav Smola <lsmola>
AuthorDate: Thu Jun 23 11:17:42 2016 +0200
Commit:     Ladislav Smola <lsmola>
CommitDate: Thu Jun 23 11:19:34 2016 +0200

    Handle gracefully a missing tenant relationship
    
    Handle gracefully a missing tenant relationship, missing
    relationship can be caused by seeing tenant id on Image, while
    not having rights to read the actual tenant.
    
    Fixes BZ:
    https://bugzilla.redhat.com/show_bug.cgi?id=1349310

 app/models/ems_refresh/save_inventory.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comment 10 Ronnie Rasouli 2016-11-17 08:58:01 UTC
Verified on 5.7.0.11 refresh works