mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 03:37:46 +08:00
[ADD] add some gif for readme
This commit is contained in:
parent
9e3f479c4c
commit
eff40f32e1
@ -754,20 +754,40 @@ func (s *ServiceAction) GetPagedTenantRes(offset, len int) ([]*api_model.TenantR
|
|||||||
|
|
||||||
//GetTenantRes get pagedTenantServiceRes(s)
|
//GetTenantRes get pagedTenantServiceRes(s)
|
||||||
func (s *ServiceAction) GetTenantRes(uuid string) (*api_model.TenantResource, error) {
|
func (s *ServiceAction) GetTenantRes(uuid string) (*api_model.TenantResource, error) {
|
||||||
services, err := db.GetManager().TenantServiceDao().GetTenantServiceRes(uuid)
|
services, err := db.GetManager().TenantServiceDao().GetServicesByTenantID(uuid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.Errorf("get service by id error, %v, %v", services, err)
|
logrus.Errorf("get service by id error, %v, %v", services, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logrus.Infof("get tenant service res is %v", services)
|
var serviceIDs string
|
||||||
|
var AllocatedCPU, AllocatedMEM int
|
||||||
|
var serMap = make(map[string]*dbmodel.TenantServices, len(services))
|
||||||
|
for _, ser := range services {
|
||||||
|
if serviceIDs == "" {
|
||||||
|
serviceIDs += ser.ServiceID
|
||||||
|
} else {
|
||||||
|
serviceIDs += "," + ser.ServiceID
|
||||||
|
}
|
||||||
|
AllocatedCPU += ser.ContainerCPU
|
||||||
|
AllocatedMEM += ser.ContainerMemory
|
||||||
|
serMap[ser.ServiceID] = ser
|
||||||
|
}
|
||||||
|
status := s.statusCli.GetStatuss(serviceIDs)
|
||||||
|
var UsedCPU, UsedMEM int
|
||||||
|
for k, v := range status {
|
||||||
|
if !s.statusCli.IsClosedStatus(v) {
|
||||||
|
UsedCPU += serMap[k].ContainerCPU
|
||||||
|
UsedMEM += serMap[k].ContainerMemory
|
||||||
|
}
|
||||||
|
}
|
||||||
var res api_model.TenantResource
|
var res api_model.TenantResource
|
||||||
res.UUID = uuid
|
res.UUID = uuid
|
||||||
res.Name = ""
|
res.Name = ""
|
||||||
res.EID = ""
|
res.EID = ""
|
||||||
res.AllocatedCPU = services["capcpu"].(int)
|
res.AllocatedCPU = AllocatedCPU
|
||||||
res.AllocatedMEM = services["capmem"].(int)
|
res.AllocatedMEM = AllocatedMEM
|
||||||
res.UsedCPU = services["usecpu"].(int)
|
res.UsedCPU = UsedCPU
|
||||||
res.UsedMEM = services["usemem"].(int)
|
res.UsedMEM = UsedMEM
|
||||||
return &res, nil
|
return &res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BIN
docs/buildfromsourcecode.gif
Executable file
BIN
docs/buildfromsourcecode.gif
Executable file
Binary file not shown.
After Width: | Height: | Size: 1.9 MiB |
BIN
docs/topology.gif
Normal file
BIN
docs/topology.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 MiB |
Loading…
Reference in New Issue
Block a user