Bug 1283195 - Host entries are no longer adopted after deletion and re-add
Summary: Host entries are no longer adopted after deletion and re-add
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat CloudForms Management Engine
Classification: Red Hat
Component: Providers
Version: 5.5.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: GA
: 5.5.0
Assignee: Greg Blomquist
QA Contact: Pete Savage
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-11-18 12:35 UTC by Pete Savage
Modified: 2015-12-08 13:48 UTC (History)
6 users (show)

Fixed In Version: 5.5.0.12
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-12-08 13:48:34 UTC
Category: ---
Cloudforms Team: ---
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2015:2551 0 normal SHIPPED_LIVE Moderate: CFME 5.5.0 bug fixes and enhancement update 2015-12-08 17:58:09 UTC

Description Pete Savage 2015-11-18 12:35:32 UTC
Description of problem: Host entries are no longer adopted after deletion and re-add


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


How reproducible: 100%


Steps to Reproduce:
1. Add a provider (rhevm tested) with at least one host
2. Wait for inventory to complete
3. Delete the provider
4. Re add the provider

Actual results: Hosts are duplicated with a suffix for example there will be two host entries

host.example.com
host.example.com - 2

All vms will now be associated with the second host


Expected results: VMs should associate with the first host and the second host should not be created


Additional info:

Comment 4 CFME Bot 2015-11-23 20:55:25 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/3cd6fcd41335738c4d6982da572804f4caeff35b

commit 3cd6fcd41335738c4d6982da572804f4caeff35b
Author:     Greg Blomquist <gblomqui>
AuthorDate: Thu Nov 19 16:12:49 2015 -0500
Commit:     Greg Blomquist <gblomqui>
CommitDate: Mon Nov 23 12:10:39 2015 -0500

    Re-adding provider will adopt old hosts
    
    When an Infrastructure Provider is deleted, the hosts associated with that
    Provider are left behind with a nil ems_id.  If the same Infrastructure Provider
    is re-added, it is supposed to pick up the old orphaned hosts.
    
    f4aa372a570c934f99a5d789aaffafb8ac84c6c9 introduced a bug where re-adding a
    previously deleted Provider would fail to pick up orphaned hosts.  It resulted
    in the following situation:
    
    1. Add Provider for the first time
    
       Hosts
       1: name:"hostname.domain.com", ems_id:1
    
    2. Delete the provider
    
       Hosts
       1: name:"hostname.domain.com", :ems_id:nil
    
    3. Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:nil
       2: name:"hostname.domain.com - 1", ems_id:2
    
    This patch changes the third step to:
    
    3. Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:2
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1283195

 app/models/ems_refresh/save_inventory_infra.rb |  5 +--
 spec/models/host_spec.rb                       | 43 +++++++++++++++++---------
 2 files changed, 32 insertions(+), 16 deletions(-)

Comment 6 CFME Bot 2015-11-23 22:07:28 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=474948bcf726a67aae9e3dab0c9b09c6820e5486

commit 474948bcf726a67aae9e3dab0c9b09c6820e5486
Author:     Greg Blomquist <gblomqui>
AuthorDate: Thu Nov 19 16:12:49 2015 -0500
Commit:     Greg Blomquist <gblomqui>
CommitDate: Mon Nov 23 15:56:57 2015 -0500

    Re-adding provider will adopt old hosts
    
    When an Infrastructure Provider is deleted, the hosts associated with that
    Provider are left behind with a nil ems_id.  If the same Infrastructure Provider
    is re-added, it is supposed to pick up the old orphaned hosts.
    
    f4aa372a570c934f99a5d789aaffafb8ac84c6c9 introduced a bug where re-adding a
    previously deleted Provider would fail to pick up orphaned hosts.  It resulted
    in the following situation:
    
    1. Add Provider for the first time
    
       Hosts
       1: name:"hostname.domain.com", ems_id:1
    
    2. Delete the provider
    
       Hosts
       1: name:"hostname.domain.com", :ems_id:nil
    
    3. Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:nil
       2: name:"hostname.domain.com - 1", ems_id:2
    
    This patch changes the third step to:
    
    3. Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:2
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1283195

 app/models/ems_refresh/save_inventory_infra.rb |  5 +--
 spec/models/host_spec.rb                       | 43 +++++++++++++++++---------
 2 files changed, 32 insertions(+), 16 deletions(-)

Comment 7 CFME Bot 2015-11-23 22:07:34 UTC
New commit detected on cfme/5.5.z:
https://code.engineering.redhat.com/gerrit/gitweb?p=cfme.git;a=commitdiff;h=fc7f69732168e6733cf9ca08a0a10b9a099482ea

commit fc7f69732168e6733cf9ca08a0a10b9a099482ea
Merge: b058ef4 474948b
Author:     Oleg Barenboim <obarenbo>
AuthorDate: Mon Nov 23 16:41:41 2015 -0500
Commit:     Oleg Barenboim <obarenbo>
CommitDate: Mon Nov 23 16:41:41 2015 -0500

    Merge branch 'bz1283195-readd-host-5.5.z-backport' into '5.5.z'
    
    Re-adding provider will adopt old hosts
    
    Clean cherry-pick of upstream PR: https://github.com/ManageIQ/manageiq/pull/5531
    
    When an Infrastructure Provider is deleted, the hosts associated with that
    Provider are left behind with a nil ems_id.  If the same Infrastructure Provider
    is re-added, it is supposed to pick up the old orphaned hosts.
    
    f4aa372a570c934f99a5d789aaffafb8ac84c6c9 introduced a bug where re-adding a
    previously deleted Provider would fail to pick up orphaned hosts.  It resulted
    in the following situation:
    
    1. Add Provider for the first time
    
       Hosts
       1: name:"hostname.domain.com", ems_id:1
    
    2. Delete the provider
    
       Hosts
       1: name:"hostname.domain.com", :ems_id:nil
    
    3. Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:nil
       2: name:"hostname.domain.com - 1", ems_id:2
    
    This patch changes the third step to:
    
    `3.` Re-add the provider
    
       Hosts
       1: name:"hostname.domain.com", ems_id:2
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1283195
    
    See merge request !526

 app/models/ems_refresh/save_inventory_infra.rb |  5 +--
 spec/models/host_spec.rb                       | 43 +++++++++++++++++---------
 2 files changed, 32 insertions(+), 16 deletions(-)

Comment 8 Pete Savage 2015-11-25 10:13:52 UTC
Verified in 5.5.0.12

Comment 10 errata-xmlrpc 2015-12-08 13:48:34 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/RHSA-2015:2551


Note You need to log in before you can comment on or make changes to this bug.