Exemple #1
0
// GetMount shows the configured mount point's status
func (this *HttpAPI) GetMount(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.GetMount(config.Config.SnapshotMountPoint)
	if err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	r.JSON(200, output)
}
Exemple #2
0
// SendMySQLSeedData
func (this *HttpAPI) SendMySQLSeedData(params martini.Params, r render.Render, req *http.Request) {
	var err error
	if err = validateToken(req.URL.Query().Get("token")); err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	mount, err := osagent.GetMount(config.Config.SnapshotMountPoint)
	if err != nil {
		r.JSON(500, &APIResponse{Code: ERROR, Message: err.Error()})
		return
	}
	go osagent.SendMySQLSeedData(params["targetHost"], mount.MySQLDataPath, params["seedId"])
	r.JSON(200, err == nil)
}