Skip to content

Commit

Permalink
filter openstack networks
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Demichev committed Mar 12, 2018
1 parent 7856a59 commit 0b4d894
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/models/manageiq/providers/cloud_manager/provision_workflow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def allowed_cloud_subnets(_options = {})
def allowed_cloud_networks(_options = {})
return {} unless (src = provider_or_tenant_object)
targets = get_targets_for_source(src, :cloud_filter, CloudNetwork, 'all_cloud_networks')
targets = filter_openstack_networks(targets) if openstack?(targets)
allowed_ci(:cloud_network, [:availability_zone], targets.map(&:id))
end

Expand Down Expand Up @@ -141,4 +142,16 @@ def provider_or_tenant_object
obj = src[:cloud_tenant] || src[:ems]
load_ar_obj(obj)
end

def openstack?(networks)
networks = networks.select do |cloud_network|
cloud_network.class.ancestors.include?("ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork")
end.any?
end

def filter_openstack_networks(networks)
networks.select do |cloud_network|
cloud_network.eligible_for_vm_provisioning? == true
end
end
end

0 comments on commit 0b4d894

Please sign in to comment.