Skip to content

Commit

Permalink
Merge pull request #19051 from ioito/hotfix/qx-rds-vcpu-count
Browse files Browse the repository at this point in the history
fix(region): avoid rds vcpu count is zero
  • Loading branch information
zexi authored Dec 19, 2023
2 parents 9c8c505 + 3450620 commit 1ad385f
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions pkg/compute/models/dbinstances.go
Original file line number Diff line number Diff line change
Expand Up @@ -1673,8 +1673,21 @@ func (self *SDBInstance) SyncWithCloudDBInstance(ctx context.Context, userCred m
self.Engine = ext.GetEngine()
self.EngineVersion = ext.GetEngineVersion()
self.InstanceType = ext.GetInstanceType()
self.VcpuCount = ext.GetVcpuCount()
self.VmemSizeMb = ext.GetVmemSizeMB()
cpu := ext.GetVcpuCount()
mem := ext.GetVmemSizeMB()
if (cpu == 0 || mem == 0) && len(self.InstanceType) > 0 {
skus, _ := self.GetAvailableDBInstanceSkus(true)
for _, sku := range skus {
cpu, mem = sku.VcpuCount, sku.VmemSizeMb
break
}
}
if cpu > 0 {
self.VcpuCount = cpu
}
if mem > 0 {
self.VmemSizeMb = mem
}
self.DiskSizeGB = ext.GetDiskSizeGB()
self.DiskSizeUsedMB = ext.GetDiskSizeUsedMB()
self.StorageType = ext.GetStorageType()
Expand Down

0 comments on commit 1ad385f

Please sign in to comment.