Commit 669ac33f authored by szh's avatar szh

add check backup interface

parent ef17be1f
......@@ -29,7 +29,7 @@ func MonitorServer() ([]*Disk,error) {
tlog.Info("MonitorServer","df -T end" ,err)
return nil,err
}
tlog.Info("MonitorServer",string(content))
tlog.Info("MonitorServer","content",string(content))
list := strings.Split(string(content),"\n")
tempDisk := make([]*Disk,0)
for _,v := range list {
......
......@@ -569,8 +569,6 @@ func Rollback(c *gin.Context) {
func NodeBackup(c *gin.Context) {
appG:=app.Gin{C:c}
var pai pai_service.Pai
err := pai.GetDiskUseage()
if err != nil {
......@@ -596,6 +594,23 @@ func NodeBackup(c *gin.Context) {
appG.Response(http.StatusOK,e.SUCCESS,"bityuan ready to backup")
}
func CheckBackup(c *gin.Context) {
appG:=app.Gin{C:c}
path := app.GetAbsPath(setting.BityuanSetting.Name)
backupPath := path + "/datadir_backup"
if _,err := os.Stat(backupPath);err != nil {
if os.IsNotExist(err) {
tlog.Error("CheckBackup file not exists","err",backupPath)
appG.Response(http.StatusOK,e.ERROR,false)
return
} else if os.IsExist(err) {
tlog.Error("CheckBackup file exists","err",backupPath)
appG.Response(http.StatusOK,e.SUCCESS,true)
return
}
}
}
func NodeRecover(c *gin.Context) {
appG:=app.Gin{C:c}
var pai pai_service.Pai
......
......@@ -65,6 +65,8 @@ func InitRouter() *gin.Engine {
apiv1.POST("/noderecover",v1.NodeRecover)
//删除备份
apiv1.POST("/delbackup",v1.DelBackup)
//是否备份
apiv1.POST("/isbackup",v1.CheckBackup)
return r
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment