Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman: Add pasta to podman info #18640

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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