mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): sync aliyun classic network ip addr
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user