-
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
Wait for podman stop to complete #12835
Conversation
if users run podman machine stop && podman machine ls, the status of the machine in the subsequent ls command would running. now we wait for everything to complete for stop so that scripting is more accurate. Fixes: containers#12815 [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <[email protected]>
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: baude 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 |
LGTM |
1 similar comment
LGTM |
/lgtm |
This made some changes to the "Start" logic, so that it now hangs forever when the machine is running correctly. --- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -386,8 +386,16 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
}
if len(v.Mounts) > 0 {
- for !v.isRunning() || !v.isListening() {
+ running, err := v.isRunning()
+ if err != nil {
+ return err
+ }
+ for running || !v.isListening() {
time.Sleep(100 * time.Millisecond)
+ running, err = v.isRunning()
+ if err != nil {
+ return err
+ }
}
}
for _, mount := range v.Mounts { Before it was sleeping if it was not running, or not listening. Now it sleeps if it is running, or not listening. Side-effect of refactoring the "is" calls to return errors, I suppose. Ultimately there should be a timeout to this sleep loop, as well ? |
Care to open a PR. |
if users run podman machine stop && podman machine ls, the status of the
machine in the subsequent ls command would running. now we wait for
everything to complete for stop so that scripting is more accurate.
Fixes: #12815
[NO NEW TESTS NEEDED]
Signed-off-by: Brent Baude [email protected]