Skip to content

Commit

Permalink
fix: 避免设置自动释放后磁盘的expired_at失效
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu Xuan committed May 18, 2020
1 parent bbeb6be commit 3fe417c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/compute/models/disks.go
Expand Up @@ -1441,9 +1441,15 @@ func (self *SDisk) syncWithCloudDisk(ctx context.Context, userCred mcclient.Toke
self.IsEmulated = extDisk.IsEmulated()

if provider.GetFactory().IsSupportPrepaidResources() && !recycle {
self.BillingType = extDisk.GetBillingType()
self.ExpiredAt = extDisk.GetExpiredAt()
self.AutoRenew = extDisk.IsAutoRenew()
if billintType := extDisk.GetBillingType(); len(billintType) > 0 {
self.BillingType = extDisk.GetBillingType()
if self.BillingType == billing_api.BILLING_TYPE_PREPAID {
self.AutoRenew = extDisk.IsAutoRenew()
}
}
if expiredAt := extDisk.GetExpiredAt(); !expiredAt.IsZero() {
self.ExpiredAt = extDisk.GetExpiredAt()
}
}

if createdAt := extDisk.GetCreatedAt(); !createdAt.IsZero() {
Expand Down

0 comments on commit 3fe417c

Please sign in to comment.