Skip to content

Commit

Permalink
Add Distributed and Host VirtualSwitch models
Browse files Browse the repository at this point in the history
Add models for distributed and host virtual switches and set them in the
refresh parser.
  • Loading branch information
agrare committed Mar 16, 2018
1 parent 7fb98b7 commit 8aa7ce5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/models/manageiq/providers/vmware/infra_manager.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module ManageIQ::Providers
class Vmware::InfraManager < InfraManager
require_nested :DistributedVirtualSwitch
require_nested :EventCatcher
require_nested :EventParser
require_nested :RefreshWorker
Expand All @@ -9,6 +10,7 @@ class Vmware::InfraManager < InfraManager
require_nested :Refresher
require_nested :Host
require_nested :HostEsx
require_nested :HostVirtualSwitch
require_nested :Inventory
require_nested :Provision
require_nested :ProvisionViaPxe
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ManageIQ::Providers::Vmware::InfraManager::DistributedVirtualSwitch < Switch
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
class ManageIQ::Providers::Vmware::InfraManager::HostVirtualSwitch < Switch
end
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ def self.host_inv_to_switch_hashes(inv, dvswitch_inv, dvswitch_uid_ems)
:uid_ems => uid,
:name => name,
:ports => data['numPorts'],
:type => self.parent::HostVirtualSwitch.name,

:allow_promiscuous => security_policy['allowPromiscuous'].nil? ? nil : security_policy['allowPromiscuous'].to_s.downcase == 'true',
:forged_transmits => security_policy['forgedTransmits'].nil? ? nil : security_policy['forgedTransmits'].to_s.downcase == 'true',
Expand Down Expand Up @@ -458,6 +459,7 @@ def self.host_inv_to_switch_hashes(inv, dvswitch_inv, dvswitch_uid_ems)
:uid_ems => uid,
:name => URI.decode(name),
:ports => config['numPorts'] || 0,
:type => self.parent::DistributedVirtualSwitch.name,

:allow_promiscuous => allow_promiscuous.nil? ? nil : allow_promiscuous.to_s.casecmp('true') == 0,
:forged_transmits => forged_transmits.nil? ? nil : forged_transmits.to_s.casecmp('true') == 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ def assert_specific_host
:uid_ems => 'dvs-119',
:name => 'DC1_DVS',
:ports => 26,
:type => 'ManageIQ::Providers::Vmware::InfraManager::DistributedVirtualSwitch',
:allow_promiscuous => nil,
:forged_transmits => nil,
:mac_changes => nil,
Expand Down Expand Up @@ -525,6 +526,7 @@ def assert_specific_host
:uid_ems => "vSwitch0",
:name => "vSwitch0",
:ports => 128,
:type => 'ManageIQ::Providers::Vmware::InfraManager::HostVirtualSwitch',
:allow_promiscuous => false,
:forged_transmits => true,
:mac_changes => true,
Expand Down

0 comments on commit 8aa7ce5

Please sign in to comment.