diff --git a/internal/storeLink/shuguangai.go b/internal/storeLink/shuguangai.go index ed600ed1..2c889822 100644 --- a/internal/storeLink/shuguangai.go +++ b/internal/storeLink/shuguangai.go @@ -1296,7 +1296,7 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS defer wg.Done() defer close(sch) done := make(chan bool) - + storage := &collector.Usage{} go func() { diskReq := &hpcAC.ParaStorQuotaReq{} @@ -1308,7 +1308,7 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS totalStorage := common.RoundFloat(diskResp.Data[0].Threshold, 0) availStorage := common.RoundFloat((diskResp.Data[0].Threshold - diskResp.Data[0].Usage), 0) - storage := &collector.Usage{} + storage.Type = STORAGE storage.Name = DISK storage.Total = &collector.UnitValue{ @@ -1319,14 +1319,13 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS Unit: GIGABYTE, Value: availStorage, } - sch <- storage done <- true }() select { case <-done: - return + sch <- storage case <-time.After(time.Duration(timeout) * time.Second): return } @@ -1336,7 +1335,7 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS go func() { defer uwg.Done() done := make(chan bool) - + cres := &collector.ClusterResource{} go func() { userReq := &hpcAC.GetUserInfoReq{} userinfo, err := s.aCRpc.GetUserInfo(ctx, userReq) @@ -1351,14 +1350,14 @@ func (s *ShuguangAi) GetResourceSpecs(ctx context.Context) (*collector.ResourceS Unit: RMB, Value: balance, } - cresCh <- &collector.ClusterResource{Resource: bal} + cres.Resource = bal done <- true }() select { case <-done: - return + cresCh <- cres case <-time.After(time.Duration(timeout) * time.Second): return }