mirror of
https://github.com/containers/podman.git
synced 2025-11-01 22:32:50 +08:00
- Fixes conflicts such as removal of second machine deleting a socket of a the first machine while it's running - Move API socket into runtime directory for consistency - Add API and gvproxy sockets to removal list - Cleanup related logic Signed-off-by: Jason T. Greene <jason.greene@redhat.com>
27 lines
954 B
Go
27 lines
954 B
Go
package shim
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/containers/podman/v5/pkg/machine"
|
|
"github.com/containers/podman/v5/pkg/machine/define"
|
|
"github.com/containers/podman/v5/pkg/machine/env"
|
|
"github.com/containers/podman/v5/pkg/machine/vmconfigs"
|
|
)
|
|
|
|
func setupMachineSockets(mc *vmconfigs.MachineConfig, dirs *define.MachineDirs) ([]string, string, machine.APIForwardingState, error) {
|
|
machinePipe := env.WithPodmanPrefix(mc.Name)
|
|
if !machine.PipeNameAvailable(machinePipe, machine.MachineNameWait) {
|
|
return nil, "", 0, fmt.Errorf("could not start api proxy since expected pipe is not available: %s", machinePipe)
|
|
}
|
|
sockets := []string{machine.NamedPipePrefix + machinePipe}
|
|
state := machine.MachineLocal
|
|
|
|
if machine.PipeNameAvailable(machine.GlobalNamedPipe, machine.GlobalNameWait) {
|
|
sockets = append(sockets, machine.NamedPipePrefix+machine.GlobalNamedPipe)
|
|
state = machine.DockerGlobal
|
|
}
|
|
|
|
return sockets, sockets[len(sockets)-1], state, nil
|
|
}
|