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