From 42819ba3622ace2b9b71208f1dce6d4e202a2d3a Mon Sep 17 00:00:00 2001 From: Ta-Ching Chen Date: Sun, 24 Sep 2017 10:21:13 -0500 Subject: [PATCH] Fix storage service failed to start after restarting it (#352) --- storagesvc/storagesvc.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/storagesvc/storagesvc.go b/storagesvc/storagesvc.go index c23a6704..bbaa709c 100644 --- a/storagesvc/storagesvc.go +++ b/storagesvc/storagesvc.go @@ -24,6 +24,7 @@ import ( "log" "net/http" "os" + "path/filepath" "strconv" "github.com/gorilla/handlers" @@ -201,6 +202,10 @@ func MakeStorageService(sc *storageConfig) (*StorageService, error) { ss.location = loc con, err := loc.CreateContainer(sc.containerName) + if os.IsExist(err) { + id := filepath.Join(sc.localPath, sc.containerName) + con, err = loc.Container(id) + } if err != nil { log.Printf("Error initializing storage: %v", err) return nil, err