summaryrefslogtreecommitdiff
path: root/pkg/util/utils.go
diff options
context:
space:
mode:
authorEduardo Vega <edvegavalerio@gmail.com>2021-01-05 19:50:58 -0600
committerEduardo Vega <edvegavalerio@gmail.com>2021-02-22 22:55:19 -0600
commit874f2327e6ca963edda7cc46819d51048d3d19a8 (patch)
tree2b138dda345970e5898593162c38e10d4909fabd /pkg/util/utils.go
parent96fc9d983e0fc5bae48c3cec3acce86cdb6e1059 (diff)
downloadpodman-874f2327e6ca963edda7cc46819d51048d3d19a8.tar.gz
podman-874f2327e6ca963edda7cc46819d51048d3d19a8.tar.bz2
podman-874f2327e6ca963edda7cc46819d51048d3d19a8.zip
Add U volume flag to chown source volumes
Signed-off-by: Eduardo Vega <edvegavalerio@gmail.com>
Diffstat (limited to 'pkg/util/utils.go')
-rw-r--r--pkg/util/utils.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/util/utils.go b/pkg/util/utils.go
index c6ecd91f6..a4c8f3a64 100644
--- a/pkg/util/utils.go
+++ b/pkg/util/utils.go
@@ -23,6 +23,7 @@ import (
"github.com/containers/storage"
"github.com/containers/storage/pkg/idtools"
v1 "github.com/opencontainers/image-spec/specs-go/v1"
+ "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh/terminal"
@@ -692,3 +693,16 @@ func CoresToPeriodAndQuota(cores float64) (uint64, int64) {
func PeriodAndQuotaToCores(period uint64, quota int64) float64 {
return float64(quota) / float64(period)
}
+
+// IDtoolsToRuntimeSpec converts idtools ID mapping to the one of the runtime spec.
+func IDtoolsToRuntimeSpec(idMaps []idtools.IDMap) (convertedIDMap []specs.LinuxIDMapping) {
+ for _, idmap := range idMaps {
+ tempIDMap := specs.LinuxIDMapping{
+ ContainerID: uint32(idmap.ContainerID),
+ HostID: uint32(idmap.HostID),
+ Size: uint32(idmap.Size),
+ }
+ convertedIDMap = append(convertedIDMap, tempIDMap)
+ }
+ return convertedIDMap
+}