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
d6f684d3
Commit
d6f684d3
authored
Feb 07, 2012
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow to select gzip or lzop in vzdump
lzop is much faster, and we use that by default now.
parent
77c506ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
20 deletions
+36
-20
VZDump.pm
PVE/VZDump.pm
+28
-9
OpenVZ.pm
PVE/VZDump/OpenVZ.pm
+6
-9
Plugin.pm
PVE/VZDump/Plugin.pm
+1
-1
control.in
debian/control.in
+1
-1
No files found.
PVE/VZDump.pm
View file @
d6f684d3
...
...
@@ -643,6 +643,20 @@ sub run_hook_script {
run_command
(
$logfd
,
$cmd
);
}
sub
compressor_info
{
my
(
$opt_compress
)
=
@_
;
if
(
!
$opt_compress
||
$opt_compress
eq
'
0
')
{
return
undef
;
}
elsif
(
$opt_compress
eq
'
1
'
||
$opt_compress
eq
'
lzo
')
{
return
('
lzop
',
'
lzo
');
}
elsif
(
$opt_compress
eq
'
gzip
')
{
return
('
gzip
',
'
gz
');
}
else
{
die
"
internal error - unknown compression option '
$opt_compress
'
";
}
}
sub
exec_backup_task
{
my
(
$self
,
$task
)
=
@_
;
...
...
@@ -675,7 +689,11 @@ sub exec_backup_task {
my
$logfile
=
$task
->
{
logfile
}
=
"
$opts
->{dumpdir}/
$basename
.log
";
my
$ext
=
$opts
->
{
compress
}
?
'
.tgz
'
:
'
.tar
';
my
$ext
=
'
.tar
';
my
(
$comp
,
$comp_ext
)
=
compressor_info
(
$opts
->
{
compress
});
if
(
$comp
&&
$comp_ext
)
{
$ext
.=
"
.
${comp_ext}
";
}
if
(
$opts
->
{
stdout
})
{
$task
->
{
tarfile
}
=
'
-
';
...
...
@@ -836,13 +854,13 @@ 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
}
,
$comp
);
$self
->
run_hook_script
('
backup-end
',
$task
,
$logfd
);
return
;
}
debugmsg
('
info
',
"
creating archive '
$task
->{tarfile}'
",
$logfd
);
$plugin
->
archive
(
$task
,
$vmid
,
$task
->
{
tmptar
}
);
$plugin
->
archive
(
$task
,
$vmid
,
$task
->
{
tmptar
},
$comp
);
rename
(
$task
->
{
tmptar
},
$task
->
{
tarfile
})
||
die
"
unable to rename '
$task
->{tmptar}' to '
$task
->{tarfile}'
\n
";
...
...
@@ -861,7 +879,7 @@ 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
))$!
)
{
if
(
$fn
=~
m!/(${bkname}-(\d{4})_(\d{2})_(\d{2})-(\d{2})_(\d{2})_(\d{2})\.(tgz|
(tar(\.(gz|lzo))?)
))$!
)
{
$fn
=
"
$dir
/$1
";
# untaint
my
$t
=
timelocal
(
$7
,
$6
,
$5
,
$4
,
$3
-
1
,
$2
-
1900
);
push
@bklist
,
[
$fn
,
$t
];
...
...
@@ -877,7 +895,7 @@ sub exec_backup_task {
debugmsg
('
info
',
"
delete old backup '
$d
->[0]'
",
$logfd
);
unlink
$d
->
[
0
];
my
$logfn
=
$d
->
[
0
];
$logfn
=~
s/\.(tgz|
tar
)$/\.log/
;
$logfn
=~
s/\.(tgz|
(tar(\.(gz|lzo))?)
)$/\.log/
;
unlink
$logfn
;
}
}
...
...
@@ -954,7 +972,7 @@ sub exec_backup_task {
}
sub
exec_backup
{
my
(
$
rpcenv
,
$authuser
,
$self
)
=
@_
;
my
(
$
self
,
$rpcenv
,
$authuser
)
=
@_
;
my
$opts
=
$self
->
{
opts
};
...
...
@@ -1048,10 +1066,11 @@ my $confdesc = {
default
=>
1
,
},
compress
=>
{
type
=>
'
boolean
',
description
=>
"
Compress dump file
(gzip)
.
",
type
=>
'
string
',
description
=>
"
Compress dump file.
",
optional
=>
1
,
default
=>
0
,
enum
=>
['
0
',
'
1
',
'
gzip
',
'
lzo
'],
default
=>
'
lzo
',
},
quiet
=>
{
type
=>
'
boolean
',
...
...
PVE/VZDump/OpenVZ.pm
View file @
d6f684d3
...
...
@@ -231,7 +231,7 @@ sub assemble {
}
sub
archive
{
my
(
$self
,
$task
,
$vmid
,
$filename
)
=
@_
;
my
(
$self
,
$task
,
$vmid
,
$filename
,
$comp
)
=
@_
;
my
$findexcl
=
$self
->
{
vzdump
}
->
{
findexcl
};
my
$findargs
=
join
('
',
@$findexcl
)
.
'
-print0
';
...
...
@@ -240,8 +240,6 @@ sub archive {
my
$srcdir
=
$self
->
{
vmlist
}
->
{
$vmid
}
->
{
dir
};
my
$snapdir
=
$task
->
{
snapdir
};
my
$zflag
=
$opts
->
{
compress
}
?
'
z
'
:
'';
my
$taropts
=
"
--totals --sparse --numeric-owner --no-recursion --ignore-failed-read --one-file-system
";
# note: --remove-files does not work because we do not
...
...
@@ -253,13 +251,12 @@ sub archive {
#}
my
$cmd
=
"
(
";
$cmd
.=
"
cd
$snapdir
;find .
$findargs
|sed 's/
\\\\
/
\\\\\\\\
/g'|
";
$cmd
.=
"
tar c
${zflag}
pf -
$taropts
--null -T -
";
if
(
$opts
->
{
bwlimit
})
{
$cmd
.=
"
cd
$snapdir
;find .
$findargs
|sed 's/
\\\\
/
\\\\\\\\
/g'|
";
$cmd
.=
"
tar cpf -
$taropts
--null -T -
";
my
$bwl
=
$opts
->
{
bwlimit
}
*
1024
;
# bandwidth limit for cstream
$cmd
.=
"
|cstream -t
$bwl
"
;
}
$cmd
.=
"
|cstream -t
$bwl
"
if
$opts
->
{
bwlimit
}
;
$cmd
.=
"
|
$comp
"
if
$comp
;
$cmd
.=
"
)
";
...
...
PVE/VZDump/Plugin.pm
View file @
d6f684d3
...
...
@@ -116,7 +116,7 @@ sub assemble {
}
sub
archive
{
my
(
$self
,
$task
,
$vmid
,
$filename
)
=
@_
;
my
(
$self
,
$task
,
$vmid
,
$filename
,
$comp
)
=
@_
;
die
"
internal error
";
# implement in subclass
}
...
...
debian/control.in
View file @
d6f684d3
...
...
@@ -3,7 +3,7 @@ Version: @VERSION@-@PACKAGERELEASE@
Section: admin
Priority: optional
Architecture: all
Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, libdigest-sha1-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, redhat-cluster-pve, resource-agents-pve, fence-agents-pve, cstream, mail-transport-agent, libxml-parser-perl, perl-suid
Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, libdigest-sha1-perl, liblockfile-simple-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl, libfile-sync-perl, redhat-cluster-pve, resource-agents-pve, fence-agents-pve, cstream, mail-transport-agent, libxml-parser-perl, perl-suid
, lzop
Conflicts: netcat-openbsd, vzdump
Replaces: vzdump
Provides: vzdump
...
...
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