summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-03-24 18:11:45 +0100
committerGitHub <noreply@github.com>2022-03-24 18:11:45 +0100
commitc61b06c46ce414a9b55fc4ebbf247199c81ac782 (patch)
treee66664f823a8ab53438e82b33c35fc42b97fe67e /pkg/machine/qemu
parentcaaaf07c1e9d30d91122a462e65cea5ca49391d0 (diff)
parentda58911306ad213e1312ac4d1dd3125c214c0527 (diff)
downloadpodman-c61b06c46ce414a9b55fc4ebbf247199c81ac782.tar.gz
podman-c61b06c46ce414a9b55fc4ebbf247199c81ac782.tar.bz2
podman-c61b06c46ce414a9b55fc4ebbf247199c81ac782.zip
Merge pull request #13620 from Luap99/qemu-path
podman machine start: lookup qemu path again if not found
Diffstat (limited to 'pkg/machine/qemu')
-rw-r--r--pkg/machine/qemu/machine.go22
1 files changed, 19 insertions, 3 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 3b14572a6..287b93612 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -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
@@ -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()