mirror of
https://github.com/containers/podman.git
synced 2025-08-06 19:44:14 +08:00

podman machine with Microsoft HyperV will use hvsock on the guest and vsock on the guest for its networking. this pr enables the basics for this to happen as well as changes to ignition to automatically set this up with network manager. the vm binary referenced in this pr is in containers/gvisor-tap-vsock and will need to be added to distributions. [NO NEW TESTS NEEDED] Signed-off-by: Brent Baude <bbaude@redhat.com>
35 lines
851 B
Go
35 lines
851 B
Go
package machine
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"strconv"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// CommonSSH is a common function for ssh'ing to a podman machine using system-connections
|
|
// and a port
|
|
func CommonSSH(username, identityPath, name string, sshPort int, inputArgs []string) error {
|
|
sshDestination := username + "@localhost"
|
|
port := strconv.Itoa(sshPort)
|
|
|
|
args := []string{"-i", identityPath, "-p", port, sshDestination,
|
|
"-o", "StrictHostKeyChecking=no", "-o", "LogLevel=ERROR", "-o", "SetEnv=LC_ALL="}
|
|
if len(inputArgs) > 0 {
|
|
args = append(args, inputArgs...)
|
|
} else {
|
|
fmt.Printf("Connecting to vm %s. To close connection, use `~.` or `exit`\n", name)
|
|
}
|
|
|
|
cmd := exec.Command("ssh", args...)
|
|
logrus.Debugf("Executing: ssh %v\n", args)
|
|
|
|
cmd.Stdout = os.Stdout
|
|
cmd.Stderr = os.Stderr
|
|
cmd.Stdin = os.Stdin
|
|
|
|
return cmd.Run()
|
|
}
|