mirror of
https://github.com/containers/podman.git
synced 2025-08-03 01:37:51 +08:00
network: support ns: prefix to join existing namespace
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com> Closes: #1145 Approved by: rhatdan
This commit is contained in:

committed by
Atomic Bot

parent
6f65490e27
commit
41c7e43b4d
@ -18,6 +18,21 @@ func (w *weightDevice) String() string {
|
||||
return fmt.Sprintf("%s:%d", w.path, w.weight)
|
||||
}
|
||||
|
||||
// IsNS returns if the specified string has a ns: prefix
|
||||
func IsNS(s string) bool {
|
||||
parts := strings.SplitN(s, ":", 2)
|
||||
return len(parts) > 1 && parts[0] == "ns"
|
||||
}
|
||||
|
||||
// NS is the path to the namespace to join.
|
||||
func NS(s string) string {
|
||||
parts := strings.SplitN(s, ":", 2)
|
||||
if len(parts) > 1 {
|
||||
return parts[1]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// validateweightDevice validates that the specified string has a valid device-weight format
|
||||
// for blkio-weight-device flag
|
||||
func validateweightDevice(val string) (*weightDevice, error) {
|
||||
|
Reference in New Issue
Block a user