Skip to content
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

Merged
merged 1 commit into from
Jan 12, 2022

Conversation

baude
Copy link
Member

@baude baude commented Jan 12, 2022

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]

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]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jan 12, 2022

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 12, 2022
@rhatdan
Copy link
Member

rhatdan commented Jan 12, 2022

LGTM

1 similar comment
@TomSweeneyRedHat
Copy link
Member

LGTM

@TomSweeneyRedHat
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 12, 2022
@openshift-merge-robot openshift-merge-robot merged commit cb06133 into containers:main Jan 12, 2022
@afbjorklund
Copy link
Contributor

afbjorklund commented Jan 19, 2022

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 ?

@baude

@rhatdan
Copy link
Member

rhatdan commented Jan 20, 2022

Care to open a PR.

@ssbarnea
Copy link
Collaborator

@baude I am afraid that some tests might have being useful for the stop functionality because in 4.1.1 stop does not complete. I had to reopen #12815

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

podman-machine-stop should block until the machine is in the target state
6 participants