mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-31 02:38:07 +08:00
Merge pull request #1282 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-turn-delete-prepaid-vm-to-postpaid-2.7.0 to release/2.7.0
* commit '29245c931c3a7d2bf2796b82d83115576a4787c2': fix: turn delete prepaid vm to postpaid, so as to allow deleting the vm
This commit is contained in:
@@ -1826,6 +1826,18 @@ func (self *SGuest) syncRemoveCloudVM(ctx context.Context, userCred mcclient.Tok
|
||||
lockman.LockObject(ctx, self)
|
||||
defer lockman.ReleaseObject(ctx, self)
|
||||
|
||||
if self.BillingType == BILLING_TYPE_PREPAID {
|
||||
diff, err := db.Update(self, func() error {
|
||||
self.BillingType = BILLING_TYPE_POSTPAID
|
||||
self.ExpiredAt = time.Time{}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
db.OpsLog.LogSyncUpdate(self, diff, userCred)
|
||||
}
|
||||
|
||||
return self.SetStatus(userCred, VM_UNKNOWN, "Sync lost")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user