fix(region): sync aliyun classic network ip addr

This commit is contained in:
Qu Xuan
2021-08-26 17:16:59 +08:00
parent 28561dbea1
commit 4b90b74ffb
2 changed files with 18 additions and 2 deletions
+9
View File
@@ -295,6 +295,15 @@ func (self *SInstance) GetINics() ([]cloudprovider.ICloudNic, error) {
}
nics = append(nics, &nic)
}
for _, classicIp := range self.InnerIpAddress.IpAddress {
nic := SInstanceNic{
instance: self,
id: fmt.Sprintf("%s-%s", self.InstanceId, classicIp),
ipAddr: classicIp,
classic: true,
}
nics = append(nics, &nic)
}
return nics, nil
}
+9 -2
View File
@@ -22,6 +22,7 @@ import (
"github.com/aliyun/alibaba-cloud-sdk-go/services/ecs"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/util/netutils"
"yunion.io/x/onecloud/pkg/cloudprovider"
)
@@ -32,6 +33,8 @@ type SInstanceNic struct {
ipAddr string
macAddr string
classic bool
cloudprovider.DummyICloudNic
}
@@ -51,11 +54,15 @@ func (self *SInstanceNic) GetIP() string {
}
func (self *SInstanceNic) GetMAC() string {
return self.macAddr
if len(self.macAddr) > 0 {
return self.macAddr
}
ip, _ := netutils.NewIPV4Addr(self.GetIP())
return ip.ToMac("00:16:")
}
func (self *SInstanceNic) InClassicNetwork() bool {
return false
return self.classic == true
}
func (self *SInstanceNic) GetDriver() string {