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

Add help message when starting multiple machines #23863

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

inknos
Copy link
Collaborator

@inknos inknos commented Sep 4, 2024

Not much can be done when multiple machines are started but a help message is definitely of help in some instances

Resolves: #23436

Does this PR introduce a user-facing change?

Output of podman machine start now gives a suggestion if a machine is already running

Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@@ -283,6 +283,7 @@ func checkExclusiveActiveVM(provider vmconfigs.VMProvider, mc *vmconfigs.Machine
return err
}
if state == machineDefine.Running || state == machineDefine.Starting {
fmt.Printf("Cannot start \"%s\" if machine \"%s\" is running:\n\n\tpodman machine stop %s\n\tpodman machine start %s\n\n", mc.Name, name, name, mc.Name)
Copy link
Member

Choose a reason for hiding this comment

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

I really dislike these random prints in "backend" code. I think we should just switch the error message to include the extra info.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

only reason why I preferred this over detailed err message is because we already hint to start the machine when we just do init so this is just another minor troubleshooting. but I also realize that for init is just hinting the next step while here it's suggesting a fix, and that's quite different.

Copy link
Member

Choose a reason for hiding this comment

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

maybe the error should say something like this?

unable to start "vmY": machine "vmX" is already running or starting and there can only be one running machine at a time

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oh actually, we have an error for that which is ErrMultipleActiveVM just noticed now, is it a breaking change to change the error? I believe it makes more sense to use that

Copy link
Member

Choose a reason for hiding this comment

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

Error messages are not stable so we can change them, for the error types you should check if callers do some errors.Is()/As() checks on them, if so you need to update the callers but there are not stable either as we do not offer stable APIs except for packages in pkg/bindings.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

thanks a lot. I'll check and update the PR

@Luap99
Copy link
Member

Luap99 commented Sep 4, 2024

Resolves: #23436

Not blocking but I think we settled on using Fixes now, cc @mheon

@inknos
Copy link
Collaborator Author

inknos commented Sep 4, 2024

Gosh I was so unsure of what was the right keyword. I'll change it 😓

@inknos inknos force-pushed the issue-23436 branch 3 times, most recently from cfdde34 to 71b308d Compare September 4, 2024 16:47
Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

openshift-ci bot commented Sep 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: inknos, Luap99

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 Sep 4, 2024
@mheon
Copy link
Member

mheon commented Sep 4, 2024

LGTM

Instead of ErrVMAlreadyRunning use a more appropriate error.
Also improve the message a little bit.

Fixes: containers#23436

Signed-off-by: Nicola Sella <[email protected]>
@baude
Copy link
Member

baude commented Sep 13, 2024

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2024
@openshift-merge-bot openshift-merge-bot bot merged commit fdb8b1c into containers:main Sep 13, 2024
83 of 85 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. machine release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot create and start HyperV Podman machine if there is already one running
4 participants