Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconnect host on provider add #189

Merged
merged 1 commit into from
Jan 10, 2018
Merged

Conversation

pkliczewski
Copy link
Contributor

We need to make sure that when we remove a provider and add it again we
will keep using the same host entities. Without this change add and remove
provider cause to duplicate hosts.

Fixes https://bugzilla.redhat.com/1528859

@miq-bot
Copy link
Member

miq-bot commented Jan 5, 2018

@pkliczewski 'Ladas agrare' is an invalid assignee, ignoring...

@pkliczewski
Copy link
Contributor Author

@miq-bot assign @Ladas

@pkliczewski
Copy link
Contributor Author

@agrare please review

@pkliczewski
Copy link
Contributor Author

@miq-bot add_label gaprindashvili/yes

@@ -76,6 +76,39 @@ def root_folders(extra_attributes = {})
attributes.merge!(extra_attributes)
end

def hosts(extra_attributes = {})
reconnect_block = lambda do |inventory_collection, inventory_objects_index, attributes_index|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can use the same code for Vms, so we are compatible with old refresh, @agrare what else do we reconnect?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea, just hosts and vms currently.

Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets apply this also to Vms and add specs please :-)

@agrare
Copy link
Member

agrare commented Jan 5, 2018

@Ladas @pkliczewski this probably belongs in the main ManagerRefresh::InventoryCollectionDefault::InfraManager since it isn't specific to ovirt

@pkliczewski
Copy link
Contributor Author

@agrare will move it to the main repo.

@Ladas
Copy link
Contributor

Ladas commented Jan 5, 2018

@agrare right, so @pkliczewski is adding it here because e.g. VmWare reconnect is different. In here we will reconnect using only ems_ref.

@agrare
Copy link
Member

agrare commented Jan 5, 2018

@Ladas you mean for hosts? That is different behavior between normal and graph refresh then.

@Ladas
Copy link
Contributor

Ladas commented Jan 5, 2018

@agrare right @pkliczewski says they need just reconnecting by :ems_ref, because they don't have the scenario of loosing the whole RHEV DB, that would lead to new ems_refs , like VmWare

@agrare
Copy link
Member

agrare commented Jan 5, 2018

@Ladas that's not the only reason we lookup by hostname, if you drop a host from a provider and connect it to another this would also pick that up.

@pkliczewski
Copy link
Contributor Author

pkliczewski commented Jan 5, 2018

This PR requires ManageIQ/manageiq#16750

EmsRefresh.refresh(@ems)
@ems.reload

vm = VmOrTemplate.find_by(:uid_ems => "3a9401a0-bf3d-4496-8acf-edd3e903511f")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably also assert that

expect(VmOrTemplate.where(:uid_ems => "3a9401a0-bf3d-4496-8acf-edd3e903511f").count).to eq 1

To make sure the Vm is not duplicated ,same for the Host

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, @Ladas are you ok with the specs now?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, awesome

We need to make sure that when we remove a provider and add it again we
will keep using the same host entities. Without this change add and remove
provider cause to duplicate hosts.

Fixes https://bugzilla.redhat.com/1528859
@miq-bot
Copy link
Member

miq-bot commented Jan 9, 2018

Checked commit pkliczewski@90fcaed with ruby 2.3.3, rubocop 0.47.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

Copy link
Contributor

@Ladas Ladas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great now 👍

@pkliczewski
Copy link
Contributor Author

@masayag @oourfali please review

@masayag masayag merged commit 057e7d0 into ManageIQ:master Jan 10, 2018
simaishi pushed a commit that referenced this pull request Jan 10, 2018
@simaishi
Copy link
Contributor

Gaprindashvili backport details:

$ git log -1
commit bc5bd40f2d640fa8a62154f05bd8035c88c2c7e1
Author: Moti Asayag <masayag@redhat.com>
Date:   Wed Jan 10 10:32:48 2018 +0200

    Merge pull request #189 from pkliczewski/reconnect
    
    Reconnect host on provider add
    (cherry picked from commit 057e7d051f62256e488dea83ab004714880755aa)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1532332

@agrare agrare added this to the Sprint 77 Ending Jan 15, 2018 milestone Jan 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants