Add namespace to container metrics

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby
2017-06-27 10:26:02 -07:00
parent 85f61f6f51
commit 6ec84ef83c
7 changed files with 50 additions and 53 deletions

View File

@@ -400,21 +400,9 @@ func (r *Runtime) terminate(ctx context.Context, bundle *bundle, ns, id string)
if err != nil {
return err
}
if err := rt.Kill(ctx, id, int(unix.SIGKILL), &runc.KillOpts{All: true}); err != nil {
log.G(ctx).WithError(err).Warnf("kill all processes for %s", id)
}
// it can take a while for the container to be killed so poll for the container's status
// until it is in a stopped state
status := "running"
for status != "stopped" {
c, err := rt.State(ctx, id)
if err != nil {
break
}
status = c.Status
time.Sleep(50 * time.Millisecond)
}
if err := rt.Delete(ctx, id); err != nil {
if err := rt.Delete(ctx, id, &runc.DeleteOpts{
Force: true,
}); err != nil {
log.G(ctx).WithError(err).Warnf("delete runtime state %s", id)
}
if err := unix.Unmount(filepath.Join(bundle.path, "rootfs"), 0); err != nil {

View File

@@ -205,7 +205,7 @@ func (p *initProcess) Delete(context context.Context) error {
}
p.killAll(context)
p.Wait()
err = p.runc.Delete(context, p.id)
err = p.runc.Delete(context, p.id, nil)
if p.io != nil {
for _, c := range p.closers {
c.Close()