mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-08-30 17:13:08 +08:00
Merge pull request #11376 from ioito/hotfix/qx-qcloud-bandwidth-pkg
fix(region): qcloud bandwidth pkg
This commit is contained in:
@@ -593,13 +593,21 @@ func (self *SRegion) CreateInstance(name string, imageId string, instanceType st
|
||||
if publicIpChargeType == cloudprovider.ElasticipChargeTypeByBandwidth {
|
||||
internetChargeType = "BANDWIDTH_POSTPAID_BY_HOUR"
|
||||
}
|
||||
_, totalCount, err := self.GetBandwidthPackages([]string{}, 0, 50)
|
||||
pkgs, _, err := self.GetBandwidthPackages([]string{}, 0, 50)
|
||||
if err != nil {
|
||||
return "", errors.Wrapf(err, "GetBandwidthPackages")
|
||||
}
|
||||
if totalCount > 0 {
|
||||
if len(pkgs) > 0 {
|
||||
bandwidth = 65535 // unlimited bandwidth
|
||||
internetChargeType = "BANDWIDTH_PACKAGE"
|
||||
pkgId := pkgs[0].BandwidthPackageId
|
||||
for _, pkg := range pkgs {
|
||||
if len(pkg.ResourceSet) < 100 {
|
||||
pkgId = pkg.BandwidthPackageId
|
||||
break
|
||||
}
|
||||
}
|
||||
params["InternetAccessible.BandwidthPackageId"] = pkgId
|
||||
}
|
||||
|
||||
params["InternetAccessible.InternetChargeType"] = internetChargeType
|
||||
|
||||
Reference in New Issue
Block a user