[pve-devel] [PATCH V2 pve-container 2/2] restore firwall settings if they exist in tar

Wolfgang Link w.link at proxmox.com
Wed Nov 25 10:18:18 CET 2015


on LXC restore import firewall settings
---
 src/PVE/LXC/Create.pm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index 58db2d2..7706402 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -10,6 +10,7 @@ use PVE::Storage;
 use PVE::LXC;
 use PVE::LXC::Setup;
 use PVE::VZDump::ConvertOVZ;
+use PVE::Tools;
 
 sub next_free_nbd_dev {
     
@@ -155,7 +156,13 @@ sub restore_and_configure {
 		$conf->{$key} = $oldconf->{$key} if !defined($conf->{$key});
 	    }
 	    unlink($pct_cfg_fn);
-	    
+
+	    eval {
+		PVE::Tools::file_copy("$rootdir/etc/vzdump/firewall.fw", "/etc/pve/firewall/$vmid.fw");
+	    };
+	    if ($@){
+		#do nothing! because there can be no firewall file.
+	    }
 	} elsif (-f $ovz_cfg_fn) {
 	    print "###########################################################\n";
 	    print "Converting OpenVZ configuration to LXC.\n";
-- 
2.1.4





More information about the pve-devel mailing list