From 1b83890462c5b4288b50b5013dfb243ed20a0326 Mon Sep 17 00:00:00 2001 From: Brian Goff Date: Tue, 7 Apr 2015 21:10:39 -0400 Subject: [PATCH] Don't return error when adding existing volume Error wasn't really doing anything except for making a bunch of extra debug logs. Signed-off-by: Brian Goff Upstream-commit: 579c9ec1d07983edf423d8c7564840d2fcc6f303 Component: engine --- components/engine/volumes/repository.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/components/engine/volumes/repository.go b/components/engine/volumes/repository.go index 08c5849818..0dac3753da 100644 --- a/components/engine/volumes/repository.go +++ b/components/engine/volumes/repository.go @@ -77,7 +77,8 @@ func (r *Repository) newVolume(path string, writable bool) (*Volume, error) { return nil, err } - return v, r.add(v) + r.add(v) + return v, nil } func (r *Repository) restore() error { @@ -103,9 +104,7 @@ func (r *Repository) restore() error { continue } } - if err := r.add(vol); err != nil { - logrus.Debugf("Error restoring volume: %v", err) - } + r.add(vol) } return nil } @@ -125,12 +124,11 @@ func (r *Repository) get(path string) *Volume { return r.volumes[filepath.Clean(path)] } -func (r *Repository) add(volume *Volume) error { +func (r *Repository) add(volume *Volume) { if vol := r.get(volume.Path); vol != nil { - return fmt.Errorf("Volume exists: %s", volume.ID) + return } r.volumes[volume.Path] = volume - return nil } func (r *Repository) Delete(path string) error {