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

Save host for a Vm after migration #13511

Merged
merged 1 commit into from
Jan 17, 2017

Conversation

borod108
Copy link

@borod108 borod108 commented Jan 16, 2017

Fix saving the host of a Vm after it was migrated when doing
targeted refresh of the Vm.

https://bugzilla.redhat.com/show_bug.cgi?id=1368925

@borod108
Copy link
Author

@masayag please review

@borod108
Copy link
Author

@miq-bot add-label euwe/yes

@@ -18,6 +20,11 @@ def self.ems_inv_to_hashes(inv)
# Clean up the temporary cluster-datacenter references
result[:clusters].each { |c| c.delete(:datacenter_id) }

added_hosts_from_vms.each do |h|
result[:hosts] = result[:hosts] << h
Copy link
Contributor

Choose a reason for hiding this comment

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

no need to assign the updated collection to itself.

Copy link
Author

Choose a reason for hiding this comment

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

right! done.

@borod108
Copy link
Author

@miq-bot assign @durandom

@miq-bot miq-bot assigned durandom and unassigned oourfali Jan 17, 2017
Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

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

Besides the spec question it looks good to me.

Although I can map this to the attached BZ.
The BZ is talking about Hosts being deleted still showing up.
The code reads like you add hosts that would have been missed otherwise.

Maybe you can update the PR description to explain a bit more what this should do?

@@ -66,6 +66,32 @@
assert_storage(storage, vm)
end

context 'vm migration' do
before(:each) do
Copy link
Member

Choose a reason for hiding this comment

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

a similar before block is at the beginning of this spec. Do you really need both?
How about moving the reset of this file into its own context with individual before blocks.
Or even better get rid of them, as they tend to be overseen in larger files

Copy link
Author

Choose a reason for hiding this comment

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

I had to make a new vcr recording, I do not know how to get rid of this block. Do I understand correctly and you want me to move this context into its own spec file? just seemed to me this is the right logical place for it...

Copy link
Author

Choose a reason for hiding this comment

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

Sure I can move the ems details into "let" and update those in the context, would that be better?

Copy link
Member

Choose a reason for hiding this comment

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

move this context into its own spec file

No, I meant wrapping the other tests in this file in their own context with their own before block and leave this test as is.
Now this before block gets executed and the one at the beginning of the file. And I think this is not what you want.

Copy link
Author

Choose a reason for hiding this comment

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

Right! Done.

Copy link
Member

Choose a reason for hiding this comment

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

No, I meant wrapping the other tests in this file in their own context with their own before block and leave this test as is.
Now this before block gets executed and the one at the beginning of the file. And I think this is not what you want.

Thats still one context within another context, right? So still both before blocks get executed...

Copy link
Author

Choose a reason for hiding this comment

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

As far as I can see, there are now two contexts each with its own before(:each) block like you requested, am I missing something?

Copy link
Member

Choose a reason for hiding this comment

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

right, I was wrong, sorry

@borod108 borod108 force-pushed the bugs/1368925migrate_vm branch 2 times, most recently from 9ed9922 to ad2f2d1 Compare January 17, 2017 12:03
Fix saving the host of a Vm after it was migrated when doing
targeted refresh of the Vm.

Before if the hosts inventory was not fetched sperately by the
refresh, the host of a VM was not updated properly even though
its uid was returned as part of the target Vm inventory.

Now we take the information from the Vm inventory and use it
to update the Vms host properly.

https://bugzilla.redhat.com/show_bug.cgi?id=1368925
@borod108 borod108 force-pushed the bugs/1368925migrate_vm branch from ad2f2d1 to e346b46 Compare January 17, 2017 12:04
@borod108
Copy link
Author

Indeed, I changed both the PR description and the bug title.

@miq-bot
Copy link
Member

miq-bot commented Jan 17, 2017

Checked commit borod108@e346b46 with ruby 2.2.6, rubocop 0.46.0, and haml-lint 0.19.0
2 files checked, 0 offenses detected
Everything looks good. 🍰

Copy link
Member

@durandom durandom left a comment

Choose a reason for hiding this comment

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

LGTM

@miq-bot assign @agrare
@agrare can you have a second look and merge this?

@agrare
Copy link
Member

agrare commented Jan 17, 2017

That's a pretty cool solution @borod108 :) let me try to think if there is anything wrong with it 😉

@agrare
Copy link
Member

agrare commented Jan 17, 2017

Not quite as clean as providing the host in inventory, but lets you pass just the ems_ref and uid_ems without having to rework the host_inv_to_hashes so 👍 from me

@agrare agrare merged commit ce06a78 into ManageIQ:master Jan 17, 2017
@agrare agrare added this to the Sprint 53 Ending Jan 30, 2017 milestone Jan 17, 2017
@simaishi
Copy link
Contributor

@borod108 Can't do a clean cherry-pick due to refactoring. Please make Euwe-specific PR (referencing this one) or suggest other PRs to backport.

@pkliczewski
Copy link
Contributor

@simaishi here is the cherry-pick you requested #13618

@simaishi
Copy link
Contributor

Backported to Euwe via #13618

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.

10 participants