Skip to content

FIX - implement OCI runtime state command [Enhancement]#621

Open
abhaygoudannavar wants to merge 1 commit into
urunc-dev:mainfrom
abhaygoudannavar:two/OCI
Open

FIX - implement OCI runtime state command [Enhancement]#621
abhaygoudannavar wants to merge 1 commit into
urunc-dev:mainfrom
abhaygoudannavar:two/OCI

Conversation

@abhaygoudannavar
Copy link
Copy Markdown

@abhaygoudannavar abhaygoudannavar commented May 4, 2026

Description

This PR implements the OCI state command for urunc, which outputs the current state information of a container instance conforming to the OCI runtime specification.

The implementation has been aligned with the reference runc implementation. Instead of blindly reading and marshaling state.json, it dynamically verifies the process status (using syscall.Kill(pid, 0)) to detect if the VMM has exited. It formats the JSON output using a custom containerState struct exactly as runc does to ensure orchestrators parsing the output receive the expected OCI schema.

Related issues

How was this tested?

  1. Created and started a unikernel container using urunc.
  2. Invoked urunc state <container-id> while the container was running and verified the output correctly matched the OCI JSON schema with status "running".
  3. Stopped the container and invoked urunc state <container-id> again, verifying it correctly dynamically detected the stopped state (returning status: "stopped" and pid: 0).
  4. Ran make unittest and verified no existing tests were broken.

LLM usage

No usage

Checklist

  • I have read the contribution guide.
  • The linter passes locally (make lint).
  • The e2e tests of at least one tool pass locally (make test_ctr, make test_nerdctl, make test_docker, make test_crictl).
  • If LLMs were used: I have read the llm policy.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 4, 2026

Deploy Preview for urunc ready!

Name Link
🔨 Latest commit 5855b50
🔍 Latest deploy log https://app.netlify.com/projects/urunc/deploys/69fcf037cd8b9c000864b48d
😎 Deploy Preview https://deploy-preview-621--urunc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cmainas
Copy link
Copy Markdown
Contributor

cmainas commented May 5, 2026

Hello @abhaygoudannavar ,

this PR contains unrelated changes. Also please use a similar implementation with https://github.com/opencontainers/runc/blob/main/state.go

@abhaygoudannavar abhaygoudannavar force-pushed the two/OCI branch 2 times, most recently from 36755c2 to 034a222 Compare May 6, 2026 20:46
@abhaygoudannavar
Copy link
Copy Markdown
Author

@cmainas, I have updated the PR to resolve both of your points:

  • I've removed the unrelated changes from this branch.
  • I've rewritten cmd/urunc/state.go to match the runc implementation.
  • updated the PR description.
    Let me know if everything looks good to go now.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement the OCI runtime state command [Enhancement]

2 participants