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

Filter openstack networks in provisioning #17055

Conversation

alexander-demicev
Copy link

This PR filters openstack cloud networks that do not have subnets. Network requires a subnet in order to be used for provisioning.

BZ

@aufi @lpichler Can you review it?

cloud_network.class == ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork::Public ||
cloud_network.class == ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork::Private
end
networks.any?
Copy link
Member

Choose a reason for hiding this comment

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

Few comments on this part of code:

Filter if the CloudNetwork is or is not OpenStack network can be done also by lookup for ancestors of the class (not pushing for change, it's just my preference, example: cloud_network.class.ancestors.include? "ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork")

A bit high level comment, but in this change we expect that if network is from Openstack , then it has a method eligible_for_vm_provisioning, which might not be clear in future. I'd suggest adding eligible_for_vm_provisioning method also to CloudNetwork.

Nit: We don't need networks local variable here, it should be enough ask for any? just after the block end.

Nit2: It would be great not use openstack keyword, but have a generic code (e.g. by adding eligible_for_vm_provisioning method to CloudNetwork model).

@alexander-demicev alexander-demicev changed the title [WIP] filter openstack networks in provisioning Filter openstack networks in provisioning Mar 12, 2018
@miq-bot miq-bot removed the wip label Mar 12, 2018
@miq-bot
Copy link
Member

miq-bot commented Mar 12, 2018

Checked commit alexander-demicev@55abeb3 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. ⭐

@aufi
Copy link
Member

aufi commented Mar 15, 2018

@Ladas Hi, if you have minute, could you check this PR? Thanks


def openstack?(networks)
networks.select do |cloud_network|
cloud_network.class.ancestors.include?("ManageIQ::Providers::Openstack::NetworkManager::CloudNetwork")
Copy link
Contributor

Choose a reason for hiding this comment

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

core code can't have any mentions of OpenStack, do this via support mixin or use specific allowed_cloud_networks in OpenStack plugin

@alexander-demicev
Copy link
Author

@Ladas thanks for advice, logic moved to openstack repo ManageIQ/manageiq-providers-openstack#238. Closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants