Remove ImageVolumes from database
Before Libpod supported named volumes, we approximated image volumes by bind-mounting in per-container temporary directories. This was handled by Libpod, and had a corresponding database entry to enable/disable it. However, when we enabled named volumes, we completely rewrote the old implementation; none of the old bind mount implementation still exists, save one flag in the database. With nothing remaining to use it, it has no further purpose. Signed-off-by: Matthew Heon <mheon@redhat.com>
This commit is contained in:
parent
4f5b40598f
commit
e3a549b7b1
|
@ -23,7 +23,6 @@ func getTestContainer(id, name string, manager lock.Manager) (*Container, error)
|
||||||
Name: name,
|
Name: name,
|
||||||
RootfsImageID: id,
|
RootfsImageID: id,
|
||||||
RootfsImageName: "testimg",
|
RootfsImageName: "testimg",
|
||||||
ImageVolumes: true,
|
|
||||||
StaticDir: "/does/not/exist/",
|
StaticDir: "/does/not/exist/",
|
||||||
LogPath: "/does/not/exist/",
|
LogPath: "/does/not/exist/",
|
||||||
Stdin: true,
|
Stdin: true,
|
||||||
|
|
|
@ -249,8 +249,6 @@ type ContainerConfig struct {
|
||||||
RootfsImageName string `json:"rootfsImageName,omitempty"`
|
RootfsImageName string `json:"rootfsImageName,omitempty"`
|
||||||
// Rootfs to use for the container, this conflicts with RootfsImageID
|
// Rootfs to use for the container, this conflicts with RootfsImageID
|
||||||
Rootfs string `json:"rootfs,omitempty"`
|
Rootfs string `json:"rootfs,omitempty"`
|
||||||
// Whether to mount volumes specified in the image.
|
|
||||||
ImageVolumes bool `json:"imageVolumes"`
|
|
||||||
// Src path to be mounted on /dev/shm in container.
|
// Src path to be mounted on /dev/shm in container.
|
||||||
ShmDir string `json:"ShmDir,omitempty"`
|
ShmDir string `json:"ShmDir,omitempty"`
|
||||||
// Size of the container's SHM.
|
// Size of the container's SHM.
|
||||||
|
@ -510,12 +508,6 @@ func (c *Container) Image() (string, string) {
|
||||||
return c.config.RootfsImageID, c.config.RootfsImageName
|
return c.config.RootfsImageID, c.config.RootfsImageName
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImageVolumes returns whether the container is configured to create
|
|
||||||
// persistent volumes requested by the image
|
|
||||||
func (c *Container) ImageVolumes() bool {
|
|
||||||
return c.config.ImageVolumes
|
|
||||||
}
|
|
||||||
|
|
||||||
// ShmDir returns the sources path to be mounted on /dev/shm in container
|
// ShmDir returns the sources path to be mounted on /dev/shm in container
|
||||||
func (c *Container) ShmDir() string {
|
func (c *Container) ShmDir() string {
|
||||||
return c.config.ShmDir
|
return c.config.ShmDir
|
||||||
|
|
|
@ -593,7 +593,7 @@ func WithUser(user string) CtrCreateOption {
|
||||||
// other configuration from the image will be added to the config.
|
// other configuration from the image will be added to the config.
|
||||||
// TODO: Replace image name and ID with a libpod.Image struct when that is
|
// TODO: Replace image name and ID with a libpod.Image struct when that is
|
||||||
// finished.
|
// finished.
|
||||||
func WithRootFSFromImage(imageID string, imageName string, useImageVolumes bool) CtrCreateOption {
|
func WithRootFSFromImage(imageID string, imageName string) CtrCreateOption {
|
||||||
return func(ctr *Container) error {
|
return func(ctr *Container) error {
|
||||||
if ctr.valid {
|
if ctr.valid {
|
||||||
return define.ErrCtrFinalized
|
return define.ErrCtrFinalized
|
||||||
|
@ -608,7 +608,6 @@ func WithRootFSFromImage(imageID string, imageName string, useImageVolumes bool)
|
||||||
|
|
||||||
ctr.config.RootfsImageID = imageID
|
ctr.config.RootfsImageID = imageID
|
||||||
ctr.config.RootfsImageName = imageName
|
ctr.config.RootfsImageName = imageName
|
||||||
ctr.config.ImageVolumes = useImageVolumes
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, imgID
|
||||||
|
|
||||||
containerName := p.ID()[:IDTruncLength] + "-infra"
|
containerName := p.ID()[:IDTruncLength] + "-infra"
|
||||||
options = append(options, r.WithPod(p))
|
options = append(options, r.WithPod(p))
|
||||||
options = append(options, WithRootFSFromImage(imgID, imgName, false))
|
options = append(options, WithRootFSFromImage(imgID, imgName))
|
||||||
options = append(options, WithName(containerName))
|
options = append(options, WithName(containerName))
|
||||||
options = append(options, withIsInfra())
|
options = append(options, withIsInfra())
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
package libpod
|
package libpod
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/stretchr/testify/assert"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRemoveScientificNotationFromFloat(t *testing.T) {
|
func TestRemoveScientificNotationFromFloat(t *testing.T) {
|
||||||
|
|
|
@ -341,9 +341,8 @@ func (c *CreateConfig) getContainerCreateOptions(runtime *libpod.Runtime, pod *l
|
||||||
}
|
}
|
||||||
options = append(options, nsOpts...)
|
options = append(options, nsOpts...)
|
||||||
|
|
||||||
useImageVolumes := c.ImageVolumeType == TypeBind
|
|
||||||
// Gather up the options for NewContainer which consist of With... funcs
|
// Gather up the options for NewContainer which consist of With... funcs
|
||||||
options = append(options, libpod.WithRootFSFromImage(c.ImageID, c.Image, useImageVolumes))
|
options = append(options, libpod.WithRootFSFromImage(c.ImageID, c.Image))
|
||||||
options = append(options, libpod.WithConmonPidFile(c.ConmonPidFile))
|
options = append(options, libpod.WithConmonPidFile(c.ConmonPidFile))
|
||||||
options = append(options, libpod.WithLabels(c.Labels))
|
options = append(options, libpod.WithLabels(c.Labels))
|
||||||
options = append(options, libpod.WithShmSize(c.Resources.ShmSize))
|
options = append(options, libpod.WithShmSize(c.Resources.ShmSize))
|
||||||
|
|
|
@ -36,9 +36,7 @@ func (s *SpecGenerator) MakeContainer(rt *libpod.Runtime) (*libpod.Container, er
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO mheon wants to talk with Dan about this
|
options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image))
|
||||||
useImageVolumes := s.ImageVolumeMode == "bind"
|
|
||||||
options = append(options, libpod.WithRootFSFromImage(newImage.ID(), s.Image, useImageVolumes))
|
|
||||||
|
|
||||||
runtimeSpec, err := s.toOCISpec(rt, newImage)
|
runtimeSpec, err := s.toOCISpec(rt, newImage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue