-
Notifications
You must be signed in to change notification settings - Fork 60
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
Return the available Floating IPs in Azure. #25
Conversation
@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 |
There was a problem hiding this comment.
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.
0e720a0
to
a353be5
Compare
a353be5
to
659a8f8
Compare
Checked commit bronaghs@659a8f8 with ruby 2.2.6, rubocop 0.46.0, and haml-lint 0.19.0 |
@@ -1,2 +1,5 @@ | |||
class ManageIQ::Providers::Azure::NetworkManager::FloatingIp < ::FloatingIp | |||
def self.available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be :available?
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djberg96 - I had wondered the same thing, but no:
https://github.com/ManageIQ/manageiq/blob/master/app/models/floating_ip.rb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bronaghs ok, understood.
👍 |
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