From 279201751fb075e621ecf0f7b684b5242c56ad86 Mon Sep 17 00:00:00 2001 From: Alexander Demichev Date: Tue, 27 Feb 2018 10:41:24 +0100 Subject: [PATCH] add eligible for vm provisioning method --- .../openstack/cloud_manager/provision_workflow.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/models/manageiq/providers/openstack/cloud_manager/provision_workflow.rb b/app/models/manageiq/providers/openstack/cloud_manager/provision_workflow.rb index be83a2b67..79d8fd211 100644 --- a/app/models/manageiq/providers/openstack/cloud_manager/provision_workflow.rb +++ b/app/models/manageiq/providers/openstack/cloud_manager/provision_workflow.rb @@ -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') @@ -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