FIX - implement OCI runtime state command [Enhancement]#621
FIX - implement OCI runtime state command [Enhancement]#621abhaygoudannavar wants to merge 1 commit into
Conversation
✅ Deploy Preview for urunc ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Hello @abhaygoudannavar , this PR contains unrelated changes. Also please use a similar implementation with https://github.com/opencontainers/runc/blob/main/state.go |
36755c2 to
034a222
Compare
|
@cmainas, I have updated the PR to resolve both of your points:
|
|
Thank you @abhaygoudannavar for the changes, please rebase over main too. |
Implement the state subcommand for urunc, following the runc reference implementation. The command outputs container state as JSON to stdout, conforming to the OCI runtime specification. - Adds containerState struct matching OCI state schema - Dynamically checks process liveness via syscall.Kill(pid, 0) - Sets pid=0 and status=stopped if the process has exited - Registers stateCommand in main.go Signed-off-by: abhaygoudannavar <abhaysgoudnvr@gmail.com>
|
@cmainas Rebased over the main. |
|
Hello @abhaygoudannavar , thank you for the rebase. There are two of your PRs that we need to merge, but before doing so, we need to add yourself in https://github.com/urunc-dev/urunc/blob/main/.github/contributors.yaml You can do this in either your PRs and we will merge that one first. Your Prs is this one and #596 |
|
Forget my previous comment, you have opened another PR with the necessary change #664. So let;s merge that one first and then the others. |
Description
This PR implements the OCI
statecommand forurunc, which outputs the current state information of a container instance conforming to the OCI runtime specification.The implementation has been aligned with the reference
runcimplementation. Instead of blindly reading and marshalingstate.json, it dynamically verifies the process status (usingsyscall.Kill(pid, 0)) to detect if the VMM has exited. It formats the JSON output using a customcontainerStatestruct exactly asruncdoes to ensure orchestrators parsing the output receive the expected OCI schema.Related issues
How was this tested?
urunc.urunc state <container-id>while the container was running and verified the output correctly matched the OCI JSON schema with status"running".urunc state <container-id>again, verifying it correctly dynamically detected the stopped state (returningstatus: "stopped"andpid: 0).make unittestand verified no existing tests were broken.LLM usage
No usage
Checklist
make lint).make test_ctr,make test_nerdctl,make test_docker,make test_crictl).