summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbaude <baude@baudes-Mac-mini.localdomain>2021-07-02 09:57:03 -0500
committerBrent Baude <bbaude@redhat.com>2021-07-02 12:41:51 -0500
commit0c9dc86deaf6e981a7e557a1fc8edeadb8be8357 (patch)
treeb5236548af85e3401828560cd3e3c611f7578a3e
parent04209873562dff25c5d6f800e4a535dff18d485a (diff)
downloadpodman-0c9dc86deaf6e981a7e557a1fc8edeadb8be8357.tar.gz
podman-0c9dc86deaf6e981a7e557a1fc8edeadb8be8357.tar.bz2
podman-0c9dc86deaf6e981a7e557a1fc8edeadb8be8357.zip
Create podman temp dir on machine start
If the tempdir for the OS does not have a podman/, machine start will fail. An example would be after a reboot. We now create the podman dir if it does not exist. Fixes #10824 [NO TESTS NEEDED] Signed-off-by: baude <baude@baudes-Mac-mini.localdomain> Signed-off-by: Brent Baude <bbaude@redhat.com>
-rw-r--r--pkg/machine/qemu/machine.go22
1 files changed, 17 insertions, 5 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 22fb78a5c..42ae23c43 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -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"
@@ -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)
@@ -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 {