[ADD] add some gif for readme

This commit is contained in:
barnett 2018-04-27 16:35:20 +08:00
parent 9e3f479c4c
commit eff40f32e1
3 changed files with 26 additions and 6 deletions

View File

@ -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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

BIN
docs/topology.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB