Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
669ac33f
Commit
669ac33f
authored
Jun 02, 2020
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add check backup interface
parent
ef17be1f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
3 deletions
+20
-3
pai.go
pkg/pai/pai.go
+1
-1
node.go
routers/api/v1/node.go
+17
-2
router.go
routers/router.go
+2
-0
No files found.
pkg/pai/pai.go
View file @
669ac33f
...
...
@@ -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
{
...
...
routers/api/v1/node.go
View file @
669ac33f
...
...
@@ -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
...
...
routers/router.go
View file @
669ac33f
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment