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

Update Ovirt for the new switch modeling #239

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ def self.host_inv_to_hashes(inv, ems_inv, cluster_uids, _storage_uids)
:ems_cluster => cluster_uids[host_inv.attributes.fetch_path(:cluster, :id)],
:hardware => hardware,
:switches => switches,
:host_switches => switches,
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be great to be consistent with naming. We use host_virtual_switches everywhere except of here. What do you think about making it consistent?


}
new_result[:ipmi_address] = ipmi_address unless ipmi_address.blank?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def host_guest_devices(persister_hardware, host, nics, networks)

unless network.nil?
switch_uid = network.try(:id) || network.name
attributes[:switch] = persister.switches.lazy_find(switch_uid)
persister_host = persister.hosts.lazy_find(ManageIQ::Providers::Redhat::InfraManager.make_ems_ref(host.href))
attributes[:switch] = persister.host_virtual_switches.lazy_find(:host => persister_host, :uid_ems => switch_uid)
attributes[:network] = persister_nic
end

Expand All @@ -260,7 +261,8 @@ def switches(persister_host, dc, nics, networks)
uid = network.try(:id) || network.name
name = network.name

persister_switch = persister.switches.find_or_build(uid).assign_attributes(
persister_switch = persister.host_virtual_switches.find_or_build_by(:host => persister_host, :uid_ems => uid).assign_attributes(
:host => persister_host,
:uid_ems => uid,
:name => name,
:lans => [lans(network)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def initialize_inventory_collections
%i(ems_clusters hosts resource_pools vms miq_templates
storages vm_and_template_ems_custom_fields disks guest_devices hardwares
host_hardwares host_networks host_operating_systems host_storages
host_switches lans networks operating_systems snapshots switches)
host_switches lans networks operating_systems snapshots host_virtual_switches)
)

add_inventory_collection(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def assert_table_counts(_lan_number)
expect(Network.count).to eq(6)
expect(OperatingSystem.count).to eq(20)
expect(Snapshot.count).to eq(17)
# the old code expects 3 and new 2
expect(Switch.count).to eq(2)
expect(Switch.count).to eq(3)
expect(SystemService.count).to eq(0)

expect(Relationship.count).to eq(45)
Expand Down