Fix getting IP by not returning a bad address

This commit is contained in:
Jake Spain 2023-08-21 21:20:36 -04:00
parent 7822b2182e
commit f02e0eb19a
No known key found for this signature in database
GPG key ID: BC1C4DA0A085E113
3 changed files with 34 additions and 2 deletions

View file

@ -603,9 +603,11 @@ module Vmpooler
ip_loop_delay = 1
ip_loop_count = 1
ip = nil
invalid_addresses = /(0|169)\.(0|254)\.\d+\.\d+/
while ip.nil?
sleep(ip_loop_delay)
ip = vm_object.guest_ip
ip = nil if !ip.nil? && ip.match?(invalid_addresses)
unless ip_maxloop == 0
break if ip_loop_count >= ip_maxloop