summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container_internal.go14
-rw-r--r--libpod/define/volume_inspect.go8
-rw-r--r--libpod/kube.go2
-rw-r--r--libpod/options.go63
-rw-r--r--libpod/volume_inspect.go3
5 files changed, 19 insertions, 71 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index 33bb35a0b..12d6d5a18 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -1691,13 +1691,6 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
if vol.state.NeedsCopyUp {
logrus.Debugf("Copying up contents from container %s to volume %s", c.ID(), vol.Name())
- // Set NeedsCopyUp to false immediately, so we don't try this
- // again when there are already files copied.
- vol.state.NeedsCopyUp = false
- if err := vol.save(); err != nil {
- return nil, err
- }
-
// If the volume is not empty, we should not copy up.
volMount := vol.mountPoint()
contents, err := ioutil.ReadDir(volMount)
@@ -1744,6 +1737,13 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
return vol, nil
}
+ // Set NeedsCopyUp to false since we are about to do first copy
+ // Do not copy second time.
+ vol.state.NeedsCopyUp = false
+ if err := vol.save(); err != nil {
+ return nil, err
+ }
+
// Buildah Copier accepts a reader, so we'll need a pipe.
reader, writer := io.Pipe()
defer reader.Close()
diff --git a/libpod/define/volume_inspect.go b/libpod/define/volume_inspect.go
index 20602ea16..fac179176 100644
--- a/libpod/define/volume_inspect.go
+++ b/libpod/define/volume_inspect.go
@@ -48,4 +48,12 @@ type InspectVolumeData struct {
// volume for a specific container, and will be be removed when any
// container using it is removed.
Anonymous bool `json:"Anonymous,omitempty"`
+ // MountCount is the number of times this volume has been mounted.
+ MountCount uint `json:"MountCount"`
+ // NeedsCopyUp indicates that the next time the volume is mounted into
+ NeedsCopyUp bool `json:"NeedsCopyUp,omitempty"`
+ // NeedsChown indicates that the next time the volume is mounted into
+ // a container, the container will chown the volume to the container process
+ // UID/GID.
+ NeedsChown bool `json:"NeedsChown,omitempty"`
}
diff --git a/libpod/kube.go b/libpod/kube.go
index d667616d0..f465fc776 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -595,7 +595,7 @@ func containerToV1Container(ctx context.Context, c *Container) (v1.Container, []
// pause one and make sure it's in the storage by pulling it down if
// missing.
if image == "" && c.IsInfra() {
- image = config.DefaultInfraImage
+ image = c.runtime.config.Engine.InfraImage
if _, err := c.runtime.libimageRuntime.Pull(ctx, image, config.PullPolicyMissing, nil); err != nil {
return kubeContainer, nil, nil, nil, err
}
diff --git a/libpod/options.go b/libpod/options.go
index 6edb9972b..44505da26 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -115,19 +115,6 @@ func WithStorageConfig(config storage.StoreOptions) RuntimeOption {
}
}
-// WithDefaultTransport sets the default transport for retrieving images.
-func WithDefaultTransport(defaultTransport string) RuntimeOption {
- return func(rt *Runtime) error {
- if rt.valid {
- return define.ErrRuntimeFinalized
- }
-
- rt.config.Engine.ImageDefaultTransport = defaultTransport
-
- return nil
- }
-}
-
// WithSignaturePolicy specifies the path of a file which decides how trust is
// managed for images we've pulled.
// If this is not specified, the system default configuration will be used
@@ -144,26 +131,6 @@ func WithSignaturePolicy(path string) RuntimeOption {
}
}
-// WithStateType sets the backing state implementation for libpod.
-// Please note that information is not portable between backing states.
-// As such, if this differs between two libpods running on the same system,
-// they will not share containers, and unspecified behavior may occur.
-func WithStateType(storeType config.RuntimeStateStore) RuntimeOption {
- return func(rt *Runtime) error {
- if rt.valid {
- return define.ErrRuntimeFinalized
- }
-
- if storeType == config.InvalidStateStore {
- return errors.Wrapf(define.ErrInvalidArg, "must provide a valid state store type")
- }
-
- rt.config.Engine.StateType = storeType
-
- return nil
- }
-}
-
// WithOCIRuntime specifies an OCI runtime to use for running containers.
func WithOCIRuntime(runtime string) RuntimeOption {
return func(rt *Runtime) error {
@@ -452,23 +419,6 @@ func WithVolumePath(volPath string) RuntimeOption {
}
}
-// WithDefaultInfraImage sets the infra image for libpod.
-// An infra image is used for inter-container kernel
-// namespace sharing within a pod. Typically, an infra
-// container is lightweight and is there to reap
-// zombie processes within its pid namespace.
-func WithDefaultInfraImage(img string) RuntimeOption {
- return func(rt *Runtime) error {
- if rt.valid {
- return define.ErrRuntimeFinalized
- }
-
- rt.config.Engine.InfraImage = img
-
- return nil
- }
-}
-
// WithDefaultInfraCommand sets the command to
// run on pause container start up.
func WithDefaultInfraCommand(cmd string) RuntimeOption {
@@ -483,19 +433,6 @@ func WithDefaultInfraCommand(cmd string) RuntimeOption {
}
}
-// WithDefaultInfraName sets the infra container name for a single pod.
-func WithDefaultInfraName(name string) RuntimeOption {
- return func(rt *Runtime) error {
- if rt.valid {
- return define.ErrRuntimeFinalized
- }
-
- rt.config.Engine.InfraImage = name
-
- return nil
- }
-}
-
// WithRenumber instructs libpod to perform a lock renumbering while
// initializing. This will handle migrations from early versions of libpod with
// file locks to newer versions with SHM locking, as well as changes in the
diff --git a/libpod/volume_inspect.go b/libpod/volume_inspect.go
index c3f51222d..70098df5a 100644
--- a/libpod/volume_inspect.go
+++ b/libpod/volume_inspect.go
@@ -60,6 +60,9 @@ func (v *Volume) Inspect() (*define.InspectVolumeData, error) {
data.UID = v.uid()
data.GID = v.gid()
data.Anonymous = v.config.IsAnon
+ data.MountCount = v.state.MountCount
+ data.NeedsCopyUp = v.state.NeedsCopyUp
+ data.NeedsChown = v.state.NeedsChown
return data, nil
}