mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #1191 in YUNIONIO/onecloud from ~QIUJIAN/onecloud:hotfix/qj-host-renew-prepaid-recycle-sanity-check to release/2.6.0
* commit 'e62ceb5007e57d71e4f049640528b91a20ae86f6': show expired_at colume for host fix: validate host status before doing renew prepaid recycle
This commit is contained in:
@@ -688,6 +688,15 @@ func (self *SHost) AllowPerformRenewPrepaidRecycle(ctx context.Context, userCred
|
||||
}
|
||||
|
||||
func (self *SHost) PerformRenewPrepaidRecycle(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, data jsonutils.JSONObject) (jsonutils.JSONObject, error) {
|
||||
if !self.IsPrepaidRecycle() {
|
||||
return nil, httperrors.NewInputParameterError("Not a prepaid recycle host")
|
||||
}
|
||||
if len(self.RealExternalId) == 0 {
|
||||
return nil, httperrors.NewGeneralError(fmt.Errorf("host RealExternalId is empty"))
|
||||
}
|
||||
if len(self.ExternalId) == 0 {
|
||||
return nil, httperrors.NewGeneralError(fmt.Errorf("host ExternalId is empty"))
|
||||
}
|
||||
durationStr := jsonutils.GetAnyString(data, []string{"duration"})
|
||||
if len(durationStr) == 0 {
|
||||
return nil, httperrors.NewMissingParameterError("duration")
|
||||
|
||||
@@ -177,7 +177,9 @@ func init() {
|
||||
"mem_commit_rate", "cpu_commit_bound",
|
||||
"mem_commit_bound", "node_count", "sn", "storage_type",
|
||||
"host_type", "version", "schedtags",
|
||||
"storage_size"},
|
||||
"storage_size",
|
||||
"expired_at",
|
||||
},
|
||||
[]string{})}
|
||||
registerCompute(&Hosts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user