[pve-devel] [PATCH pve-network 6/6] network reload: fix UPID parsing

Alexandre Derumier aderumier at odiso.com
Thu Apr 20 23:36:22 CEST 2023


When warning or error from ifreload are logged,
They are received in 1 line in result of pvesh,

so the UPID is not at the begin, and not correctly parse

and throw a warning:

Use of uninitialized value $upid in pattern match (m//) at /usr/share/perl5/PVE/Tools.pm line 1106.
Use of uninitialized value $upid in concatenation (.) or string at /usr/share/perl5/PVE/Tools.pm line 1120.

Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/API2/Network/SDN.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/PVE/API2/Network/SDN.pm b/PVE/API2/Network/SDN.pm
index f129d60..33ecfb7 100644
--- a/PVE/API2/Network/SDN.pm
+++ b/PVE/API2/Network/SDN.pm
@@ -86,9 +86,10 @@ my $create_reload_network_worker = sub {
 
     # FIXME: how to proxy to final node ?
     my $upid;
+    print "$nodename: reloading network config\n";
     run_command(['pvesh', 'set', "/nodes/$nodename/network"], outfunc => sub {
 	my $line = shift;
-	if ($line =~ /^["']?(UPID:[^\s"']+)["']?$/) {
+	if ($line =~ /["']?(UPID:[^\s"']+)["']?$/) {
 	    $upid = $1;
 	}
     });
-- 
2.30.2





More information about the pve-devel mailing list