Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix call to get_targets_for_source to be correct scope name #16824

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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, 'cloud_networks')
targets = get_targets_for_source(src, :cloud_filter, CloudNetwork, 'all_cloud_networks')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ladas This should resolve the issue of returning shared cloud_networks when only the provider or tenant are known. Can you provide some guidance (or recommend someone) for what to do when an availability_zone has been selected in the provisioning UI?

Do we have a way to determine what shared cloud_networks are available then? See the availability_zone_to_cloud_network method below which will be called from the allowed_ci method to limit the cloud_networks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I've missed this one.

So looking at miq_provision dialogs, for Google and OpenStack, we can select AvailabilityZone when provisioning, but we do not refresh subnet <- availability_zone relationships. That means we need to disable allowed_ci for them for now (and put into todo list to check if the relation should be there).

For Vcloud, I am not sure, since I don't see provision dialog for it, but we refresh AZ without the relation to subnet.

So answer to Do we have a way to determine what shared cloud_networks are available then? is no. We need to offer all networks, until we can refresh the subnet <- availability_zone relationships in these providers.

Azure and Amazon should work ok with allowed_ci filtering.

That being said, allowed_ci filter is new here, so I think we should do manual test, for each provider, just for sure. And probably add small spec to each provider, something like https://github.com/Ladas/manageiq-providers-openstack/blob/bd5b69a68cf29f41a582d377a544597423586068/spec/models/manageiq/providers/openstack/cloud_manager/provision_workflow_spec.rb#L298

allowed_ci(:cloud_network, [:availability_zone], targets.map(&:id))
end

Expand Down Expand Up @@ -95,7 +95,7 @@ def availability_zone_to_cloud_network(src)
hash[cn.id] = cn.name
end
else
load_ar_obj(src[:ems]).cloud_subnets.collect(&:cloud_network).each_with_object({}) do |cn, hash|
load_ar_obj(src[:ems]).all_cloud_networks.each_with_object({}) do |cn, hash|
hash[cn.id] = cn.name
end
end
Expand Down