summaryrefslogtreecommitdiff
path: root/pkg/machine/qemu/machine.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-04-02 14:32:08 +0200
committerGitHub <noreply@github.com>2021-04-02 14:32:08 +0200
commit3ae42358e13a25abdb1caa65c529e8171804095c (patch)
tree8ae54ed3d0ce034b1d3a9ba011a6239542735308 /pkg/machine/qemu/machine.go
parent203e464f93e2ca7054b58e2aabc13afa6dec4a8c (diff)
parentf8bc391e349f8e67ad35c802be4c99dc3eabe4a2 (diff)
downloadpodman-3ae42358e13a25abdb1caa65c529e8171804095c.tar.gz
podman-3ae42358e13a25abdb1caa65c529e8171804095c.tar.bz2
podman-3ae42358e13a25abdb1caa65c529e8171804095c.zip
Merge pull request #9920 from ashley-cui/rooty
[NO TESTS NEEDED] Add ssh connection to root user
Diffstat (limited to 'pkg/machine/qemu/machine.go')
-rw-r--r--pkg/machine/qemu/machine.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkg/machine/qemu/machine.go b/pkg/machine/qemu/machine.go
index 2652ebc10..fd22f465b 100644
--- a/pkg/machine/qemu/machine.go
+++ b/pkg/machine/qemu/machine.go
@@ -168,6 +168,11 @@ func (v *MachineVM) Init(opts machine.InitOptions) error {
if err := machine.AddConnection(&uri, v.Name, filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {
return err
}
+
+ uriRoot := machine.SSHRemoteConnection.MakeSSHURL("localhost", "/run/podman/podman.sock", strconv.Itoa(v.Port), "root")
+ if err := machine.AddConnection(&uriRoot, v.Name+"-root", filepath.Join(sshDir, v.Name), opts.IsDefault); err != nil {
+ return err
+ }
} else {
fmt.Println("An ignition path was provided. No SSH connection was added to Podman")
}
@@ -357,6 +362,10 @@ func (v *MachineVM) Remove(name string, opts machine.RemoveOptions) (string, fun
if err := machine.RemoveConnection(v.Name); err != nil {
logrus.Error(err)
}
+ if err := machine.RemoveConnection(v.Name + "-root"); err != nil {
+ logrus.Error(err)
+ }
+
vmConfigDir, err := machine.GetConfDir(vmtype)
if err != nil {
return "", nil, err