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 69d6ede
Show file tree
Hide file tree
Showing 2 changed files with 17 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.eligible_for_vm_provisioning? == true
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ def self.display_name(number = 1)
n_('Cloud Network (OpenStack)', 'Cloud Networks (OpenStack)', number)
end

def eligible_for_vm_provisioning?
cloud_subnets.any?
end

private

def connection_options(cloud_tenant = nil)
Expand Down

0 comments on commit 69d6ede

Please sign in to comment.