foreman sometimes picks the wrong bmc smart proxy
We have a setup with several smart proxies. Sometimes when loading a host page and clicking on the 'BMC' tab, we'll see
Failure: ERF12-1772 [ProxyAPI::ProxyException]: Unable to perform power BMC operation ([RestClient::BadRequest]: 400 Bad Request) for proxy <wrong smart proxy>
Somehow it's picking the wrong smart proxy, even though all the settings are correct. (subnet for the bmc interface is correct, ip address, mac is correct)
AND it seems to work 4/5 of the time, only picking the wrong one 1 out of 5.
#3 Updated by Brian Witt about 5 years ago
I forgot to mention, that in those lines in app/models/nic/bmc.rb:28-29
SmartProxy.with_features("BMC").joins(:subnets).where(['dhcp_id = ? or tftp_id = ?', subnet_id, subnet_id]).first if subnet_id
proxy ||= SmartProxy.with_features("BMC").first
seems to always fail (i.e. it always picks the 'first' one), even when foreman picks the right proxy (or at least I see the status appear on the bmc tab). So I'm not sure what's going on there.
#4 Updated by Brian Witt about 5 years ago
The 'first' one is not reachable by foreman normally, so when it fails I see a connection error to that first smart proxy. The other times when it works I presume it's actually talking to the right smart proxy, even though the 'proxy' var in the code is set to the 'first' (unreachable) one.