public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH proxmox-perl-rs 1/1] firewall: sdn: ignore EPERM when reading the legacy IPAM file
@ 2024-11-20 14:47 Stefan Hanreich
  2024-11-20 15:25 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2024-11-20 14:47 UTC (permalink / raw)
  To: pve-devel

On fresh installations, neither the new nor the old IPAM db file
exist. This triggers our fallback code path and leads to errors in the
syslog on fresh installs where there is no IPAM database. This happens
whenever a firewall API call is made. Because of this, we choose to
ignore EPERM when reading the legacy files. This is okay, because we
move existing databases in the postinstall script of
libpve-network-perl, making the situation where the new file does not
exist, but the old file exists unlikely.

Reported-by: Alexander Zeidler <a.zeidler@proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
The change from () to {} is due to rustfmt quirks. Adding the or made
rustfmt change () to {()}, leading to another complaint by clippy
about an unnecessary unit type in the closure, which I then removed.

 pve-rs/src/firewall/sdn.rs | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/pve-rs/src/firewall/sdn.rs b/pve-rs/src/firewall/sdn.rs
index a7d7b80..faf5156 100644
--- a/pve-rs/src/firewall/sdn.rs
+++ b/pve-rs/src/firewall/sdn.rs
@@ -126,7 +126,9 @@ mod export {
             Err(e) if e.kind() == io::ErrorKind::NotFound => {
                 match fs::read_to_string(SDN_IPAM_LEGACY) {
                     Ok(data) => add_ipam_ipsets(data)?,
-                    Err(e) if e.kind() == io::ErrorKind::NotFound => (),
+                    Err(e)
+                        if e.kind() == io::ErrorKind::NotFound
+                            || e.kind() == io::ErrorKind::PermissionDenied => {}
                     Err(e) => bail!("Cannot open legacy IPAM database: {e:#}"),
                 }
             }
-- 
2.39.5


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [pve-devel] applied: [PATCH proxmox-perl-rs 1/1] firewall: sdn: ignore EPERM when reading the legacy IPAM file
  2024-11-20 14:47 [pve-devel] [PATCH proxmox-perl-rs 1/1] firewall: sdn: ignore EPERM when reading the legacy IPAM file Stefan Hanreich
@ 2024-11-20 15:25 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2024-11-20 15:25 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Hanreich

Am 20.11.24 um 15:47 schrieb Stefan Hanreich:
> On fresh installations, neither the new nor the old IPAM db file
> exist. This triggers our fallback code path and leads to errors in the
> syslog on fresh installs where there is no IPAM database. This happens
> whenever a firewall API call is made. Because of this, we choose to
> ignore EPERM when reading the legacy files. This is okay, because we
> move existing databases in the postinstall script of
> libpve-network-perl, making the situation where the new file does not
> exist, but the old file exists unlikely.
> 
> Reported-by: Alexander Zeidler <a.zeidler@proxmox.com>
> Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
> ---
> The change from () to {} is due to rustfmt quirks. Adding the or made
> rustfmt change () to {()}, leading to another complaint by clippy
> about an unnecessary unit type in the closure, which I then removed.

I changed it a bit to be added as separate match arm, being explicit here
can be nice w.r.t. using git blame to find out why this is the way it is.

> 
>  pve-rs/src/firewall/sdn.rs | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
>

applied, thanks!


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-11-20 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-20 14:47 [pve-devel] [PATCH proxmox-perl-rs 1/1] firewall: sdn: ignore EPERM when reading the legacy IPAM file Stefan Hanreich
2024-11-20 15:25 ` [pve-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal