mirror of
https://github.com/containers/podman.git
synced 2025-06-20 17:13:43 +08:00
Merge pull request #13655 from n1hility/dual-pipes
Prefer registering both machine and global pipe on Win
This commit is contained in:
@ -145,6 +145,8 @@ http://docs.microsoft.com/en-us/windows/wsl/install\
|
|||||||
const (
|
const (
|
||||||
winSShProxy = "win-sshproxy.exe"
|
winSShProxy = "win-sshproxy.exe"
|
||||||
winSshProxyTid = "win-sshproxy.tid"
|
winSshProxyTid = "win-sshproxy.tid"
|
||||||
|
pipePrefix = "npipe:////./pipe/"
|
||||||
|
globalPipe = "docker_engine"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Provider struct{}
|
type Provider struct{}
|
||||||
@ -801,16 +803,15 @@ func (v *MachineVM) Start(name string, _ machine.StartOptions) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func launchWinProxy(v *MachineVM) (bool, string, error) {
|
func launchWinProxy(v *MachineVM) (bool, string, error) {
|
||||||
globalName := true
|
machinePipe := toDist(v.Name)
|
||||||
pipeName := "docker_engine"
|
if !pipeAvailable(machinePipe) {
|
||||||
if !pipeAvailable(pipeName) {
|
return false, "", errors.Errorf("could not start api proxy since expected pipe is not available: %s", machinePipe)
|
||||||
pipeName = toDist(v.Name)
|
|
||||||
globalName = false
|
|
||||||
if !pipeAvailable(pipeName) {
|
|
||||||
return globalName, "", errors.Errorf("could not start api proxy since expected pipe is not available: %s", pipeName)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
globalName := false
|
||||||
|
if pipeAvailable(globalPipe) {
|
||||||
|
globalName = true
|
||||||
}
|
}
|
||||||
fullPipeName := "npipe:////./pipe/" + pipeName
|
|
||||||
|
|
||||||
exe, err := os.Executable()
|
exe, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -829,12 +830,19 @@ func launchWinProxy(v *MachineVM) (bool, string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dest := fmt.Sprintf("ssh://root@localhost:%d/run/podman/podman.sock", v.Port)
|
dest := fmt.Sprintf("ssh://root@localhost:%d/run/podman/podman.sock", v.Port)
|
||||||
cmd := exec.Command(command, v.Name, stateDir, fullPipeName, dest, v.IdentityPath)
|
args := []string{v.Name, stateDir, pipePrefix + machinePipe, dest, v.IdentityPath}
|
||||||
|
waitPipe := machinePipe
|
||||||
|
if globalName {
|
||||||
|
args = append(args, pipePrefix+globalPipe, dest, v.IdentityPath)
|
||||||
|
waitPipe = globalPipe
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd := exec.Command(command, args...)
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
return globalName, "", err
|
return globalName, "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return globalName, fullPipeName, waitPipeExists(pipeName, 30, func() error {
|
return globalName, pipePrefix + waitPipe, waitPipeExists(waitPipe, 30, func() error {
|
||||||
active, exitCode := getProcessState(cmd.Process.Pid)
|
active, exitCode := getProcessState(cmd.Process.Pid)
|
||||||
if !active {
|
if !active {
|
||||||
return errors.Errorf("win-sshproxy.exe failed to start, exit code: %d (see windows event logs)", exitCode)
|
return errors.Errorf("win-sshproxy.exe failed to start, exit code: %d (see windows event logs)", exitCode)
|
||||||
|
Reference in New Issue
Block a user