mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
增加:1.
包年包月主机加入资源池后,如果auto_delete=true,则自动删除该主机 2.
包年包月资源池的宿主机支持续费操作Perform(host.id,
"renew-prepaid-recycle", {"duration": "1m"})
This commit is contained in:
@@ -497,4 +497,19 @@ func init() {
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
|
||||
type PrepaidRecycleHostRenewOptions struct {
|
||||
ID string `help:"ID or name of server to renew"`
|
||||
DURATION string `help:"Duration of renew, ADMIN only command"`
|
||||
}
|
||||
R(&PrepaidRecycleHostRenewOptions{}, "host-renew-prepaid-recycle", "Renew a prepaid recycle host", func(s *mcclient.ClientSession, args *PrepaidRecycleHostRenewOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.DURATION), "duration")
|
||||
result, err := modules.Hosts.PerformAction(s, args.ID, "renew-prepaid-recycle", params)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
printObject(result)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -634,10 +634,14 @@ func init() {
|
||||
})
|
||||
|
||||
type ServerPrepaidRecycleOptions struct {
|
||||
ID string `help:"ID or name of server to recycle"`
|
||||
ID string `help:"ID or name of server to recycle"`
|
||||
AutoDelete bool `help:"after joining the pool, remove the server automatically"`
|
||||
}
|
||||
R(&ServerPrepaidRecycleOptions{}, "server-enable-recycle", "Put a prepaid server into recycle pool, so that it can be shared", func(s *mcclient.ClientSession, args *ServerPrepaidRecycleOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
if args.AutoDelete {
|
||||
params.Add(jsonutils.JSONTrue, "auto_delete")
|
||||
}
|
||||
result, err := modules.Servers.PerformAction(s, args.ID, "prepaid-recycle", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user