summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/boltdb_state.go9
-rw-r--r--libpod/container.go1
-rw-r--r--libpod/container_exec.go2
-rw-r--r--libpod/container_inspect.go5
-rw-r--r--libpod/container_internal.go77
-rw-r--r--libpod/container_internal_linux.go24
-rw-r--r--libpod/container_path_resolution.go10
-rw-r--r--libpod/define/container_inspect.go4
-rw-r--r--libpod/events/events.go1
-rw-r--r--libpod/events/filters.go1
-rw-r--r--libpod/events/logfile.go1
-rw-r--r--libpod/healthcheck.go2
-rw-r--r--libpod/image/image.go1
-rw-r--r--libpod/image/image_test.go1
-rw-r--r--libpod/image/prune.go2
-rw-r--r--libpod/image/utils.go4
-rw-r--r--libpod/info.go6
-rw-r--r--libpod/network/create.go1
-rw-r--r--libpod/network/create_test.go1
-rw-r--r--libpod/network/netconflist_test.go1
-rw-r--r--libpod/networking_linux.go3
-rw-r--r--libpod/oci_conmon_linux.go2
-rw-r--r--libpod/oci_util.go1
-rw-r--r--libpod/options.go3
-rw-r--r--libpod/plugin/volume_api.go3
-rw-r--r--libpod/reset.go1
-rw-r--r--libpod/runtime.go5
-rw-r--r--libpod/runtime_ctr.go1
-rw-r--r--libpod/runtime_img.go3
-rw-r--r--libpod/runtime_img_test.go1
-rw-r--r--libpod/runtime_pod_infra_linux.go1
-rw-r--r--libpod/volume.go11
-rw-r--r--libpod/volume_internal_linux.go8
33 files changed, 89 insertions, 108 deletions
diff --git a/libpod/boltdb_state.go b/libpod/boltdb_state.go
index b2ee63b08..c9d214cd0 100644
--- a/libpod/boltdb_state.go
+++ b/libpod/boltdb_state.go
@@ -269,9 +269,9 @@ func (s *BoltState) Refresh() error {
if err != nil {
return err
}
- for _, execId := range toRemove {
- if err := ctrExecBkt.Delete([]byte(execId)); err != nil {
- return errors.Wrapf(err, "error removing exec session %s from container %s", execId, string(id))
+ for _, execID := range toRemove {
+ if err := ctrExecBkt.Delete([]byte(execID)); err != nil {
+ return errors.Wrapf(err, "error removing exec session %s from container %s", execID, string(id))
}
}
}
@@ -904,7 +904,6 @@ func (s *BoltState) ContainerInUse(ctr *Container) ([]string, error) {
}
return depCtrs, nil
-
}
// AllContainers retrieves all the containers in the database
@@ -962,7 +961,6 @@ func (s *BoltState) AllContainers() ([]*Container, error) {
}
return nil
-
})
})
if err != nil {
@@ -2580,7 +2578,6 @@ func (s *BoltState) LookupVolume(name string) (*Volume, error) {
}
return volume, nil
-
}
// HasVolume returns true if the given volume exists in the state, otherwise it returns false
diff --git a/libpod/container.go b/libpod/container.go
index e667cd991..613a02554 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -1057,7 +1057,6 @@ func (c *Container) NetworkDisabled() (bool, error) {
return container.NetworkDisabled()
}
return networkDisabled(c)
-
}
func networkDisabled(c *Container) (bool, error) {
diff --git a/libpod/container_exec.go b/libpod/container_exec.go
index 5aee847e1..0d18b55ca 100644
--- a/libpod/container_exec.go
+++ b/libpod/container_exec.go
@@ -78,9 +78,11 @@ type ExecConfig struct {
type ExecSession struct {
// Id is the ID of the exec session.
// Named somewhat strangely to not conflict with ID().
+ // nolint:stylecheck,golint
Id string `json:"id"`
// ContainerId is the ID of the container this exec session belongs to.
// Named somewhat strangely to not conflict with ContainerID().
+ // nolint:stylecheck,golint
ContainerId string `json:"containerId"`
// State is the state of the exec session.
diff --git a/libpod/container_inspect.go b/libpod/container_inspect.go
index f50c7dbfe..e87e26c61 100644
--- a/libpod/container_inspect.go
+++ b/libpod/container_inspect.go
@@ -796,7 +796,6 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
if c.config.UTSNsCtr != "" {
utsMode = fmt.Sprintf("container:%s", c.config.UTSNsCtr)
} else if ctrSpec.Linux != nil {
-
// Locate the spec's UTS namespace.
// If there is none, it's uts=host.
// If there is one and it has a path, it's "ns:".
@@ -871,8 +870,8 @@ func (c *Container) generateInspectContainerHostConfig(ctrSpec *spec.Spec, named
for _, limit := range ctrSpec.Process.Rlimits {
newLimit := define.InspectUlimit{}
newLimit.Name = limit.Type
- newLimit.Soft = limit.Soft
- newLimit.Hard = limit.Hard
+ newLimit.Soft = int64(limit.Soft)
+ newLimit.Hard = int64(limit.Hard)
hostConfig.Ulimits = append(hostConfig.Ulimits, newLimit)
}
}
diff --git a/libpod/container_internal.go b/libpod/container_internal.go
index b280e79d1..ced357096 100644
--- a/libpod/container_internal.go
+++ b/libpod/container_internal.go
@@ -13,6 +13,7 @@ import (
"strings"
"time"
+ "github.com/containers/buildah/copier"
"github.com/containers/common/pkg/secrets"
"github.com/containers/podman/v2/libpod/define"
"github.com/containers/podman/v2/libpod/events"
@@ -265,7 +266,7 @@ func (c *Container) handleRestartPolicy(ctx context.Context) (_ bool, retErr err
c.newContainerEvent(events.Restart)
// Increment restart count
- c.state.RestartCount += 1
+ c.state.RestartCount++
logrus.Debugf("Container %s now on retry %d", c.ID(), c.state.RestartCount)
if err := c.save(); err != nil {
return false, err
@@ -1582,18 +1583,8 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
return nil, err
}
- // HACK HACK HACK - copy up into a volume driver is 100% broken
- // right now.
- if vol.UsesVolumeDriver() {
- logrus.Infof("Not copying up into volume %s as it uses a volume driver", vol.Name())
- return vol, nil
- }
-
// If the volume is not empty, we should not copy up.
- volMount, err := vol.MountPoint()
- if err != nil {
- return nil, err
- }
+ volMount := vol.mountPoint()
contents, err := ioutil.ReadDir(volMount)
if err != nil {
return nil, errors.Wrapf(err, "error listing contents of volume %s mountpoint when copying up from container %s", vol.Name(), c.ID())
@@ -1609,8 +1600,55 @@ func (c *Container) mountNamedVolume(v *ContainerNamedVolume, mountpoint string)
if err != nil {
return nil, errors.Wrapf(err, "error calculating destination path to copy up container %s volume %s", c.ID(), vol.Name())
}
- if err := c.copyWithTarFromImage(srcDir, volMount); err != nil && !os.IsNotExist(err) {
- return nil, errors.Wrapf(err, "error copying content from container %s into volume %s", c.ID(), vol.Name())
+ // Do a manual stat on the source directory to verify existence.
+ // Skip the rest if it exists.
+ // TODO: Should this be stat or lstat? I'm using lstat because I
+ // think copy-up doesn't happen when the source is a link.
+ srcStat, err := os.Lstat(srcDir)
+ if err != nil {
+ if os.IsNotExist(err) {
+ // Source does not exist, don't bother copying
+ // up.
+ return vol, nil
+ }
+ return nil, errors.Wrapf(err, "error identifying source directory for copy up into volume %s", vol.Name())
+ }
+ // If it's not a directory we're mounting over it.
+ if !srcStat.IsDir() {
+ return vol, nil
+ }
+
+ // Buildah Copier accepts a reader, so we'll need a pipe.
+ reader, writer := io.Pipe()
+ defer reader.Close()
+
+ errChan := make(chan error, 1)
+
+ logrus.Infof("About to copy up into volume %s", vol.Name())
+
+ // Copy, container side: get a tar archive of what needs to be
+ // streamed into the volume.
+ go func() {
+ defer writer.Close()
+ getOptions := copier.GetOptions{
+ KeepDirectoryNames: false,
+ }
+ errChan <- copier.Get(mountpoint, "", getOptions, []string{v.Dest + "/."}, writer)
+ }()
+
+ // Copy, volume side: stream what we've written to the pipe, into
+ // the volume.
+ copyOpts := copier.PutOptions{}
+ if err := copier.Put(volMount, "", copyOpts, reader); err != nil {
+ err2 := <-errChan
+ if err2 != nil {
+ logrus.Errorf("Error streaming contents of container %s directory for volume copy-up: %v", c.ID(), err2)
+ }
+ return nil, errors.Wrapf(err, "error copying up to volume %s", vol.Name())
+ }
+
+ if err := <-errChan; err != nil {
+ return nil, errors.Wrapf(err, "error streaming container content for copy up into volume %s", vol.Name())
}
}
return vol, nil
@@ -2060,17 +2098,6 @@ func (c *Container) unmount(force bool) error {
return nil
}
-// this should be from chrootarchive.
-// Container MUST be mounted before calling.
-func (c *Container) copyWithTarFromImage(source, dest string) error {
- mappings := idtools.NewIDMappingsFromMaps(c.config.IDMappings.UIDMap, c.config.IDMappings.GIDMap)
- a := archive.NewArchiver(mappings)
- if err := c.copyOwnerAndPerms(source, dest); err != nil {
- return err
- }
- return a.CopyWithTar(source, dest)
-}
-
// checkReadyForRemoval checks whether the given container is ready to be
// removed.
// These checks are only used if force-remove is not specified.
diff --git a/libpod/container_internal_linux.go b/libpod/container_internal_linux.go
index 3583f8fdd..a3476f42e 100644
--- a/libpod/container_internal_linux.go
+++ b/libpod/container_internal_linux.go
@@ -521,14 +521,14 @@ func (c *Container) generateSpec(ctx context.Context) (*spec.Spec, error) {
}}
}
for _, gid := range execUser.Sgids {
- isGidAvailable := false
+ isGIDAvailable := false
for _, m := range gidMappings {
if gid >= m.ContainerID && gid < m.ContainerID+m.Size {
- isGidAvailable = true
+ isGIDAvailable = true
break
}
}
- if isGidAvailable {
+ if isGIDAvailable {
g.AddProcessAdditionalGid(uint32(gid))
} else {
logrus.Warnf("additional gid=%d is not present in the user namespace, skip setting it", gid)
@@ -1614,7 +1614,6 @@ func (c *Container) makeBindMounts() error {
return errors.Wrapf(err, "error setting timezone for container %s", c.ID())
}
c.state.BindMounts["/etc/localtime"] = localtimePath
-
}
}
@@ -2278,23 +2277,6 @@ func (c *Container) generatePasswdAndGroup() (string, string, error) {
return passwdPath, groupPath, nil
}
-func (c *Container) copyOwnerAndPerms(source, dest string) error {
- info, err := os.Stat(source)
- if err != nil {
- if os.IsNotExist(err) {
- return nil
- }
- return err
- }
- if err := os.Chmod(dest, info.Mode()); err != nil {
- return err
- }
- if err := os.Chown(dest, int(info.Sys().(*syscall.Stat_t).Uid), int(info.Sys().(*syscall.Stat_t).Gid)); err != nil {
- return err
- }
- return nil
-}
-
// Get cgroup path in a format suitable for the OCI spec
func (c *Container) getOCICgroupPath() (string, error) {
unified, err := cgroups.IsCgroup2UnifiedMode()
diff --git a/libpod/container_path_resolution.go b/libpod/container_path_resolution.go
index 805b3b947..5245314ae 100644
--- a/libpod/container_path_resolution.go
+++ b/libpod/container_path_resolution.go
@@ -18,7 +18,7 @@ import (
// mountPoint (e.g., via a mount or volume), the resolved root (e.g., container
// mount, bind mount or volume) and the resolved path on the root (absolute to
// the host).
-func (container *Container) resolvePath(mountPoint string, containerPath string) (string, string, error) {
+func (c *Container) resolvePath(mountPoint string, containerPath string) (string, string, error) {
// Let's first make sure we have a path relative to the mount point.
pathRelativeToContainerMountPoint := containerPath
if !filepath.IsAbs(containerPath) {
@@ -26,7 +26,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
// container's working dir. To be extra careful, let's first
// join the working dir with "/", and the add the containerPath
// to it.
- pathRelativeToContainerMountPoint = filepath.Join(filepath.Join("/", container.WorkingDir()), containerPath)
+ pathRelativeToContainerMountPoint = filepath.Join(filepath.Join("/", c.WorkingDir()), containerPath)
}
resolvedPathOnTheContainerMountPoint := filepath.Join(mountPoint, pathRelativeToContainerMountPoint)
pathRelativeToContainerMountPoint = strings.TrimPrefix(pathRelativeToContainerMountPoint, mountPoint)
@@ -43,7 +43,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
searchPath := pathRelativeToContainerMountPoint
for {
- volume, err := findVolume(container, searchPath)
+ volume, err := findVolume(c, searchPath)
if err != nil {
return "", "", err
}
@@ -74,7 +74,7 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
return mountPoint, absolutePathOnTheVolumeMount, nil
}
- if mount := findBindMount(container, searchPath); mount != nil {
+ if mount := findBindMount(c, searchPath); mount != nil {
logrus.Debugf("Container path %q resolved to bind mount %q:%q on path %q", containerPath, mount.Source, mount.Destination, searchPath)
// We found a matching bind mount for searchPath. We
// now need to first find the relative path of our
@@ -86,14 +86,12 @@ func (container *Container) resolvePath(mountPoint string, containerPath string)
return "", "", err
}
return mount.Source, absolutePathOnTheBindMount, nil
-
}
if searchPath == "/" {
// Cannot go beyond "/", so we're done.
break
}
-
// Walk *down* the path (e.g., "/foo/bar/x" -> "/foo/bar").
searchPath = filepath.Dir(searchPath)
}
diff --git a/libpod/define/container_inspect.go b/libpod/define/container_inspect.go
index 2cdd53cbc..0f355d20a 100644
--- a/libpod/define/container_inspect.go
+++ b/libpod/define/container_inspect.go
@@ -122,9 +122,9 @@ type InspectUlimit struct {
// Name is the name (type) of the ulimit.
Name string `json:"Name"`
// Soft is the soft limit that will be applied.
- Soft uint64 `json:"Soft"`
+ Soft int64 `json:"Soft"`
// Hard is the hard limit that will be applied.
- Hard uint64 `json:"Hard"`
+ Hard int64 `json:"Hard"`
}
// InspectDevice is a single device that will be mounted into the container.
diff --git a/libpod/events/events.go b/libpod/events/events.go
index aa0401b62..01ea6a386 100644
--- a/libpod/events/events.go
+++ b/libpod/events/events.go
@@ -97,7 +97,6 @@ func newEventFromJSONString(event string) (*Event, error) {
return nil, err
}
return &e, nil
-
}
// ToString converts a Type to a string
diff --git a/libpod/events/filters.go b/libpod/events/filters.go
index 62891d32c..26e1e10ba 100644
--- a/libpod/events/filters.go
+++ b/libpod/events/filters.go
@@ -86,7 +86,6 @@ func generateEventSinceOption(timeSince time.Time) func(e *Event) bool {
func generateEventUntilOption(timeUntil time.Time) func(e *Event) bool {
return func(e *Event) bool {
return e.Time.Before(timeUntil)
-
}
}
diff --git a/libpod/events/logfile.go b/libpod/events/logfile.go
index 05ae3ce52..c5feabe66 100644
--- a/libpod/events/logfile.go
+++ b/libpod/events/logfile.go
@@ -39,7 +39,6 @@ func (e EventLogFile) Write(ee Event) error {
return err
}
return nil
-
}
// Reads from the log file
diff --git a/libpod/healthcheck.go b/libpod/healthcheck.go
index f77075893..6c5becd5b 100644
--- a/libpod/healthcheck.go
+++ b/libpod/healthcheck.go
@@ -190,7 +190,7 @@ func (c *Container) updateHealthCheckLog(hcl define.HealthCheckLog, inStartPerio
}
if !inStartPeriod {
// increment failing streak
- healthCheck.FailingStreak += 1
+ healthCheck.FailingStreak++
// if failing streak > retries, then status to unhealthy
if healthCheck.FailingStreak >= c.HealthCheckConfig().Retries {
healthCheck.Status = define.HealthCheckUnhealthy
diff --git a/libpod/image/image.go b/libpod/image/image.go
index d732aecfe..8d8af0064 100644
--- a/libpod/image/image.go
+++ b/libpod/image/image.go
@@ -1688,7 +1688,6 @@ func (i *Image) GetConfigBlob(ctx context.Context) (*manifest.Schema2Image, erro
return nil, errors.Wrapf(err, "unable to parse image blob for %s", i.ID())
}
return &blob, nil
-
}
// GetHealthCheck returns a HealthConfig for an image. This function only works with
diff --git a/libpod/image/image_test.go b/libpod/image/image_test.go
index 2704b8baf..8055ef7b1 100644
--- a/libpod/image/image_test.go
+++ b/libpod/image/image_test.go
@@ -66,7 +66,6 @@ func makeLocalMatrix(b, bg *Image) []localImageTest {
l = append(l, busybox, busyboxGlibc)
return l
-
}
func TestMain(m *testing.M) {
diff --git a/libpod/image/prune.go b/libpod/image/prune.go
index 587c99333..6f026f630 100644
--- a/libpod/image/prune.go
+++ b/libpod/image/prune.go
@@ -52,7 +52,6 @@ func generatePruneFilterFuncs(filter, filterValue string) (ImageFilter, error) {
}
return false
}, nil
-
}
return nil, nil
}
@@ -170,7 +169,6 @@ func (ir *Runtime) PruneImages(ctx context.Context, all bool, filter []string) (
Size: uint64(imgSize),
})
}
-
}
return preports, nil
}
diff --git a/libpod/image/utils.go b/libpod/image/utils.go
index 5e7fed5c6..8882adcc1 100644
--- a/libpod/image/utils.go
+++ b/libpod/image/utils.go
@@ -45,7 +45,6 @@ func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, er
}
}
if len(candidates) == 0 {
-
return nil, errors.Wrapf(define.ErrNoSuchImage, "unable to find a name and tag match for %s in repotags", searchName)
}
@@ -75,9 +74,8 @@ func findImageInRepotags(search imageParts, images []*Image) (*storage.Image, er
}
if rwImageCnt > 1 {
return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/write images %s", strings.Join(keys, ","))
- } else {
- return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/only images %s", strings.Join(keys, ","))
}
+ return nil, errors.Wrapf(define.ErrMultipleImages, "found multiple read/only images %s", strings.Join(keys, ","))
}
return candidates[0].image.image, nil
}
diff --git a/libpod/info.go b/libpod/info.go
index 1b3550abd..f5bfb122e 100644
--- a/libpod/info.go
+++ b/libpod/info.go
@@ -222,11 +222,11 @@ func (r *Runtime) getContainerStoreInfo() (define.ContainerStore, error) {
}
switch state {
case define.ContainerStateRunning:
- running += 1
+ running++
case define.ContainerStatePaused:
- paused += 1
+ paused++
default:
- stopped += 1
+ stopped++
}
}
cs.Paused = paused
diff --git a/libpod/network/create.go b/libpod/network/create.go
index deacf487a..c58d62575 100644
--- a/libpod/network/create.go
+++ b/libpod/network/create.go
@@ -75,7 +75,6 @@ func validateBridgeOptions(options entities.NetworkCreateOptions) error {
}
return nil
-
}
// parseMTU parses the mtu option
diff --git a/libpod/network/create_test.go b/libpod/network/create_test.go
index 0b828e635..017bf31fe 100644
--- a/libpod/network/create_test.go
+++ b/libpod/network/create_test.go
@@ -8,7 +8,6 @@ import (
)
func Test_validateBridgeOptions(t *testing.T) {
-
tests := []struct {
name string
subnet net.IPNet
diff --git a/libpod/network/netconflist_test.go b/libpod/network/netconflist_test.go
index 5ff733f0f..161764ed9 100644
--- a/libpod/network/netconflist_test.go
+++ b/libpod/network/netconflist_test.go
@@ -7,7 +7,6 @@ import (
)
func TestNewIPAMDefaultRoute(t *testing.T) {
-
tests := []struct {
name string
isIPv6 bool
diff --git a/libpod/networking_linux.go b/libpod/networking_linux.go
index 55d338e7d..de6f75d3e 100644
--- a/libpod/networking_linux.go
+++ b/libpod/networking_linux.go
@@ -480,9 +480,8 @@ func (r *Runtime) setupSlirp4netns(ctr *Container) error {
if havePortMapping {
if isSlirpHostForward {
return r.setupRootlessPortMappingViaSlirp(ctr, cmd, apiSocket)
- } else {
- return r.setupRootlessPortMappingViaRLK(ctr, netnsPath)
}
+ return r.setupRootlessPortMappingViaRLK(ctr, netnsPath)
}
return nil
}
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index 23bfb29d7..38ffba7d2 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -1228,7 +1228,6 @@ func prepareProcessExec(c *Container, options *ExecOptions, env []string, sessio
if options.Cwd != "" {
pspec.Cwd = options.Cwd
-
}
var addGroups []string
@@ -1798,5 +1797,4 @@ func httpAttachNonTerminalCopy(container *net.UnixConn, http *bufio.ReadWriter,
return err
}
}
-
}
diff --git a/libpod/oci_util.go b/libpod/oci_util.go
index d40cf13bd..4ec050d6d 100644
--- a/libpod/oci_util.go
+++ b/libpod/oci_util.go
@@ -103,7 +103,6 @@ func bindPorts(ports []ocicni.PortMapping) ([]*os.File, error) {
}
default:
return nil, fmt.Errorf("unknown protocol %s", i.Protocol)
-
}
}
return files, nil
diff --git a/libpod/options.go b/libpod/options.go
index 74ee60fef..8831f527e 100644
--- a/libpod/options.go
+++ b/libpod/options.go
@@ -1109,7 +1109,6 @@ func WithLogTag(tag string) CtrCreateOption {
return nil
}
-
}
// WithCgroupsMode disables the creation of CGroups for the conmon process.
@@ -1131,7 +1130,6 @@ func WithCgroupsMode(mode string) CtrCreateOption {
return nil
}
-
}
// WithCgroupParent sets the Cgroup Parent of the new container.
@@ -1430,7 +1428,6 @@ func WithOverlayVolumes(volumes []*ContainerOverlayVolume) CtrCreateOption {
}
for _, vol := range volumes {
-
ctr.config.OverlayVolumes = append(ctr.config.OverlayVolumes, &ContainerOverlayVolume{
Dest: vol.Dest,
Source: vol.Source,
diff --git a/libpod/plugin/volume_api.go b/libpod/plugin/volume_api.go
index c5dec651c..79aebed43 100644
--- a/libpod/plugin/volume_api.go
+++ b/libpod/plugin/volume_api.go
@@ -241,9 +241,8 @@ func (p *VolumePlugin) makeErrorResponse(err, endpoint, volName string) error {
}
if volName != "" {
return errors.Wrapf(errors.New(err), "error on %s on volume %s in volume plugin %s", endpoint, volName, p.Name)
- } else {
- return errors.Wrapf(errors.New(err), "error on %s in volume plugin %s", endpoint, p.Name)
}
+ return errors.Wrapf(errors.New(err), "error on %s in volume plugin %s", endpoint, p.Name)
}
// Handle error responses from plugin
diff --git a/libpod/reset.go b/libpod/reset.go
index 24efeed40..3346f9d3f 100644
--- a/libpod/reset.go
+++ b/libpod/reset.go
@@ -16,7 +16,6 @@ import (
// Reset removes all storage
func (r *Runtime) Reset(ctx context.Context) error {
-
pods, err := r.GetAllPods()
if err != nil {
return err
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 1ad39fe2f..42af2046d 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -146,7 +146,6 @@ func NewRuntime(ctx context.Context, options ...RuntimeOption) (*Runtime, error)
// An error will be returned if the configuration file at the given path does
// not exist or cannot be loaded
func NewRuntimeFromConfig(ctx context.Context, userConfig *config.Config, options ...RuntimeOption) (*Runtime, error) {
-
return newRuntimeFromConfig(ctx, userConfig, options...)
}
@@ -382,7 +381,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// Initialize remaining OCI runtimes
for name, paths := range runtime.config.Engine.OCIRuntimes {
-
ociRuntime, err := newConmonOCIRuntime(name, paths, runtime.conmonPath, runtime.runtimeFlags, runtime.config)
if err != nil {
// Don't fatally error.
@@ -437,7 +435,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
// Set up the CNI net plugin
if !rootless.IsRootless() {
-
netPlugin, err := ocicni.InitCNI(runtime.config.Network.DefaultNetwork, runtime.config.Network.NetworkConfigDir, runtime.config.Network.CNIPluginDirs...)
if err != nil {
return errors.Wrapf(err, "error configuring CNI network plugin")
@@ -484,7 +481,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (retErr error) {
if became {
os.Exit(ret)
}
-
}
// If the file doesn't exist, we need to refresh the state
// This will trigger on first use as well, but refreshing an
@@ -787,7 +783,6 @@ type DBConfig struct {
// mergeDBConfig merges the configuration from the database.
func (r *Runtime) mergeDBConfig(dbConfig *DBConfig) {
-
c := &r.config.Engine
if !r.storageSet.RunRootSet && dbConfig.StorageTmp != "" {
if r.storageConfig.RunRoot != dbConfig.StorageTmp &&
diff --git a/libpod/runtime_ctr.go b/libpod/runtime_ctr.go
index 49cf42626..1b3532f1f 100644
--- a/libpod/runtime_ctr.go
+++ b/libpod/runtime_ctr.go
@@ -1139,7 +1139,6 @@ func (r *Runtime) IsStorageContainerMounted(id string) (bool, string, error) {
// StorageContainers returns a list of containers from containers/storage that
// are not currently known to Podman.
func (r *Runtime) StorageContainers() ([]storage.Container, error) {
-
if r.store == nil {
return nil, define.ErrStoreNotInitialized
}
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 2c5442bd2..f56fa8cce 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -313,9 +313,8 @@ func (r *Runtime) LoadImageFromSingleImageArchive(ctx context.Context, writer io
if err == nil && src != nil {
if newImages, err := r.ImageRuntime().LoadFromArchiveReference(ctx, src, signaturePolicy, writer); err == nil {
return getImageNames(newImages), nil
- } else {
- saveErr = err
}
+ saveErr = err
}
}
return "", errors.Wrapf(saveErr, "error pulling image")
diff --git a/libpod/runtime_img_test.go b/libpod/runtime_img_test.go
index 6ca4d900b..40d5860cf 100644
--- a/libpod/runtime_img_test.go
+++ b/libpod/runtime_img_test.go
@@ -26,7 +26,6 @@ func createTmpFile(content []byte) (string, error) {
if _, err := tmpfile.Write(content); err != nil {
return "", err
-
}
if err := tmpfile.Close(); err != nil {
return "", err
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index 564851f4e..bc37bdb23 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -24,7 +24,6 @@ const (
)
func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, rawImageName, imgID string, config *v1.ImageConfig) (*Container, error) {
-
// Set up generator for infra container defaults
g, err := generate.New("linux")
if err != nil {
diff --git a/libpod/volume.go b/libpod/volume.go
index 4c137cb8e..5cc5e7e40 100644
--- a/libpod/volume.go
+++ b/libpod/volume.go
@@ -130,11 +130,18 @@ func (v *Volume) MountPoint() (string, error) {
if err := v.update(); err != nil {
return "", err
}
+ }
+
+ return v.mountPoint(), nil
+}
- return v.state.MountPoint, nil
+// Internal-only helper for volume mountpoint
+func (v *Volume) mountPoint() string {
+ if v.UsesVolumeDriver() {
+ return v.state.MountPoint
}
- return v.config.MountPoint, nil
+ return v.config.MountPoint
}
// Options return the volume's options
diff --git a/libpod/volume_internal_linux.go b/libpod/volume_internal_linux.go
index e184505e7..82c01be44 100644
--- a/libpod/volume_internal_linux.go
+++ b/libpod/volume_internal_linux.go
@@ -45,7 +45,7 @@ func (v *Volume) mount() error {
// If the count is non-zero, the volume is already mounted.
// Nothing to do.
if v.state.MountCount > 0 {
- v.state.MountCount += 1
+ v.state.MountCount++
logrus.Debugf("Volume %s mount count now at %d", v.Name(), v.state.MountCount)
return v.save()
}
@@ -67,7 +67,7 @@ func (v *Volume) mount() error {
return err
}
- v.state.MountCount += 1
+ v.state.MountCount++
v.state.MountPoint = mountPoint
return v.save()
}
@@ -109,7 +109,7 @@ func (v *Volume) mount() error {
logrus.Debugf("Mounted volume %s", v.Name())
// Increment the mount counter
- v.state.MountCount += 1
+ v.state.MountCount++
logrus.Debugf("Volume %s mount count now at %d", v.Name(), v.state.MountCount)
return v.save()
}
@@ -152,7 +152,7 @@ func (v *Volume) unmount(force bool) error {
}
if !force {
- v.state.MountCount -= 1
+ v.state.MountCount--
} else {
v.state.MountCount = 0
}