[pve-devel] [PATCH] create firewall dir on ct restore, if it does not exists.

Wolfgang Link w.link at proxmox.com
Thu Jan 28 09:00:40 CET 2016


---
 src/PVE/LXC/Create.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Create.pm b/src/PVE/LXC/Create.pm
index 56ef471..67eb291 100644
--- a/src/PVE/LXC/Create.pm
+++ b/src/PVE/LXC/Create.pm
@@ -146,10 +146,12 @@ sub restore_and_configure {
     } else {
 	# restore: try to extract configuration from archive
 
+	my $pve_firewall_dir = '/etc/pve/firewall/';
 	my $pct_cfg_fn = "$rootdir/etc/vzdump/pct.conf";
 	my $pct_fwcfg_fn = "$rootdir/etc/vzdump/pct.fw";
 	my $ovz_cfg_fn = "$rootdir/etc/vzdump/vps.conf";
 	if (-f $pct_cfg_fn) {
+	    mkdir $pve_firewall_dir if (!-f '$pve_firewall_dir');
 	    my $raw = PVE::Tools::file_get_contents($pct_cfg_fn);
 	    my $oldconf = PVE::LXC::parse_pct_config("/lxc/$vmid.conf", $raw);
 
@@ -161,7 +163,7 @@ sub restore_and_configure {
 	    unlink($pct_cfg_fn);
 
 	    if (-f $pct_fwcfg_fn) {
-		PVE::Tools::file_copy($pct_fwcfg_fn, "/etc/pve/firewall/$vmid.fw");
+		PVE::Tools::file_copy($pct_fwcfg_fn, "${pve_firewall_dir}$vmid.fw");
 		unlink $pct_fwcfg_fn;
 	    }
 
-- 
2.1.4





More information about the pve-devel mailing list