Can we also add some log in case metadata_gw_ip is None?  In that log we can indicate the possible reason (race condition)