Skip to content

Commit

Permalink
Merge e58567c into d3ab9c9
Browse files Browse the repository at this point in the history
  • Loading branch information
clintkitson committed Sep 29, 2015
2 parents d3ab9c9 + e58567c commit e2a3831
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion daemon/module/docker/volumedriver/voldriver.go
Expand Up @@ -2,7 +2,6 @@ package volumedriver

import (
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net"
Expand All @@ -12,9 +11,11 @@ import (
"regexp"
"time"

log "github.com/Sirupsen/logrus"
"github.com/emccode/rexray/daemon/module"

"github.com/emccode/rexray/config"
errors "github.com/emccode/rexray/errors"
osm "github.com/emccode/rexray/os"
"github.com/emccode/rexray/storage"
"github.com/emccode/rexray/util"
Expand Down Expand Up @@ -212,12 +213,14 @@ func (mod *Module) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Create: error decoding json", err))
return
}

err := mod.vdm.Create(pr.Name, pr.Opts)
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Create: error creating volume", err))
return
}

Expand All @@ -229,12 +232,14 @@ func (mod *Module) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Remove: error decoding json", err))
return
}

err := mod.vdm.Remove(pr.Name)
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Remove: error removing volume", err))
return
}

Expand All @@ -246,12 +251,14 @@ func (mod *Module) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Path: error decoding json", err))
return
}

mountPath, err := mod.vdm.Path(pr.Name, "")
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Path: error returning path", err))
return
}

Expand All @@ -263,12 +270,14 @@ func (mod *Module) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Mount: error decoding json", err))
return
}

mountPath, err := mod.vdm.Mount(pr.Name, "", false, "")
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Mount: error mounting volume", err))
return
}

Expand All @@ -280,12 +289,14 @@ func (mod *Module) buildMux() *http.ServeMux {
var pr pluginRequest
if err := json.NewDecoder(r.Body).Decode(&pr); err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Unmount: error decoding json", err))
return
}

err := mod.vdm.Unmount(pr.Name, "")
if err != nil {
http.Error(w, fmt.Sprintf("{\"Error\":\"%s\"}", err.Error()), 500)
log.Error(errors.WithError("/VolumeDriver.Unmount: error unmounting volume", err))
return
}

Expand Down

0 comments on commit e2a3831

Please sign in to comment.