-
Notifications
You must be signed in to change notification settings - Fork 62
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
Host targeted refresh deleting and re-creating storage, switch, and lan records #336
Host targeted refresh deleting and re-creating storage, switch, and lan records #336
Conversation
Add some tests to catch a host targeted refresh causing storage, switch, and lan records to be deleted+recreated.
@@ -213,7 +213,7 @@ def infer_related_host_ems_refs_db! | |||
changed_hosts.each do |host| | |||
add_simple_target!(:ems_clusters, uuid_from_target(host.ems_cluster)) | |||
host.storages.each do |storage| | |||
add_simple_target!(:storagedomains, uuid_from_target(storage)) | |||
add_simple_target!(:storagedomains, storage.ems_ref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was comparing the wrong property:
references(:storagedomains)
["cd4cf9b7-e1d4-4ef6-a3ed-06adf72c8031"]
Storage.pluck(:ems_ref)
["/api/storagedomains/072fbaa1-08f3-4a40-9f34-a5ca22dd1d74", "/api/storagedomains/cd4cf9b7-e1d4-4ef6-a3ed-06adf72c8031"]
@borod108 the switches reference is empty in the specs, it looks like we get the switch targets and the switches in the parser two different ways. |
describe ManageIQ::Providers::Redhat::InfraManager::Refresh::Refresher do | ||
include OvirtRefresherSpecCommon | ||
|
||
describe ManageIQ::Providers::Redhat::InfraManager::Refresh::Refresher do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@borod108 why are these describe blocks duplicated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For no good reason I can think off.
Code removed by PR ManageIQ#316 caused the problem with disconnected networks indicated in https://bugzilla.redhat.com/show_bug.cgi?id=1669176
4b75844
to
1a0117d
Compare
Checked commits agrare/manageiq-providers-ovirt@7f9ada6~...1a0117d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
Moti, could you please review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good to me, better and cleaner. The specs are broken thought.
@agrare @borod108 @roliveri unfortunately my last commit, while fixing the issue tracked here, results in the same error message that https://bugzilla.redhat.com/show_bug.cgi?id=1658240 fixed. I'm not sure if that's worse that the issue fixed by this PR or not. |
@agrare @borod108 seems like we're missing the proper method of fetching the network_attachments in this context. We should do something similar to: https://github.com/ManageIQ/manageiq-providers-ovirt/blob/master/app/models/manageiq/providers/redhat/inventory/collector.rb#L141 |
Also updated refresh recording
Does anyone have an environment to quickly verify this change so we can merge? |
expect(host.switches.map { |switch| [switch.uid_ems, switch.name] }).to contain_exactly( | ||
a_collection_containing_exactly("00000000-0000-0000-0000-000000000009", "ovirtmgmt"), | ||
a_collection_containing_exactly("5c42817f-03fb-460e-a3ab-a8770553aeee", "vlan123t") | ||
) | ||
expect(host.networks.count).to eq(2) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wondering, if we removed this maybe we should also remove the second refresh - (line 63-64)
add_simple_target!(:storagedomains, storage.ems_ref) | ||
end | ||
host.switches.each do |switch| | ||
add_simple_target!(:networks, switch.uid_ems) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is why the specs are currently failing, this should be add_simple_target!(:switches, switch.uid_ems)
add_simple_target!(:networks, attachement.network.id) | ||
manager.with_provider_connection(VERSION_HASH) do |connection| | ||
connection.follow_link(host.network_attachments).each do |attachement| | ||
add_simple_target!(:networks, attachement.network.id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
@agrare the last commit you made still causes the V2V Infrastructure Mapping issue for missing Networks. It does make the manager_ref as hash failure error disappear though. |
@jerryk55 one step at a time :D |
Okay the issue was that we were still referencing networks when building the targeted arel: https://github.com/ManageIQ/manageiq-providers-ovirt/pull/336/files#diff-c9d64b2c3fed9ede6e26aefcbcb8b276R11 |
Testing against a live rhev manager seems to indicate that this is fixed the issue, I'm seeing the same switches and lans before and after host targeted refreshes so I think this just needs a vcr re-record for the specs to pass. |
FYI - still seeing the issue. not sure if the "one step at a time" comment is still in play... |
Hey @jerryk55 I tried to reproduce what I think the issue is on a live system and didn't see the problem anymore. What issue are you still seeing ? |
Hi @agrare. Creating an Infrastructure Mapping, then running the RHEV host refresh. The Infrastructure mapping shows the Networks missing. Datastore and Cluster are ok. Prior to your change the Datastore was also showing as missing. We had debugged this a while back and saw that the ids for the networks were changed causing the issue. |
Looks the same to me, @jerryk55 is this on your local env or do you have a link to an appliance where you see this? |
@agrare link sent in gitter. |
@agrare any chance can you squash the commits and force push? |
d26eced
to
d3d2661
Compare
@borod108 okay I squashed the multiple vcr commits, I think the rest are helpful. |
Thanks @masayag ! |
Host targeted refresh deleting and re-creating storage, switch, and lan records (cherry picked from commit 2509eda) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1674673
Hammer backport details:
|
https://bugzilla.redhat.com/show_bug.cgi?id=1669176