simplify volume id printing

This commit is contained in:
Chris Lu
2012-08-23 23:14:54 -07:00
parent 868e47f994
commit 0c32e2e965
4 changed files with 9 additions and 10 deletions

View File

@@ -38,13 +38,13 @@ func dirLookupHandler(w http.ResponseWriter, r *http.Request) {
if commaSep > 0 {
vid = vid[0:commaSep]
}
volumeId, _ := strconv.ParseUint(vid, 10, 64)
machine, e := mapper.Get(storage.VolumeId(volumeId))
volumeId, _ := storage.NewVolumeId(vid)
machine, e := mapper.Get(volumeId)
if e == nil {
writeJson(w, r, machine.Server)
} else {
log.Println("Invalid volume id", volumeId)
writeJson(w, r, map[string]string{"error": "volume id " + strconv.FormatUint(volumeId, 10) + " not found"})
writeJson(w, r, map[string]string{"error": "volume id " + volumeId.String() + " not found"})
}
}
func dirAssignHandler(w http.ResponseWriter, r *http.Request) {