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

podman machine start: lookup qemu path again if not found #13620

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions pkg/machine/qemu/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (p *Provider) NewMachine(opts machine.InitOptions) (machine.VM, error) {
return nil, err
}

cmd := append([]string{execPath})
cmd := []string{execPath}
// Add memory
cmd = append(cmd, []string{"-m", strconv.Itoa(int(vm.Memory))}...)
// Add cpus
Expand Down Expand Up @@ -430,13 +430,29 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {

// Disable graphic window when not in debug mode
// Done in start, so we're not suck with the debug level we used on init
if logrus.GetLevel() != logrus.DebugLevel {
if !logrus.IsLevelEnabled(logrus.DebugLevel) {
cmd = append(cmd, "-display", "none")
}

_, err = os.StartProcess(v.CmdLine[0], cmd, attr)
if err != nil {
return err
// check if qemu was not found
if !errors.Is(err, os.ErrNotExist) {
return err
}
// lookup qemu again maybe the path was changed, https://github.com/containers/podman/issues/13394
cfg, err := config.Default()
if err != nil {
return err
}
cmd[0], err = cfg.FindHelperBinary(QemuCommand, true)
if err != nil {
return err
}
_, err = os.StartProcess(cmd[0], cmd, attr)
if err != nil {
return err
}
}
fmt.Println("Waiting for VM ...")
socketPath, err := getRuntimeDir()
Expand Down