diff options
Diffstat (limited to 'weed/server/master_server_handlers.go')
| -rw-r--r-- | weed/server/master_server_handlers.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/weed/server/master_server_handlers.go b/weed/server/master_server_handlers.go index c10f9a5b7..9bcd35ced 100644 --- a/weed/server/master_server_handlers.go +++ b/weed/server/master_server_handlers.go @@ -65,11 +65,17 @@ func (ms *MasterServer) findVolumeLocation(collection, vid string) operation.Loo var err error if ms.Topo.IsLeader() { volumeId, newVolumeIdErr := needle.NewVolumeId(vid) - machines := ms.Topo.Lookup(collection, volumeId) - for _, loc := range machines { - locations = append(locations, operation.Location{Url: loc.Url(), PublicUrl: loc.PublicUrl}) + if newVolumeIdErr != nil { + err = fmt.Errorf("Unknown volume id %s", vid) + } else { + machines := ms.Topo.Lookup(collection, volumeId) + for _, loc := range machines { + locations = append(locations, operation.Location{Url: loc.Url(), PublicUrl: loc.PublicUrl}) + } + if locations == nil { + err = fmt.Errorf("volume id %s not found", vid) + } } - err = newVolumeIdErr } else { machines, getVidLocationsErr := ms.MasterClient.GetVidLocations(vid) for _, loc := range machines { |
