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

Return the available Floating IPs in Azure. #25

Merged

Conversation

bronaghs
Copy link

PR #12300 changed the Floating::IP available method to return floating IPs not associated with either a VM or a NIC. The FloatingIp::available method is used in cloud instance provisioning to display a list of available floating IPs that can be re-used. This change inadvertently affected the Azure provider integration where a FloatingIp is considered available when it is associated with a NIC as long as that NIC is not attached to another device, which can occur when a VM is deleted and its NIC and IP remain orphaned.

This PR is for an Azure specific way to determine available Floating Ips.

https://bugzilla.redhat.com/show_bug.cgi?id=1380728

@bronaghs
Copy link
Author

@djberg96, @blomquisg - please review.

@@ -1,2 +1,5 @@
class ManageIQ::Providers::Azure::NetworkManager::FloatingIp < ::FloatingIp
def self.available
joins(:network_port).where({ "network_ports.device_id" => nil }) + where(:network_port_id => nil)
end
Copy link
Author

Choose a reason for hiding this comment

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

@djberg96 @blomquisg - expensive? I'm not sure how to optimize this given the associations that are in place.

@bronaghs bronaghs force-pushed the floating_ip_available_method_change branch from 0e720a0 to a353be5 Compare January 16, 2017 23:51
@bronaghs bronaghs force-pushed the floating_ip_available_method_change branch from a353be5 to 659a8f8 Compare January 17, 2017 11:54
@miq-bot
Copy link
Member

miq-bot commented Jan 17, 2017

Checked commit bronaghs@659a8f8 with ruby 2.2.6, rubocop 0.46.0, and haml-lint 0.19.0
3 files checked, 0 offenses detected
Everything looks good. ⭐

@@ -1,2 +1,5 @@
class ManageIQ::Providers::Azure::NetworkManager::FloatingIp < ::FloatingIp
def self.available
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be :available??

Copy link
Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

@bronaghs ok, understood.

@djberg96
Copy link
Collaborator

👍

@djberg96 djberg96 merged commit 8479948 into ManageIQ:master Jan 17, 2017
@bronaghs bronaghs mentioned this pull request Jan 30, 2017
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.

3 participants