[pve-devel] [PATCH qemu-server 2/2] firewall config will now include in the backup and write to vma file.
Wolfgang Link
w.link at proxmox.com
Mon Nov 23 14:38:34 CET 2015
---
PVE/VZDump/QemuServer.pm | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/PVE/VZDump/QemuServer.pm b/PVE/VZDump/QemuServer.pm
index 66f00b5..68b45f1 100644
--- a/PVE/VZDump/QemuServer.pm
+++ b/PVE/VZDump/QemuServer.pm
@@ -171,6 +171,7 @@ sub assemble {
my $conffile = PVE::QemuServer::config_file ($vmid);
my $outfile = "$task->{tmpdir}/qemu-server.conf";
+ my $firewall = "/etc/pve/firewall/$vmid.fw";
my $outfd;
my $conffd;
@@ -218,6 +219,10 @@ sub assemble {
close ($outfd) if $outfd;
close ($conffd) if $conffd;
+ if (-e $firewall) {
+ PVE::Tools::file_atomic_copy($firewall, "$task->{tmpdir}/firewall.fw");
+ }
+
die $err if $err;
}
@@ -225,6 +230,7 @@ sub archive {
my ($self, $task, $vmid, $filename, $comp) = @_;
my $conffile = "$task->{tmpdir}/qemu-server.conf";
+ my $firewall = "$task->{tmpdir}/firewall.fw";
my $opts = $self->{vzdump}->{opts};
@@ -260,7 +266,9 @@ sub archive {
$outcmd .= ">$filename" if !$opts->{stdout};
- my $cmd = ['/usr/bin/vma', 'create', '-v', '-c', $conffile, $outcmd, @pathlist];
+ my $cmd = ['/usr/bin/vma', 'create', '-v', '-c', $conffile];
+ push @$cmd, '-c', $firewall if -e $firewall;
+ push @$cmd, $outcmd, @pathlist;
$self->loginfo("starting template backup");
$self->loginfo(join(' ', @$cmd));
@@ -372,14 +380,22 @@ sub archive {
my $add_fd_cb = sub {
my ($vmid, $resp) = @_;
- $qmpclient->queue_cmd($vmid, $backup_cb, 'backup',
- 'backup-file' => "/dev/fdname/backup",
- speed => $speed,
- 'config-file' => $conffile,
- devlist => $devlist);
+ if(-e $firewall) {
+ $qmpclient->queue_cmd($vmid, $backup_cb, 'backup',
+ 'backup-file' => "/dev/fdname/backup",
+ speed => $speed,
+ 'config-file' => $conffile,
+ 'firewall-file' => $firewall,
+ devlist => $devlist);
+ } else {
+ $qmpclient->queue_cmd($vmid, $backup_cb, 'backup',
+ 'backup-file' => "/dev/fdname/backup",
+ speed => $speed,
+ 'config-file' => $conffile,
+ devlist => $devlist);
+ }
};
-
$qmpclient->queue_cmd($vmid, $add_fd_cb, 'getfd',
fd => $outfileno, fdname => "backup");
--
2.1.4
More information about the pve-devel
mailing list