-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding status command to container #246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
status.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not handle all status? We have pausing left.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is what I would do and then just printf the value as a %s
diff --git a/libcontainer/container.go b/libcontainer/container.go
index a24b71b..f0ca79c 100644
--- a/libcontainer/container.go
+++ b/libcontainer/container.go
@@ -13,6 +13,21 @@ import (
// The status of a container.
type Status int
+func (s Status) String() string {
+ switch s {
+ case Running:
+ return "running"
+ case Pausing:
+ return "pausing"
+ case Paused:
+ return "paused"
+ case Checkpointed:
+ return "checkpointed"
+ case Destroyed:
+ return "destroyed"
+ }
+ return ""
+}
+
const (
// The container exists and is running.
Running Status = iota + 1|
Personally I think we have too many state related APIs in libcontainer They have overlaps and the naming is confusing. We should reconsider it when we design runC commands, and I doubt a signal status worth being a separate command. |
|
I think the last one is for statistics, not status; |
|
@hqhq |
|
@thaJeztah @rajasec You are right yes it's about statistics, just think the name is so alike as state :) |
|
@rajasec Never mind, I found we have |
status.go
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not need explicit breaks in Go for switch statements.
Signed-off-by: Rajasekaran <[email protected]> Fixed the review comments Signed-off-by: rajasec <[email protected]>
556d2bd to
d9c0151
Compare
|
@crosbymichael |
@crosbymichael @mrunalp
Quick way to check the container status from CLI, It provides the message to the user whether container is running checkpointed destroyed or paused ( frozen)
I've checked with Running,Checkpointed container, but frozen container, currently it will give the status as Running ( will give the right status once after #218 closure)
Usage:
runc status
Signed-off-by: Rajasekaran [email protected]