From 4b45e16a4b593729a2464273192cc429873c4bf5 Mon Sep 17 00:00:00 2001 From: Lantao Liu Date: Sun, 16 Sep 2018 21:27:51 -0700 Subject: [PATCH] Show runtime handler in sandbox debug info. Signed-off-by: Lantao Liu --- pkg/server/container_status.go | 1 - pkg/server/sandbox_run.go | 7 ++++--- pkg/server/sandbox_status.go | 26 ++++++++++++++------------ pkg/store/sandbox/metadata.go | 2 ++ 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/pkg/server/container_status.go b/pkg/server/container_status.go index ffbe2381a..bacf02132 100644 --- a/pkg/server/container_status.go +++ b/pkg/server/container_status.go @@ -113,7 +113,6 @@ type containerInfo struct { } // toCRIContainerInfo converts internal container object information to CRI container status response info map. -// TODO(random-liu): Return error instead of logging. func toCRIContainerInfo(ctx context.Context, container containerstore.Container, verbose bool) (map[string]string, error) { if !verbose { return nil, nil diff --git a/pkg/server/sandbox_run.go b/pkg/server/sandbox_run.go index b0514789c..f4a8dd630 100644 --- a/pkg/server/sandbox_run.go +++ b/pkg/server/sandbox_run.go @@ -74,9 +74,10 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox // Create initial internal sandbox object. sandbox := sandboxstore.NewSandbox( sandboxstore.Metadata{ - ID: id, - Name: name, - Config: config, + ID: id, + Name: name, + Config: config, + RuntimeHandler: r.GetRuntimeHandler(), }, sandboxstore.Status{ State: sandboxstore.StateUnknown, diff --git a/pkg/server/sandbox_status.go b/pkg/server/sandbox_status.go index 5d4628a8e..8c3ab3f05 100644 --- a/pkg/server/sandbox_status.go +++ b/pkg/server/sandbox_status.go @@ -102,15 +102,16 @@ func toCRISandboxStatus(meta sandboxstore.Metadata, status sandboxstore.Status, // TODO (mikebrow): discuss predefining constants structures for some or all of these field names in CRI type sandboxInfo struct { - Pid uint32 `json:"pid"` - Status string `json:"processStatus"` - NetNSClosed bool `json:"netNamespaceClosed"` - Image string `json:"image"` - SnapshotKey string `json:"snapshotKey"` - Snapshotter string `json:"snapshotter"` - Runtime *criconfig.Runtime `json:"runtime"` - Config *runtime.PodSandboxConfig `json:"config"` - RuntimeSpec *runtimespec.Spec `json:"runtimeSpec"` + Pid uint32 `json:"pid"` + Status string `json:"processStatus"` + NetNSClosed bool `json:"netNamespaceClosed"` + Image string `json:"image"` + SnapshotKey string `json:"snapshotKey"` + Snapshotter string `json:"snapshotter"` + RuntimeHandler string `json:"runtimeHandler"` + Runtime *criconfig.Runtime `json:"runtime"` + Config *runtime.PodSandboxConfig `json:"config"` + RuntimeSpec *runtimespec.Spec `json:"runtimeSpec"` } // toCRISandboxInfo converts internal container object information to CRI sandbox status response info map. @@ -132,9 +133,10 @@ func toCRISandboxInfo(ctx context.Context, sandbox sandboxstore.Sandbox) (map[st } si := &sandboxInfo{ - Pid: sandbox.Status.Get().Pid, - Status: string(processStatus), - Config: sandbox.Config, + Pid: sandbox.Status.Get().Pid, + RuntimeHandler: sandbox.RuntimeHandler, + Status: string(processStatus), + Config: sandbox.Config, } if si.Status == "" { diff --git a/pkg/store/sandbox/metadata.go b/pkg/store/sandbox/metadata.go index 9bff1cbdb..a5c803ca7 100644 --- a/pkg/store/sandbox/metadata.go +++ b/pkg/store/sandbox/metadata.go @@ -54,6 +54,8 @@ type Metadata struct { NetNSPath string // IP of Pod if it is attached to non host network IP string + // RuntimeHandler is the runtime handler name of the pod. + RuntimeHandler string } // MarshalJSON encodes Metadata into bytes in json format.