Skip to content

Commit

Permalink
podman: Add pasta to podman info
Browse files Browse the repository at this point in the history
[NO NEW TESTS NEEDED]

Fixes: #18561

Signed-off-by: binghongtao <[email protected]>
  • Loading branch information
HirazawaUi committed May 24, 2023
1 parent 44807ea commit 977b3cd
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
14 changes: 14 additions & 0 deletions docs/source/markdown/podman-info.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ host:
spec: 1.0.0
+SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +YAJL
os: linux
pasta:
executable: /usr/bin/passt
package: passt-0^20221116.gace074c-1.fc34.x86_64
version: |
passt 0^20221116.gace074c-1.fc34.x86_64
Copyright Red Hat
GNU Affero GPL version 3 or later <https://www.gnu.org/licenses/agpl-3.0.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
remoteSocket:
path: /run/user/3267/podman/podman.sock
security:
Expand Down Expand Up @@ -235,6 +244,11 @@ $ podman info --format json
"package": "slirp4netns-1.1.12-2.fc34.x86_64",
"version": "slirp4netns version 1.1.12\ncommit: 7a104a101aa3278a2152351a082a6df71f57c9a3\nlibslirp: 4.4.0\nSLIRP_CONFIG_VERSION_MAX: 3\nlibseccomp: 2.5.0"
},
"pasta": {
"executable": "/usr/bin/passt",
"package": "passt-0^20221116.gace074c-1.fc34.x86_64",
"version": "passt 0^20221116.gace074c-1.fc34.x86_64\nCopyright Red Hat\nGNU Affero GPL version 3 or later \u003chttps://www.gnu.org/licenses/agpl-3.0.html\u003e\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\n"
},
"swapFree": 15687475200,
"swapTotal": 16886259712,
"uptime": "47h 17m 29.75s (Approximately 1.96 days)",
Expand Down
17 changes: 13 additions & 4 deletions libpod/define/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ type HostInfo struct {
ServiceIsRemote bool `json:"serviceIsRemote"`
Security SecurityInfo `json:"security"`
Slirp4NetNS SlirpInfo `json:"slirp4netns,omitempty"`
SwapFree int64 `json:"swapFree"`
SwapTotal int64 `json:"swapTotal"`
Uptime string `json:"uptime"`
Linkmode string `json:"linkmode"`
Pasta PastaInfo `json:"pasta,omitempty"`

SwapFree int64 `json:"swapFree"`
SwapTotal int64 `json:"swapTotal"`
Uptime string `json:"uptime"`
Linkmode string `json:"linkmode"`
}

// RemoteSocket describes information about the API socket
Expand All @@ -73,6 +75,13 @@ type SlirpInfo struct {
Version string `json:"version"`
}

// PastaInfo describes the pasta executable that is being used
type PastaInfo struct {
Executable string `json:"executable"`
Package string `json:"package"`
Version string `json:"version"`
}

// IDMappings describe the GID and UID mappings
type IDMappings struct {
GIDMap []idtools.IDMap `json:"gidmap"`
Expand Down
14 changes: 14 additions & 0 deletions libpod/info_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,20 @@ func (r *Runtime) setPlatformHostInfo(info *define.HostInfo) error {
info.Slirp4NetNS = program
}

pastaPath, _ := r.config.FindHelperBinary(pastaBinaryName, true)
if pastaPath != "" {
version, err := programVersion(pastaPath)
if err != nil {
logrus.Warnf("Failed to retrieve program version for %s: %v", pastaPath, err)
}
program := define.PastaInfo{
Executable: pastaPath,
Package: packageVersion(pastaPath),
Version: version,
}
info.Pasta = program
}

if rootless.IsRootless() {
uidmappings, err := rootless.ReadMappingsProc("/proc/self/uid_map")
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions libpod/networking_pasta_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import (
"github.com/sirupsen/logrus"
)

const (
pastaBinaryName = "passt"
)

func (r *Runtime) setupPasta(ctr *Container, netns string) error {
var NoTCPInitPorts = true
var NoUDPInitPorts = true
Expand Down
1 change: 1 addition & 0 deletions test/system/005-info.bats
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ host.conmon.package | .*conmon.*
host.cgroupManager | \\\(systemd\\\|cgroupfs\\\)
host.cgroupVersion | v[12]
host.ociRuntime.path | $expr_path
host.pasta | .*executable.*package.*
store.configFile | $expr_path
store.graphDriverName | [a-z0-9]\\\+\\\$
store.graphRoot | $expr_path
Expand Down

0 comments on commit 977b3cd

Please sign in to comment.