diff --git a/pkg/cloudcommon/db/db_dispatcher.go b/pkg/cloudcommon/db/db_dispatcher.go index 411cd380c5d..eb45b767f2e 100644 --- a/pkg/cloudcommon/db/db_dispatcher.go +++ b/pkg/cloudcommon/db/db_dispatcher.go @@ -693,11 +693,19 @@ func ListItems(manager IModelManager, ctx context.Context, userCred mcclient.Tok var totalCnt int var totalJson jsonutils.JSONObject if pagingConf == nil { - // calculate total - totalQ := q.CountQuery() - totalCnt, totalJson, err = manager.CustomizedTotalCount(ctx, userCred, query, totalQ) - if err != nil { - return nil, errors.Wrap(err, "CustomizedTotalCount") + summaryStats := jsonutils.QueryBoolean(query, "summary_stats", false) + if summaryStats { + // calculate total + totalQ := q.CountQuery() + totalCnt, totalJson, err = manager.CustomizedTotalCount(ctx, userCred, query, totalQ) + if err != nil { + return nil, errors.Wrap(err, "CustomizedTotalCount") + } + } else { + totalCnt, err = q.CountWithError() + if err != nil { + return nil, errors.Wrap(err, "CountWithError") + } } //log.Debugf("total count %d", totalCnt) if totalCnt == 0 { diff --git a/pkg/compute/models/guests.go b/pkg/compute/models/guests.go index aa20e5c3ce4..81db0884070 100644 --- a/pkg/compute/models/guests.go +++ b/pkg/compute/models/guests.go @@ -879,7 +879,7 @@ func (manager *SGuestManager) initAdminSecgroupId() error { adminSecId := adminSec.Id guests := make([]SGuest, 0, 10) q := manager.Query() - q = q.In("hypervisor", []string{api.HYPERVISOR_KVM}).IsNullOrEmpty("admin_secgrp_id") + q = q.In("hypervisor", []string{api.HYPERVISOR_KVM, api.HYPERVISOR_POD}).IsNullOrEmpty("admin_secgrp_id") err := db.FetchModelObjects(manager, q, &guests) if err != nil { return errors.Wrap(err, "db.FetchModelObjects")