Small fixes for wacko CI environments

In the unusual case where the `runtimeDir` is not already created, we
should do so on `machine init`.

When starting gvproxy from podman, we now ensure it is running (for
applehv) but waiting for the unixgram socket to appear in the filesystem
before moving on.

[NO NEW TESTS NEEDED]

Signed-off-by: Brent Baude <bbaude@redhat.com>
This commit is contained in:
Brent Baude
2023-10-24 14:35:26 -05:00
parent 95fc0044f0
commit 95a5ad258b

View File

@ -608,6 +608,7 @@ func (m *MacMachine) Start(name string, opts machine.StartOptions) error {
// To start the VM, we need to call vfkit // To start the VM, we need to call vfkit
logrus.Debugf("vfkit path is: %s", m.Vfkit.VfkitBinaryPath.Path)
cmd, err := m.Vfkit.VirtualMachine.Cmd(m.Vfkit.VfkitBinaryPath.Path) cmd, err := m.Vfkit.VirtualMachine.Cmd(m.Vfkit.VfkitBinaryPath.Path)
if err != nil { if err != nil {
return err return err
@ -910,12 +911,30 @@ func (m *MacMachine) startHostNetworking() (string, machine.APIForwardingState,
return "", 0, err return "", 0, err
} }
logrus.Debugf("gvproxy binary being used: %s", gvproxyBinary)
cmd, forwardSock, state := m.setupStartHostNetworkingCmd() cmd, forwardSock, state := m.setupStartHostNetworkingCmd()
c := cmd.Cmd(gvproxyBinary) c := cmd.Cmd(gvproxyBinary)
if err := c.Start(); err != nil { if err := c.Start(); err != nil {
return "", 0, fmt.Errorf("unable to execute: %q: %w", cmd.ToCmdline(), err) return "", 0, fmt.Errorf("unable to execute: %q: %w", cmd.ToCmdline(), err)
} }
// We need to wait and make sure gvproxy is in fact running
// before continuing
for i := 0; i < 10; i++ {
_, err := os.Stat(m.GvProxySock.GetPath())
if err == nil {
break
}
logrus.Debugf("gvproxy unixgram socket %q not found: %v", m.GvProxySock.GetPath(), err)
// Sleep for 1/2 second
time.Sleep(500 * time.Millisecond)
}
if err != nil {
// I guess we would also check the pidfile and look to see if it is running
// to?
return "", 0, fmt.Errorf("unable to verify gvproxy is running")
}
return forwardSock, state, nil return forwardSock, state, nil
} }
@ -1041,7 +1060,13 @@ func (m *MacMachine) getRuntimeDir() (string, error) {
if !ok { if !ok {
tmpDir = "/tmp" tmpDir = "/tmp"
} }
return filepath.Join(tmpDir, "podman"), nil rtd := filepath.Join(tmpDir, "podman")
logrus.Debugf("creating runtimeDir: %s", rtd)
if err := os.MkdirAll(rtd, 0755); err != nil {
return "", err
}
return rtd, nil
} }
func (m *MacMachine) userGlobalSocketLink() (string, error) { func (m *MacMachine) userGlobalSocketLink() (string, error) {