Skip to content

Commit

Permalink
add eligible for vm provisioning method
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Demichev committed Mar 16, 2018
1 parent cfc0678 commit 2792017
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ def validate_cloud_network(field, values, dlg, fld, value)
validate_placement(field, values, dlg, fld, value)
end

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_cloud_networks(targets)
allowed_ci(:cloud_network, [:availability_zone], targets.map(&:id))
end

private

def dialog_name_from_automate(message = 'get_dialog_name')
Expand All @@ -94,4 +101,10 @@ def dialog_name_from_automate(message = 'get_dialog_name')
def self.provider_model
ManageIQ::Providers::Openstack::CloudManager
end

def filter_cloud_networks(networks)
networks.select do |cloud_network|
cloud_network.cloud_subnets.any? == true
end
end
end

0 comments on commit 2792017

Please sign in to comment.