Skip to content

Commit

Permalink
Merge pull request #10850 from baude/issue10824
Browse files Browse the repository at this point in the history
Create podman temp dir on machine start
  • Loading branch information
openshift-merge-robot authored Jul 3, 2021
2 parents f93d60d + 0c9dc86 commit fc2f9cc
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions pkg/machine/qemu/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import (
"strings"
"time"

"github.com/containers/podman/v3/pkg/rootless"

"github.com/containers/podman/v3/pkg/machine"
"github.com/containers/podman/v3/pkg/rootless"
"github.com/containers/podman/v3/utils"
"github.com/containers/storage/pkg/homedir"
"github.com/digitalocean/go-qemu/qmp"
Expand Down Expand Up @@ -248,7 +247,23 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
if err := v.startHostNetworking(); err != nil {
return errors.Errorf("unable to start host networking: %q", err)
}

rtPath, err := getRuntimeDir()
if err != nil {
return err
}

// If the temporary podman dir is not created, create it
podmanTempDir := filepath.Join(rtPath, "podman")
if _, err := os.Stat(podmanTempDir); os.IsNotExist(err) {
if mkdirErr := os.MkdirAll(podmanTempDir, 0755); mkdirErr != nil {
return err
}
}
qemuSocketPath, _, err := v.getSocketandPid()
if err != nil {
return err
}

for i := 0; i < 6; i++ {
qemuSocketConn, err = net.Dial("unix", qemuSocketPath)
Expand All @@ -258,9 +273,6 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
time.Sleep(wait)
wait++
}
if err != nil {
return err
}

fd, err := qemuSocketConn.(*net.UnixConn).File()
if err != nil {
Expand Down

0 comments on commit fc2f9cc

Please sign in to comment.