From d245c6df29e0c124da25e25cd9fbc5f1095bb6f7 Mon Sep 17 00:00:00 2001 From: Matthew Heon Date: Fri, 15 Mar 2019 10:01:23 -0400 Subject: Switch Libpod over to new explicit named volumes This swaps the previous handling (parse all volume mounts on the container and look for ones that might refer to named volumes) for the new, explicit named volume lists stored per-container. It also deprecates force-removing volumes that are in use. I don't know how we want to handle this yet, but leaving containers that depend on a volume that no longer exists is definitely not correct. Signed-off-by: Matthew Heon --- libpod/runtime_volume_linux.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'libpod/runtime_volume_linux.go') diff --git a/libpod/runtime_volume_linux.go b/libpod/runtime_volume_linux.go index db5c29242..39c2f808d 100644 --- a/libpod/runtime_volume_linux.go +++ b/libpod/runtime_volume_linux.go @@ -98,14 +98,12 @@ func (r *Runtime) removeVolume(ctx context.Context, v *Volume, force bool) error if !force { return errors.Wrapf(ErrVolumeBeingUsed, "volume %s is being used by the following container(s): %s", v.Name(), depsStr) } - // If using force, log the warning that the volume is being used by at least one container - logrus.Warnf("volume %s is being used by the following container(s): %s", v.Name(), depsStr) - // Remove the container dependencies so we can go ahead and delete the volume - for _, dep := range deps { - if err := r.state.RemoveVolCtrDep(v, dep); err != nil { - return errors.Wrapf(err, "unable to remove container dependency %q from volume %q while trying to delete volume by force", dep, v.Name()) - } - } + + // TODO: force-removing a volume makes *no sense* + // I do not believe we should be allowing this at all. + // For now, return angry errors. + // TODO: need to do something more sane in this case + return errors.Wrapf(ErrVolumeBeingUsed, "TODO: FIXME - still refusing to remove because force-removing an in-use volume is not good.") } // Set volume as invalid so it can no longer be used -- cgit v1.2.3-54-g00ecf