aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-10-22 14:18:45 +0000
committerGitHub <noreply@github.com>2021-10-22 14:18:45 +0000
commit5dd211f91b4dfe736056551b2804edb6f978a659 (patch)
treeb8e2512dfed285281200887799ab796d1d6eee12 /libpod
parent833d92d7092c86cd8c31a72423634fb8b8cfad9a (diff)
parent087f8fc73bec664a30dcf0757cd3cb44ea150582 (diff)
downloadpodman-5dd211f91b4dfe736056551b2804edb6f978a659.tar.gz
podman-5dd211f91b4dfe736056551b2804edb6f978a659.tar.bz2
podman-5dd211f91b4dfe736056551b2804edb6f978a659.zip
Merge pull request #11991 from rhatdan/size
Allow API to specify size and inode quota
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_config.go2
-rw-r--r--libpod/container_internal.go12
-rw-r--r--libpod/options.go11
3 files changed, 25 insertions, 0 deletions
diff --git a/libpod/container_config.go b/libpod/container_config.go
index 54d102a71..33ea731fd 100644
--- a/libpod/container_config.go
+++ b/libpod/container_config.go
@@ -153,6 +153,8 @@ type ContainerRootFSConfig struct {
Secrets []*ContainerSecret `json:"secrets,omitempty"`
// SecretPath is the secrets location in storage
SecretsPath string `json:"secretsPath"`
+ // StorageOpts to be used when creating rootfs
+ StorageOpts map[string]string `json:"storageOpts"`
// Volatile specifies whether the container storage can be optimized
// at the cost of not syncing all the dirty files in memory.
Volatile bool `json:"volatile,omitempty"`
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 43f5398a2..994ffeec7 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -445,6 +445,18 @@ func (c *Container) setupStorage(ctx context.Context) error {
},
LabelOpts: c.config.LabelOpts,
}
+
+ nopts := len(c.config.StorageOpts)
+ if nopts > 0 {
+ options.StorageOpt = make(map[string]string, nopts)
+ for _, opt := range c.config.StorageOpts {
+ split2 := strings.SplitN(opt, "=", 2)
+ if len(split2) > 2 {
+ return errors.Wrapf(define.ErrInvalidArg, "invalid storage options %q for %s", opt, c.ID())
+ }
+ options.StorageOpt[split2[0]] = split2[1]
+ }
+ }
if c.restoreFromCheckpoint && !c.config.Privileged {
// If restoring from a checkpoint, the root file-system
// needs to be mounted with the same SELinux labels as
diff --git a/libpod/options.go b/libpod/options.go
index 553af43fd..9762de67e 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -310,6 +310,17 @@ func WithCDI(devices []string) CtrCreateOption {
}
}
+// WithStorageOpts sets the devices to check for for CDI configuration.
+func WithStorageOpts(storageOpts map[string]string) CtrCreateOption {
+ return func(ctr *Container) error {
+ if ctr.valid {
+ return define.ErrCtrFinalized
+ }
+ ctr.config.StorageOpts = storageOpts
+ return nil
+ }
+}
+
// WithDefaultMountsFile sets the file to look at for default mounts (mainly
// secrets).
// Note we are not saving this in the database as it is for testing purposes