ravening commented on issue #5365:
URL: https://github.com/apache/cloudstack/issues/5365#issuecomment-906185574


   > > @weizhouapache this is what I found in the log
   > 
   > > 
   > 
   > > ```
   > 
   > > 2021-08-25 13:53:30,876 INFO     Address found in DataBag ==> 
{u'public_ip': u'10.10.50.254', u'one_to_one_nat': False, u'nic_dev_id': u'6', 
u'network': u'10.10.50.0/24', u'netmask': u'255.255.255.0', u'source_nat': 
False, u'broadcast': u
   > 
   > > '10.10.50.255', u'add': True, u'nw_type': u'guest', u'device': u'eth6', 
u'cidr': u'10.10.50.254/24', u'gateway': u'10.10.50.254', u'size': u'24'}
   > 
   > > ```
   > 
   > > 
   > 
   > > so whichever ip address it finds **first** in the databag then that ip 
will be used as gateway for all tiers
   > 
   > > 
   > 
   > > In this case, the ip 10.10.50.254 was found first in the databag and 
hence that is used as gateway for all tiers according to below code.
   > 
   > > 
   > 
   > > ```
   > 
   > > def getGuestIp(self):
   > 
   > >         interfaces = []
   > 
   > >         ipAddr = None
   > 
   > > 
   > 
   > >         for interface in self.config.address().get_interfaces():
   > 
   > >             if interface.is_guest():
   > 
   > >                 interfaces.append(interface)
   > 
   > >             if len(interfaces) > 0:
   > 
   > >                 ipAddr = sorted(interfaces)[-1] <<<<<<<<<<<< as soon as 
first guest ip is found, it is returned
   > 
   > >             if ipAddr:
   > 
   > >                 return ipAddr.get_ip()
   > 
   > > 
   > 
   > >         return None
   > 
   > > ```
   > 
   > 
   > 
   > @ravening ok. use 'getGuestIpByIp' instead of it might fix the issue.
   
   @weizhouapache yes I used that and that fixed the issue.. I will create a pr


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to