Skip to content

Commit a07720c

Browse files
committed
add log for exec
1 parent fd6b783 commit a07720c

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

cluster/calcium/create_container.go

+12-4
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@ func (c *calcium) doCreateContainerWithCPUPeriod(nodename string, connum int, qu
164164
}
165165

166166
// after start
167-
runExec(node.Engine, info, AFTER_START)
167+
if err := runExec(node.Engine, info, AFTER_START); err != nil {
168+
log.Errorf("Run exec at %s error: %s", AFTER_START, err.Error())
169+
}
168170

169171
_, err = c.store.AddContainer(info.ID, opts.Podname, node.Name, containerName, nil, opts.Memory)
170172
if err != nil {
@@ -439,7 +441,9 @@ func (c *calcium) doCreateContainerWithScheduler(nodename string, cpumap []types
439441
}
440442

441443
// after start
442-
runExec(node.Engine, info, AFTER_START)
444+
if err := runExec(node.Engine, info, AFTER_START); err != nil {
445+
log.Errorf("Run exec at %s error: %s", AFTER_START, err.Error())
446+
}
443447

444448
_, err = c.store.AddContainer(info.ID, opts.Podname, node.Name, containerName, quota, opts.Memory)
445449
if err != nil {
@@ -770,7 +774,9 @@ func (c *calcium) doUpgradeContainer(containers []*types.Container, image string
770774
imageToDelete := info.Config.Image
771775

772776
// before stop old container
773-
runExec(engine, info, BEFORE_STOP)
777+
if err := runExec(engine, info, BEFORE_STOP); err != nil {
778+
log.Errorf("Run exec at %s error: %s", BEFORE_STOP, err.Error())
779+
}
774780

775781
// stops the old container
776782
timeout := 5 * time.Second
@@ -834,7 +840,9 @@ func (c *calcium) doUpgradeContainer(containers []*types.Container, image string
834840
}
835841

836842
// after start
837-
runExec(engine, newInfo, AFTER_START)
843+
if err := runExec(engine, newInfo, AFTER_START); err != nil {
844+
log.Errorf("Run exec at %s error: %s", AFTER_START, err.Error())
845+
}
838846

839847
// if so, add a new container in etcd
840848
_, err = c.store.AddContainer(newInfo.ID, container.Podname, container.Nodename, containerName, container.CPU, container.Memory)

cluster/calcium/remove_container.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ func (c *calcium) removeOneContainer(container *types.Container) error {
8484
}
8585

8686
// before stop
87-
runExec(container.Engine, info, BEFORE_STOP)
87+
if err := runExec(container.Engine, info, BEFORE_STOP); err != nil {
88+
log.Errorf("Run exec at %s error: %s", BEFORE_STOP, err.Error())
89+
}
8890

8991
timeout := 5 * time.Second
9092
err = container.Engine.ContainerStop(context.Background(), info.ID, &timeout)

0 commit comments

Comments
 (0)