From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 07F3AA030A for ; Wed, 8 Nov 2023 12:36:26 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id DD9C46A1C for ; Wed, 8 Nov 2023 12:35:55 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Wed, 8 Nov 2023 12:35:55 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3B58F47397; Wed, 8 Nov 2023 12:35:55 +0100 (CET) From: Stefan Lendl To: pve-devel@lists.proxmox.com Date: Wed, 8 Nov 2023 12:35:34 +0100 Message-ID: <20231108113535.3905405-2-s.lendl@proxmox.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231108113535.3905405-1-s.lendl@proxmox.com> References: <20231108113535.3905405-1-s.lendl@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.072 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - Subject: [pve-devel] [PATCH pve-firewall 1/2] Manually construct guest config path X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Nov 2023 11:36:26 -0000 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 --- 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