From 44f7c6e68845ee9a250e0b41b8d8ae721862be2d Mon Sep 17 00:00:00 2001 From: wanyaoqi <18528551+wanyaoqi@users.noreply.github.com> Date: Tue, 9 Jun 2026 23:02:04 +0800 Subject: [PATCH] fix(region): host model add api stats (#24956) --- cmd/climc/shell/compute/hosts.go | 1 + pkg/compute/models/hosts.go | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/cmd/climc/shell/compute/hosts.go b/cmd/climc/shell/compute/hosts.go index 64b3567bb5..44ce1aa037 100644 --- a/cmd/climc/shell/compute/hosts.go +++ b/cmd/climc/shell/compute/hosts.go @@ -77,6 +77,7 @@ func init() { stats, _ := data.GetArray("workers") printList(&printutils.ListResult{Data: stats}, nil) }, &options.BaseIdOptions{}) + cmd.Get("api-stats", &options.BaseIdOptions{}) cmd.Get("tap-config", &options.BaseIdOptions{}) cmd.GetWithCustomShow("nics", func(data jsonutils.JSONObject) { results := printutils.ListResult{} diff --git a/pkg/compute/models/hosts.go b/pkg/compute/models/hosts.go index 52a526a252..b64ab6ce4d 100644 --- a/pkg/compute/models/hosts.go +++ b/pkg/compute/models/hosts.go @@ -8197,6 +8197,10 @@ func (h *SHost) GetDetailsWorkerStats(ctx context.Context, userCred mcclient.Tok return h.Request(ctx, userCred, httputils.GET, "/worker_stats", nil, nil) } +func (h *SHost) GetDetailsApiStats(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject) (jsonutils.JSONObject, error) { + return h.Request(ctx, userCred, httputils.GET, "/stats", nil, nil) +} + func (hh *SHost) GetDetailsIsolatedDeviceNumaStats(ctx context.Context, userCred mcclient.TokenCredential, input *api.HostIsolatedDeviceNumaStatsInput) (jsonutils.JSONObject, error) { if !utils.IsInStringArray(input.DevType, api.VALID_PASSTHROUGH_TYPES) { return nil, httperrors.NewInputParameterError("dev_type %s is invalid", input.DevType)