Skip to content

cmdline: context: add --pidfile option#71

Merged
slp merged 3 commits into
libkrun:mainfrom
jakecorrenti:pidfile
Sep 3, 2025
Merged

cmdline: context: add --pidfile option#71
slp merged 3 commits into
libkrun:mainfrom
jakecorrenti:pidfile

Conversation

@jakecorrenti
Copy link
Copy Markdown
Collaborator

@jakecorrenti jakecorrenti commented Aug 29, 2025

Add a new --pidfile option. This will allow the user to specify a path in which the krunkit binary will write its PID.

Resolves: #42

Comment thread src/cmdline.rs Outdated
Comment thread src/context.rs
@jakecorrenti jakecorrenti force-pushed the pidfile branch 2 times, most recently from 72d73c2 to 3a7e4ab Compare August 29, 2025 19:20
@jakecorrenti
Copy link
Copy Markdown
Collaborator Author

jakecorrenti commented Aug 29, 2025

I wonder if this may work better as a PR in libkrun first, which we can then expose here in krunkit after. There's a possible scenario where you create the pidfile, something fails in krun_start_enter, and there's that short period of time where there's a pidfile that exists even though the guest hasn't started yet and we haven't had a chance to remove it on krun_start_enter failure.

@nirs
Copy link
Copy Markdown
Contributor

nirs commented Aug 29, 2025

I wonder if this may work better as a PR in libkrun first, which we can then expose here in krunkit after. There's a possible scenario where you create the pidfile, something fails in krun_start_enter, and there's that short period of time where there's a pidfile that exists even though the guest hasn't started yet and we haven't had a chance to remove it on krun_start_enter failure.

This is very unlikely and the window is small. I think creating it before starting is good enough and it matches what vfkit does.

Programs running krunkit should check if the process terminated when they wait until the vm is reachable. I already do this in vment-helper test script, implementing this in minikube is easy.

@jakecorrenti jakecorrenti marked this pull request as ready for review August 30, 2025 00:35
@jakecorrenti jakecorrenti changed the title WIP: cmdline: context: add --pidfile option cmdline: context: add --pidfile option Aug 30, 2025
@jakecorrenti jakecorrenti marked this pull request as draft August 30, 2025 02:02
Add a new --pidfile option. This will allow the user to specify a path
in which the krunkit binary will write its PID.

Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
Signed-off-by: Jake Correnti <jakecorrenti+github@proton.me>
@jakecorrenti jakecorrenti marked this pull request as ready for review September 2, 2025 15:04
Copy link
Copy Markdown
Collaborator

@slp slp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@slp slp merged commit 6c3b1a2 into libkrun:main Sep 3, 2025
3 checks passed
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.

[Feature Support] support pid file

3 participants