mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
guestnetworks: IsExit()减少一次数据库查询
This commit is contained in:
@@ -546,6 +546,12 @@ func calculateNics(q *sqlchemy.SQuery) GuestnicsCount {
|
||||
}
|
||||
|
||||
func (self *SGuestnetwork) IsExit() bool {
|
||||
if self.IpAddr != "" {
|
||||
addr, err := netutils.NewIPV4Addr(self.IpAddr)
|
||||
if err == nil {
|
||||
return netutils.IsExitAddress(addr)
|
||||
}
|
||||
}
|
||||
net := self.GetNetwork()
|
||||
if net != nil {
|
||||
return net.IsExitNetwork()
|
||||
|
||||
Reference in New Issue
Block a user