public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed
@ 2025-07-23 15:49 Gabriel Goller
  2025-07-23 16:26 ` Stefan Hanreich
  2025-07-23 16:46 ` [pve-devel] applied: " Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Gabriel Goller @ 2025-07-23 15:49 UTC (permalink / raw)
  To: pve-devel

When frr isn't installed (happens e.g. on pve8 to 9 update) then the SDN
and Networking "Apply Configuration" task will throw an error because it
can't access the frr daemons file to check if the daemons are enabled.
In order to fix this, check if the frr config file exists before
continuing with the frr config generation.

Also make the "daemons file does not exist" error nicer.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
 src/PVE/Network/SDN.pm     | 5 +++++
 src/PVE/Network/SDN/Frr.pm | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
index 66665a409305..d2ba31283a57 100644
--- a/src/PVE/Network/SDN.pm
+++ b/src/PVE/Network/SDN.pm
@@ -355,6 +355,11 @@ sub get_frr_daemon_status {
 sub generate_frr_config {
     my ($apply) = @_;
 
+    if (!-e $PVE::Network::SDN::Frr::FRR_CONFIG_FILE) {
+        print "frr is not installed, not generating any frr configuration\n";
+        return;
+    }
+
     my $running_config = PVE::Network::SDN::running_config();
     my $fabric_config = PVE::Network::SDN::Fabrics::config(1);
 
diff --git a/src/PVE/Network/SDN/Frr.pm b/src/PVE/Network/SDN/Frr.pm
index 52fa456e2181..451ce1d87212 100644
--- a/src/PVE/Network/SDN/Frr.pm
+++ b/src/PVE/Network/SDN/Frr.pm
@@ -44,7 +44,7 @@ sub read_local_frr_config {
     }
 }
 
-my $FRR_CONFIG_FILE = "/etc/frr/frr.conf";
+our $FRR_CONFIG_FILE = "/etc/frr/frr.conf";
 
 =head3 apply()
 
@@ -130,7 +130,7 @@ sub set_daemon_status {
     my ($daemon_status, $set_default) = @_;
 
     my $daemons_file = "/etc/frr/daemons";
-    die "daemons file does not exist" if !-e $daemons_file;
+    die "/etc/frr/daemons file does not exist; is the frr package installed?\n" if !-e $daemons_file;
 
     for my $daemon (keys %$daemon_status) {
         die "$daemon is not SDN managed" if !defined $SDN_DAEMONS_DEFAULT->{$daemon};
-- 
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] 4+ messages in thread

* Re: [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed
  2025-07-23 15:49 [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed Gabriel Goller
@ 2025-07-23 16:26 ` Stefan Hanreich
  2025-07-23 16:28   ` Thomas Lamprecht
  2025-07-23 16:46 ` [pve-devel] applied: " Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hanreich @ 2025-07-23 16:26 UTC (permalink / raw)
  To: Proxmox VE development discussion, Gabriel Goller

On 7/23/25 17:49, Gabriel Goller wrote:
> When frr isn't installed (happens e.g. on pve8 to 9 update) then the SDN
> and Networking "Apply Configuration" task will throw an error because it
> can't access the frr daemons file to check if the daemons are enabled.
> In order to fix this, check if the frr config file exists before
> continuing with the frr config generation.
> 
> Also make the "daemons file does not exist" error nicer.
> 
> Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
> ---
>  src/PVE/Network/SDN.pm     | 5 +++++
>  src/PVE/Network/SDN/Frr.pm | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/PVE/Network/SDN.pm b/src/PVE/Network/SDN.pm
> index 66665a409305..d2ba31283a57 100644
> --- a/src/PVE/Network/SDN.pm
> +++ b/src/PVE/Network/SDN.pm
> @@ -355,6 +355,11 @@ sub get_frr_daemon_status {
>  sub generate_frr_config {
>      my ($apply) = @_;
>  
> +    if (!-e $PVE::Network::SDN::Frr::FRR_CONFIG_FILE) {
> +        print "frr is not installed, not generating any frr configuration\n";
> +        return;
> +    }
> +

The old code checked for the existence of /etc/frr [1] - maybe we should
keep it like that?

[1]
https://git.proxmox.com/?p=pve-network.git;a=blob;f=src/PVE/Network/SDN/Controllers/EvpnPlugin.pm;h=5b1a9aa73c8048bab21d9087d1ba4715f4d2425a;hb=8f4f5d2074989cf814d2f2312360239377c495f5#l612

>      my $running_config = PVE::Network::SDN::running_config();
>      my $fabric_config = PVE::Network::SDN::Fabrics::config(1);
>  
> diff --git a/src/PVE/Network/SDN/Frr.pm b/src/PVE/Network/SDN/Frr.pm
> index 52fa456e2181..451ce1d87212 100644
> --- a/src/PVE/Network/SDN/Frr.pm
> +++ b/src/PVE/Network/SDN/Frr.pm
> @@ -44,7 +44,7 @@ sub read_local_frr_config {
>      }
>  }
>  
> -my $FRR_CONFIG_FILE = "/etc/frr/frr.conf";
> +our $FRR_CONFIG_FILE = "/etc/frr/frr.conf";
>  
>  =head3 apply()
>  
> @@ -130,7 +130,7 @@ sub set_daemon_status {
>      my ($daemon_status, $set_default) = @_;
>  
>      my $daemons_file = "/etc/frr/daemons";
> -    die "daemons file does not exist" if !-e $daemons_file;
> +    die "/etc/frr/daemons file does not exist; is the frr package installed?\n" if !-e $daemons_file;
>  
>      for my $daemon (keys %$daemon_status) {
>          die "$daemon is not SDN managed" if !defined $SDN_DAEMONS_DEFAULT->{$daemon};



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


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

* Re: [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed
  2025-07-23 16:26 ` Stefan Hanreich
@ 2025-07-23 16:28   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-07-23 16:28 UTC (permalink / raw)
  To: Proxmox VE development discussion, Stefan Hanreich, Gabriel Goller

Am 23.07.25 um 18:26 schrieb Stefan Hanreich:
>> +    if (!-e $PVE::Network::SDN::Frr::FRR_CONFIG_FILE) {
>> +        print "frr is not installed, not generating any frr configuration\n";
>> +        return;
>> +    }
>> +
> The old code checked for the existence of /etc/frr [1] - maybe we should
> keep it like that?
> 
> [1]
> https://git.proxmox.com/?p=pve-network.git;a=blob;f=src/PVE/Network/SDN/Controllers/EvpnPlugin.pm;h=5b1a9aa73c8048bab21d9087d1ba4715f4d2425a;hb=8f4f5d2074989cf814d2f2312360239377c495f5#l612

Yeah, might become a "chicken and egg" problem otherwise.


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


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

* [pve-devel] applied: [PATCH network] frr: early exit on apply when frr is not installed
  2025-07-23 15:49 [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed Gabriel Goller
  2025-07-23 16:26 ` Stefan Hanreich
@ 2025-07-23 16:46 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2025-07-23 16:46 UTC (permalink / raw)
  To: pve-devel, Gabriel Goller

On Wed, 23 Jul 2025 17:49:34 +0200, Gabriel Goller wrote:
> When frr isn't installed (happens e.g. on pve8 to 9 update) then the SDN
> and Networking "Apply Configuration" task will throw an error because it
> can't access the frr daemons file to check if the daemons are enabled.
> In order to fix this, check if the frr config file exists before
> continuing with the frr config generation.
> 
> Also make the "daemons file does not exist" error nicer.
> 
> [...]

Applied, but switch back to just checking for the /etc/frr directory as Stefan
suggested, thanks!

[1/1] frr: early exit on apply when frr is not installed
      commit: 7ca344383c237e8946cb73c3f9d3804608461e16


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


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

end of thread, other threads:[~2025-07-23 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-23 15:49 [pve-devel] [PATCH network] frr: early exit on apply when frr is not installed Gabriel Goller
2025-07-23 16:26 ` Stefan Hanreich
2025-07-23 16:28   ` Thomas Lamprecht
2025-07-23 16:46 ` [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