mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #1319 in YUNIONIO/onecloud from ~LIZEXI/onecloud:bugfix/lzx-shcedtag-policy to release/2.8.0
* commit '3ba6d4186cb9b69fec7e7c978cc3483d66768bea': dynamic schedule support resource type
This commit is contained in:
@@ -114,14 +114,18 @@ func init() {
|
||||
})
|
||||
|
||||
type DynamicSchedtagEvaluateOptions struct {
|
||||
ID string `help:"ID or name of the sched policy"`
|
||||
HOST string `help:"ID or name of the host"`
|
||||
SERVER string `help:"ID or name of the server"`
|
||||
ID string `help:"ID or name of the sched policy"`
|
||||
ResourceType string `help:"Standalone resource type" choices:"host|storage" default:"host"`
|
||||
VirtaulResourceType string `help:"Virtual resource type" choices:"server|disk" default:"server"`
|
||||
STANDALONERES string `help:"ID or name of the standalone resource, e.g. host, storage"`
|
||||
VIRTUALRES string `help:"ID or name of the virtual resource, e.g. server, disk"`
|
||||
}
|
||||
R(&DynamicSchedtagEvaluateOptions{}, "dynamic-schedtag-evaluate", "Evaluate dynamic schedtag condition", func(s *mcclient.ClientSession, args *DynamicSchedtagEvaluateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.HOST), "host")
|
||||
params.Add(jsonutils.NewString(args.SERVER), "server")
|
||||
params.Add(jsonutils.NewString(args.ResourceType), "resource_type")
|
||||
params.Add(jsonutils.NewString(args.VirtaulResourceType), "virtual_resource_type")
|
||||
params.Add(jsonutils.NewString(args.STANDALONERES), "object_id")
|
||||
params.Add(jsonutils.NewString(args.VIRTUALRES), "virtual_object_id")
|
||||
result, err := modules.Dynamicschedtags.PerformAction(s, args.ID, "evaluate", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -124,12 +124,14 @@ func init() {
|
||||
})
|
||||
|
||||
type SchedpoliciesEvaluateOptions struct {
|
||||
ID string `help:"ID or name of the sched policy"`
|
||||
SERVER string `help:"ID or name of the server"`
|
||||
ID string `help:"ID or name of the sched policy"`
|
||||
OBJECT string `help:"ID or name of the object"`
|
||||
ResourceType string `help:"Resource type of the object" default:"server" choices:"server|disk" short-token:"t"`
|
||||
}
|
||||
R(&SchedpoliciesEvaluateOptions{}, "sched-policy-evaluate", "Evaluate sched policy", func(s *mcclient.ClientSession, args *SchedpoliciesEvaluateOptions) error {
|
||||
params := jsonutils.NewDict()
|
||||
params.Add(jsonutils.NewString(args.SERVER), "server")
|
||||
params.Add(jsonutils.NewString(args.OBJECT), "object")
|
||||
params.Add(jsonutils.NewString(args.ResourceType), "resource_type")
|
||||
result, err := modules.Schedpolicies.PerformAction(s, args.ID, "evaluate", params)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user