[lxc-devel] [crio-lxc/master] Set init pid
hallyn on Github
lxc-bot at linuxcontainers.org
Mon Apr 22 22:15:58 UTC 2019
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 415 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20190422/d54ee1a6/attachment.bin>
-------------- next part --------------
From d9c453e6febe6a92326599ece3a72b525ae6ca56 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge at hallyn.com>
Date: Mon, 22 Apr 2019 16:36:52 -0500
Subject: [PATCH 1/3] state: don't forget to actually query the initpid
Signed-off-by: Serge Hallyn <serge at hallyn.com>
---
cmd/state.go | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/cmd/state.go b/cmd/state.go
index 5e8af42..6bea455 100644
--- a/cmd/state.go
+++ b/cmd/state.go
@@ -55,10 +55,11 @@ func doState(ctx *cli.Context) error {
// https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc4/runtime.md#state
// it means "the container process has neither exited nor executed the user-specified program"
status := "stopped"
+ pid := 0
if c.Running() && checkHackyPreStart(c) == "started" {
status = "running"
+ pid = c.InitPid()
}
- pid := 0
// bundlePath is the enclosing directory of the rootfs:
// https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc4/bundle.md
bundlePath := filepath.Dir(c.ConfigItem("lxc.rootfs.path")[0])
From b634fd847526ce97cb825560bf1d5b386a8db124 Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge at hallyn.com>
Date: Mon, 22 Apr 2019 16:55:54 -0500
Subject: [PATCH 2/3] go fmt
---
cmd/delete.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmd/delete.go b/cmd/delete.go
index c743cfd..02b6a69 100644
--- a/cmd/delete.go
+++ b/cmd/delete.go
@@ -22,7 +22,7 @@ var deleteCmd = cli.Command{
`,
Flags: []cli.Flag{
cli.BoolFlag{
- Name: "force",
+ Name: "force",
Usage: "force deletion",
},
},
From 75c9c58944cfdefe989eacddc683b0ecc1bea4de Mon Sep 17 00:00:00 2001
From: Serge Hallyn <serge at hallyn.com>
Date: Mon, 22 Apr 2019 17:12:44 -0500
Subject: [PATCH 3/3] basic.bats: pass pod id argument to crictl create
As that is what it seems to require, not a container name.
Signed-off-by: Serge Hallyn <serge at hallyn.com>
---
test/basic.bats | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/basic.bats b/test/basic.bats
index e254151..3f72848 100644
--- a/test/basic.bats
+++ b/test/basic.bats
@@ -12,6 +12,7 @@ function teardown() {
crictl runp test/basic-pod-config.json
crictl pull busybox
crictl images
- crictl create clowncore test/basic-container-config.json test/basic-pod-config.json
- [ "$(crictl ps)" | grep clowncore ]
+ podid=$(crictl pods | grep nginx-sandbox | awk '{ print $1 }')
+ crictl create $podid test/basic-container-config.json test/basic-pod-config.json
+ [ "$(crictl ps -a)" | grep busybox ]
}
More information about the lxc-devel
mailing list