@@ -23,9 +23,7 @@ import (
23
23
// Use specs and options to create
24
24
// TODO what about networks?
25
25
func (c * calcium ) CreateContainer (specs types.Specs , opts * types.DeployOptions ) (chan * types.CreateContainerMessage , error ) {
26
- log .Debugf ("Deploy container with specs %v, deploy options %v" , specs , opts )
27
26
pod , _ := c .store .GetPod (opts .Podname )
28
- log .Debugf ("Deplay scheduler: %s" , pod .Scheduler )
29
27
if pod .Scheduler == "CPU" {
30
28
return c .createContainerWithScheduler (specs , opts )
31
29
} else {
@@ -302,15 +300,16 @@ func (c *calcium) getCPUAndMem(podname, nodename string, quota float64) (map[str
302
300
// Later if any error occurs, these nodes can be restored.
303
301
func (c * calcium ) prepareNodes (podname , nodename string , quota float64 , num int ) (map [string ][]types.CPUMap , error ) {
304
302
result := make (map [string ][]types.CPUMap )
305
-
303
+ log . Debugf ( "Input parameters podname: %s, nodename: %s, quota: %f, num: %d" , podname , nodename , quota , num )
306
304
cpuandmem , nodes , err := c .getCPUAndMem (podname , nodename , quota )
307
305
if err != nil {
308
306
return result , err
309
307
}
310
308
cpumap := makeCPUMap (cpuandmem ) // 做这个转换,免得改太多
311
309
// use podname as lock key to prevent scheduling on the same node at one time
310
+ log .Debugf ("Cpumap: %v" , cpumap )
312
311
result , changed , err := c .scheduler .SelectNodes (cpumap , quota , num ) // 这个接口统一使用float64了
313
- log .Debugf ("result : %v, changed : %v" , result , changed )
312
+ log .Debugf ("Result : %v, Changed : %v" , result , changed )
314
313
if err != nil {
315
314
return result , err
316
315
}
@@ -321,7 +320,6 @@ func (c *calcium) prepareNodes(podname, nodename string, quota float64, num int)
321
320
// cpus changeded
322
321
// update data to etcd
323
322
// `SelectNodes` reduces count in cpumap
324
- log .WithFields (log.Fields {"changed" : changed }).Debugln ("Changed nodes are:" )
325
323
for _ , node := range nodes {
326
324
r , ok := changed [node .Name ]
327
325
// 不在changed里说明没有变化
@@ -479,7 +477,7 @@ func (c *calcium) doCreateContainerWithScheduler(nodename string, cpumap []types
479
477
// no need to update this to etcd (save 1 time write on etcd)
480
478
func (c * calcium ) releaseQuota (node * types.Node , quota types.CPUMap ) {
481
479
if quota .Total () == 0 {
482
- log .Debug ("cpu quota is zero: %v " , quota )
480
+ log .Debug ("cpu quota is zero: %f " , quota )
483
481
return
484
482
}
485
483
c .store .UpdateNodeCPU (node .Podname , node .Name , quota , "+" )
0 commit comments