Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
97ab4674
Commit
97ab4674
authored
Oct 18, 2011
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start backup/restore GUI
parent
4323af95
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
159 additions
and
6 deletions
+159
-6
VZDump.pm
PVE/API2/VZDump.pm
+1
-0
VZDump.pm
PVE/VZDump.pm
+5
-4
Makefile
www/manager/Makefile
+1
-0
Backup.js
www/manager/qemu/Backup.js
+150
-0
Config.js
www/manager/qemu/Config.js
+2
-2
No files found.
PVE/API2/VZDump.pm
View file @
97ab4674
...
...
@@ -22,6 +22,7 @@ __PACKAGE__->register_method ({
path
=>
'',
method
=>
'
POST
',
description
=>
"
Create backup.
",
protected
=>
1
,
parameters
=>
{
additionalProperties
=>
0
,
properties
=>
{
...
...
PVE/VZDump.pm
View file @
97ab4674
...
...
@@ -88,7 +88,7 @@ sub storage_info {
PVE::Storage::
activate_storage
(
$cfg
,
$storage
);
return
{
dumpdir
=>
$scfg
->
{
path
}
,
dumpdir
=>
PVE::Storage::
get_backup_dir
(
$cfg
,
$storage
)
,
};
}
...
...
@@ -828,7 +828,7 @@ sub exec_backup_task {
if
(
$opts
->
{
stdout
})
{
debugmsg
('
info
',
"
sending archive to stdout
",
$logfd
);
$plugin
->
archive
(
$task
,
$vmid
,
$task
->
{
tmptar
});
$plugin
->
archive
(
$task
,
$vmid
,
$task
->
{
tmptar
});
$self
->
run_hook_script
('
backup-end
',
$task
,
$logfd
);
return
;
}
...
...
@@ -853,8 +853,9 @@ sub exec_backup_task {
my
$dir
=
$opts
->
{
dumpdir
};
foreach
my
$fn
(
<
$dir
/
$
{
bkname
}
-*>
)
{
next
if
$fn
eq
$task
->
{
tarfile
};
if
(
$fn
=~
m!/${bkname}-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|tar)$!
)
{
my
$t
=
timelocal
(
$6
,
$5
,
$4
,
$3
,
$2
-
1
,
$1
-
1900
);
if
(
$fn
=~
m!/(${bkname}-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|tar))$!
)
{
$fn
=
"
$dir
/$1
";
# untaint
my
$t
=
timelocal
(
$7
,
$6
,
$5
,
$4
,
$3
-
1
,
$2
-
1900
);
push
@bklist
,
[
$fn
,
$t
];
}
}
...
...
www/manager/Makefile
View file @
97ab4674
...
...
@@ -80,6 +80,7 @@ JSSRC= \
qemu/KeyboardEdit.js
\
qemu/HardwareView.js
\
qemu/Options.js
\
qemu/Backup.js
\
qemu/Config.js
\
qemu/CreateWizard.js
\
openvz/StatusView.js
\
...
...
www/manager/qemu/Backup.js
0 → 100644
View file @
97ab4674
Ext
.
define
(
'
PVE.qemu.Backup
'
,
{
extend
:
'
Ext.grid.GridPanel
'
,
alias
:
[
'
widget.pveQemuBackup
'
],
initComponent
:
function
()
{
var
me
=
this
;
var
nodename
=
me
.
pveSelNode
.
data
.
node
;
if
(
!
nodename
)
{
throw
"
no node name specified
"
;
}
var
vmid
=
me
.
pveSelNode
.
data
.
vmid
;
if
(
!
vmid
)
{
throw
"
no VM ID specified
"
;
}
me
.
store
=
Ext
.
create
(
'
Ext.data.Store
'
,
{
model
:
'
pve-storage-content
'
,
sorters
:
{
property
:
'
volid
'
,
order
:
'
DESC
'
}
});
var
reload
=
Ext
.
Function
.
createBuffered
(
function
()
{
if
(
me
.
store
.
proxy
.
url
)
{
me
.
store
.
load
();
}
},
100
);
var
setStorage
=
function
(
storage
)
{
var
url
=
'
/api2/json/nodes/
'
+
nodename
+
'
/storage/
'
+
storage
+
'
/content
'
;
url
+=
'
?content=backup
'
;
me
.
store
.
setProxy
({
type
:
'
pve
'
,
url
:
url
});
reload
();
};
var
storagesel
=
Ext
.
create
(
'
PVE.form.StorageSelector
'
,
{
nodename
:
nodename
,
fieldLabel
:
'
Storage
'
,
labelAlign
:
'
right
'
,
storageContent
:
'
backup
'
,
allowBlank
:
false
,
listeners
:
{
change
:
function
(
f
,
value
)
{
setStorage
(
value
);
}
}
});
var
backup_btn
=
new
Ext
.
Button
({
text
:
'
Backup now
'
,
handler
:
function
(){
var
storage
=
storagesel
.
getValue
();
var
msg
=
'
Start backup to storage "
'
+
storage
+
'
"
'
;
Ext
.
Msg
.
confirm
(
'
Backup Confirmation
'
,
msg
,
function
(
btn
)
{
if
(
btn
!==
'
yes
'
)
{
return
;
}
PVE
.
Utils
.
API2Request
({
url
:
'
/nodes/
'
+
nodename
+
'
/vzdump
'
,
params
:
{
storage
:
storage
,
vmid
:
vmid
,
compress
:
1
,
snapshot
:
1
},
method
:
'
POST
'
,
failure
:
function
(
response
,
opts
)
{
Ext
.
Msg
.
alert
(
'
Error
'
,
response
.
htmlStatus
);
},
success
:
function
(
response
,
options
)
{
var
upid
=
response
.
result
.
data
;
var
win
=
Ext
.
create
(
'
PVE.window.TaskViewer
'
,
{
upid
:
upid
});
win
.
show
();
}
});
});
}
});
var
restore_btn
=
new
Ext
.
Button
({
text
:
'
Restore
'
,
disabled
:
true
,
handler
:
function
(){
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
var
volid
=
rec
.
data
.
volid
;
console
.
log
(
"
RESRORE
"
+
volid
);
}
});
var
set_button_status
=
function
()
{
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
restore_btn
.
setDisabled
(
!
(
rec
&&
rec
.
data
.
volid
));
}
Ext
.
apply
(
me
,
{
stateful
:
false
,
tbar
:
[
backup_btn
,
restore_btn
,
'
->
'
,
storagesel
],
columns
:
[
{
header
:
'
Name
'
,
flex
:
1
,
sortable
:
true
,
renderer
:
PVE
.
Utils
.
render_storage_content
,
dataIndex
:
'
volid
'
},
{
header
:
'
Format
'
,
width
:
100
,
dataIndex
:
'
format
'
},
{
header
:
'
Size
'
,
width
:
100
,
renderer
:
PVE
.
Utils
.
format_size
,
dataIndex
:
'
size
'
}
],
listeners
:
{
show
:
reload
,
selectionchange
:
set_button_status
}
});
me
.
callParent
();
//setStorage('local');
}
});
www/manager/qemu/Config.js
View file @
97ab4674
...
...
@@ -46,9 +46,9 @@ Ext.define('PVE.qemu.Config', {
vmid
:
vmid
},
{
xtype
:
'
pveQemuBackup
'
,
title
:
'
Backup
'
,
itemId
:
'
backup
'
,
html
:
'
Backup and restore - not implemented!
'
itemId
:
'
backup
'
},
{
title
:
'
Permissions
'
,
...
...
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