From: Stefan Lendl <s.lendl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-firewall 1/2] Manually construct guest config path
Date: Wed, 8 Nov 2023 12:35:34 +0100 [thread overview]
Message-ID: <20231108113535.3905405-2-s.lendl@proxmox.com> (raw)
In-Reply-To: <20231108113535.3905405-1-s.lendl@proxmox.com>
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.lendl@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
next prev parent reply other threads:[~2023-11-08 11:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-08 11:35 [pve-devel] [PATCH firewall/network 0/2] SDN: Create firewall aliases for SDN subnets Stefan Lendl
2023-11-08 11:35 ` Stefan Lendl [this message]
2023-11-08 14:31 ` [pve-devel] [PATCH pve-firewall 1/2] Manually construct guest config path Thomas Lamprecht
2023-11-10 13:26 ` Stefan Lendl
2023-11-12 17:44 ` Thomas Lamprecht
2023-11-08 11:35 ` [pve-devel] [PATCH pve-network 2/2] Create a cluster-wide firewall for SDN subnets Stefan Lendl
2023-11-08 14:36 ` Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231108113535.3905405-2-s.lendl@proxmox.com \
--to=s.lendl@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox