-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Make podman machine stop
wait for qemu to exit
#14666
Conversation
I don't think you should use migration for that. Migration is used when the json unmarshal would break due breaking changes to the VM format. I don't think this is necessary here. Why not just add the new field to the existing structure? |
Are you suggesting leaving the proxy pidfile path in |
Yes something like this, the naming might be confusing but this can be explained in the comment. |
Sure, that makes sense. =) One last possibility, just to throw it out there, would be to keep |
I'm also facing this issue as well (trying to start the machine and it says it's still running while stop command says 'stops successfully' |
42af2d9
to
a3f80ee
Compare
@Luap99 Updated the PR to remove the need for migrating the config. Notes from the new commit:
|
70840f2
to
05aec10
Compare
@ashley-cui @baude PTAL |
LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baude, shanesmith The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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.
Could you squash your commits? Other than that, LGTM, thanks @shanesmith !
pkg/machine/qemu/machine.go
Outdated
"time" | ||
|
||
"golang.org/x/sys/unix" | ||
|
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.
Remove blank line
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.
done!
05aec10
to
6495d5c
Compare
Squashed! =) |
- New `VMPidFilePath` field in MachineVM config holds the path for the qemu PID file - qemu is now started with the `-pidfile` argument set to `VMPidFilePath` - Machines created before this won't have the VM PID file configured, stopping these VMs will revert back to waiting on the state to change away from `Running`, plus an added 2s sleep to give time for the VM to exit and to avoid potential issues - Machines created after this will have a VM PID file configured and stopping the machine will wait indefinitely for the VM to exit [NO NEW TESTS NEEDED] Signed-off-by: Shane Smith <[email protected]>
6495d5c
to
59a7ac2
Compare
I wonder if this patch also fixed the bug described on #12815 - basically I am still trying to find a way to prevent gtar from failing after I stop the machine:
|
/lgtm |
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.
/hold cancel
After
podman machine stop
successfully exits theqemu
process may still be running, which can cause issues, especially if an attempt is made to start the machine again.In my trials I found the
qemu
process normally takes about 1s to exit afterpodman machine stop
, which meanspodman machine stop && podman machine start
can create problems, for example. I've also found that theqemu
process could hang from time to time after an attempted stop. I'm able to reproduce this most reliably by stopping the machine while a container is running, it then takes about 90s for theqemu
process to exit. This last example should be an issue on its own, but all this to saypodman machine stop
should only exit afterqemu
does.In this PR we use the
-pidfile
flag when runningqemu
and store its path in the MachineVM config. Thepodman machine stop
command now waits for theqemu
command to exit before itself exiting. Two commits are included for a bit of separation.A couple notes:
The MachineVM update requires a migration. I've simply followed what was already done, but do wonder if there might be a better way.
The
podman machine stop
does not have a timeout, it'll wait forqemu
to exit indefinitely. Perhaps it should?The user could interrupt (ie: CTRL-C) a
podman machine stop
that's taking a while, but theqemu
process will still be alive.We could potentially send a
kill
signal to theqemu
process after a timeout and/or a user interrupt.The pidfile can be used elsewhere in the future. For example, it could inform the state of a VM, or at least prevent a
podman machine start
.Fixes #14148
Does this PR introduce a user-facing change?