diff options
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime.go | 16 | ||||
-rw-r--r-- | libpod/runtime_volume.go | 16 |
2 files changed, 11 insertions, 21 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go index 08c6cb588..28958e932 100644 --- a/libpod/runtime.go +++ b/libpod/runtime.go @@ -879,14 +879,6 @@ func makeRuntime(ctx context.Context, runtime *Runtime) (err error) { runtime.imageRuntime.Eventer = eventer } - // Set up a storage service for creating container root filesystems from - // images - storageService, err := getStorageService(runtime.store) - if err != nil { - return err - } - runtime.storageService = storageService - // Set up containers/image runtime.imageContext = &types.SystemContext{ SignaturePolicyPath: runtime.config.SignaturePolicyPath, @@ -1330,6 +1322,14 @@ func (r *Runtime) configureStore() error { r.store = store is.Transport.SetStore(store) + // Set up a storage service for creating container root filesystems from + // images + storageService, err := getStorageService(r.store) + if err != nil { + return err + } + r.storageService = storageService + ir := image.NewImageRuntimeFromStore(r.store) ir.SignaturePolicyPath = r.config.SignaturePolicyPath ir.EventsLogFilePath = r.config.EventsLogFilePath diff --git a/libpod/runtime_volume.go b/libpod/runtime_volume.go index 5c087faca..d05db936b 100644 --- a/libpod/runtime_volume.go +++ b/libpod/runtime_volume.go @@ -2,7 +2,6 @@ package libpod import ( "context" - "strings" "github.com/containers/libpod/libpod/define" "github.com/containers/libpod/libpod/events" @@ -72,7 +71,7 @@ func (r *Runtime) RemoveVolumes(ctx context.Context, volumes []string, all, forc return deletedVols, nil } -// GetVolume retrieves a volume by its name +// GetVolume retrieves a volume given its full name. func (r *Runtime) GetVolume(name string) (*Volume, error) { r.lock.RLock() defer r.lock.RUnlock() @@ -82,20 +81,11 @@ func (r *Runtime) GetVolume(name string) (*Volume, error) { } vol, err := r.state.Volume(name) - if err == nil { - return vol, err - } - - vols, err := r.GetAllVolumes() if err != nil { return nil, err } - for _, v := range vols { - if strings.HasPrefix(v.Name(), name) { - return v, nil - } - } - return nil, errors.Errorf("unable to find volume %s", name) + + return vol, nil } // HasVolume checks to see if a volume with the given name exists |