fix(region): avoid public ip bandwidth is zero

This commit is contained in:
Qu Xuan
2020-11-24 18:09:34 +08:00
parent 3192b9a06f
commit e6b75b8537
3 changed files with 4 additions and 0 deletions
+1
View File
@@ -509,6 +509,7 @@ func (manager *SElasticipManager) newFromCloudEip(ctx context.Context, userCred
eip.ManagerId = provider.Id
eip.CloudregionId = region.Id
eip.ChargeType = extEip.GetInternetChargeType()
eip.Bandwidth = extEip.GetBandwidth()
if networkId := extEip.GetINetworkId(); len(networkId) > 0 {
network, err := db.FetchByExternalIdAndManagerId(NetworkManager, networkId, func(q *sqlchemy.SQuery) *sqlchemy.SQuery {
wire := WireManager.Query().SubQuery()
+2
View File
@@ -474,6 +474,8 @@ func (opts *ServerCreateOptionalOptions) OptionalParams() (*computeapi.ServerCre
EipBw: opts.EipBw,
EipBgpType: opts.EipBgpType,
EipChargeType: opts.EipChargeType,
PublicIpBw: opts.PublicIpBw,
PublicIpChargeType: opts.PublicIpChargeType,
Eip: opts.Eip,
EnableCloudInit: opts.EnableCloudInit,
OsType: opts.OsType,
+1
View File
@@ -881,6 +881,7 @@ func (self *SInstance) GetIEIP() (cloudprovider.ICloudEIP, error) {
eip.AddressName = address
eip.AddressType = EIP_TYPE_WANIP
eip.AddressStatus = EIP_STATUS_BIND
eip.Bandwidth = self.InternetAccessible.InternetMaxBandwidthOut
return &eip, nil
}
return nil, nil