[pve-devel] [PATCH manager 1/2] vzdump: handle backup to stdout correctly
Philip Abernethy
p.abernethy at proxmox.com
Tue Sep 12 15:17:30 CEST 2017
Checks for dumpdir or tmpdir backups don't apply to stdout, so we can
skip the checks involved in those methods.
---
PVE/VZDump.pm | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index 004672d1..e5777ea5 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -574,7 +574,7 @@ sub new {
push @{$self->{plugins}}, $pd;
}
- if (!$opts->{dumpdir} && !$opts->{storage}) {
+ if (!$opts->{dumpdir} && !$opts->{stdout} && !$opts->{storage}) {
$opts->{storage} = 'local';
}
@@ -592,6 +592,8 @@ sub new {
} elsif ($opts->{dumpdir}) {
$errors .= "dumpdir '$opts->{dumpdir}' does not exist"
if ! -d $opts->{dumpdir};
+ } elsif ($opts->{stdout}) {
+ # Nothing to do here. We don't handle what comes after stdout
} else {
die "internal error";
}
@@ -802,7 +804,7 @@ sub exec_backup_task {
if scalar(@$bklist) >= $maxfiles;
}
- my $logfile = $task->{logfile} = "$opts->{dumpdir}/$basename.log";
+ my $logfile = $task->{logfile} = !$opts->{stdout} ? "$opts->{dumpdir}/$basename.log" : '';
my $ext = $vmtype eq 'qemu' ? '.vma' : '.tar';
my ($comp, $comp_ext) = compressor_info($opts);
@@ -823,6 +825,8 @@ sub exec_backup_task {
if ($opts->{tmpdir}) {
$task->{tmpdir} = "$opts->{tmpdir}/vzdumptmp$$";
+ } elsif ($opts->{stdout}) {
+ $task->{tmpdir} = "/var/tmp/vzdumptmp$$";
} else {
# dumpdir is posix? then use it as temporary dir
my $info = get_mount_info($opts->{dumpdir});
--
2.11.0
More information about the pve-devel
mailing list