Remove require QemuConfig from Firewall.pm
We only use it to construct the guest config paths.
Fixes circular include when accessing Firewall::Aliases from
pve-network.

Signed-off-by: Stefan Lendl <s.le...@proxmox.com>
---
 src/PVE/Firewall.pm | 34 +++++++---------------------------
 1 file changed, 7 insertions(+), 27 deletions(-)

diff --git a/src/PVE/Firewall.pm b/src/PVE/Firewall.pm
index 77cbaf4..4db4b0c 100644
--- a/src/PVE/Firewall.pm
+++ b/src/PVE/Firewall.pm
@@ -28,22 +28,6 @@ use PVE::Firewall::Helpers;
 
 my $pvefw_conf_dir = "/etc/pve/firewall";
 my $clusterfw_conf_filename = "$pvefw_conf_dir/cluster.fw";
-
-# dynamically include PVE::QemuServer and PVE::LXC
-# to avoid dependency problems
-my $have_qemu_server;
-eval {
-    require PVE::QemuServer;
-    require PVE::QemuConfig;
-    $have_qemu_server = 1;
-};
-
-my $have_lxc;
-eval {
-    require PVE::LXC;
-    $have_lxc = 1;
-};
-
 my $pve_fw_status_dir = "/var/lib/pve-firewall";
 
 mkdir $pve_fw_status_dir; # make sure this exists
@@ -3257,18 +3241,14 @@ sub read_local_vm_config {
        next if !$d->{node} || $d->{node} ne $nodename;
        next if !$d->{type};
        if ($d->{type} eq 'qemu') {
-           if ($have_qemu_server) {
-               my $cfspath = PVE::QemuConfig->cfs_config_path($vmid);
-               if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
-                   $qemu->{$vmid} = $conf;
-               }
+           my $cfspath = "nodes/$nodename/qemu-server/$vmid.conf";
+           if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
+               $qemu->{$vmid} = $conf;
            }
-        } elsif ($d->{type} eq 'lxc') {
-           if ($have_lxc) {
-               my $cfspath = PVE::LXC::Config->cfs_config_path($vmid);
-               if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
-                   $lxc->{$vmid} = $conf;
-               }
+       } elsif ($d->{type} eq 'lxc') {
+           my $cfspath = "nodes/$nodename/lxc/$vmid.conf";
+           if (my $conf = PVE::Cluster::cfs_read_file($cfspath)) {
+               $lxc->{$vmid} = $conf;
            }
        }
     }
-- 
2.41.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to