Beispiel #1
0
// ListSnapshotsLogicalVolumes lists logical volumes by pattern
func (this *HttpAPI) ListSnapshotsLogicalVolumes(params martini.Params, r render.Render, req *http.Request) {
	if err := validateToken(req.URL.Query().Get("token")); err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	output, err := osagent.LogicalVolumes("", config.Config.SnapshotVolumesFilter)
	if err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	r.JSON(200, output)
}
Beispiel #2
0
// LogicalVolume lists a logical volume by name/path/mount point
func (this *HttpAPI) LogicalVolume(params martini.Params, r render.Render, req *http.Request) {
	if err := validateToken(req.URL.Query().Get("token")); err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	lv := params["lv"]
	if lv == "" {
		lv = req.URL.Query().Get("lv")
	}
	output, err := osagent.LogicalVolumes(lv, "")
	if err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	r.JSON(200, output)
}