From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 0BC7F1FF17E for ; Thu, 30 Oct 2025 16:50:02 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6AC7B27431; Thu, 30 Oct 2025 16:49:09 +0100 (CET) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Thu, 30 Oct 2025 16:48:38 +0100 Message-ID: <20251030154851.540408-32-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251030154851.540408-1-s.hanreich@proxmox.com> References: <20251030154851.540408-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.183 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pve-devel] [PATCH pve-manager 4/8] pvestatd: sdn: adapt to changes in status reporting 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" Since pve-network now includes the fabric status in its top-level status function call, move pvestatd over to use the zone-specific function for generating SDN resources instead. Additionally, the zone_type field has been added in the output of the zone status, so broadcast and return that field as well. Main use-case for now is discerning the type of zones, to decide which panels to show in the SDN browser. Also, the have_sdn guard can be removed since SDN is pre-installed and therefore the guard is no longer needed. Signed-off-by: Stefan Hanreich --- PVE/API2/Cluster.pm | 42 +++++++++++++++++++++++------------------ PVE/Service/pvestatd.pm | 16 ++++------------ 2 files changed, 28 insertions(+), 30 deletions(-) diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm index 34523fd7e..f8e6ed47c 100644 --- a/PVE/API2/Cluster.pm +++ b/PVE/API2/Cluster.pm @@ -443,6 +443,11 @@ __PACKAGE__->register_method({ enum => ["fabric"], optional => 1, }, + zone_type => { + description => "The type of an SDN zone (for type 'sdn').", + type => "string", + optional => 1, + }, protocol => { description => "The protocol of a fabric (for type 'network', network_type 'fabric').", @@ -616,24 +621,25 @@ __PACKAGE__->register_method({ } } - if ($have_sdn) { - my $nodes = PVE::Cluster::get_node_kv("sdn"); - - for my $node (sort keys %{$nodes}) { - my $sdns = decode_json($nodes->{$node}); - - for my $id (sort keys %{$sdns}) { - next if !$rpcenv->check($authuser, "/sdn/zones/$id", ['SDN.Audit'], 1); - my $sdn = $sdns->{$id}; - my $entry = { - id => "sdn/$node/$id", - sdn => $id, - node => $node, - type => 'sdn', - status => $sdn->{'status'}, - }; - push @$res, $entry; - } + my $nodes = PVE::Cluster::get_node_kv("sdn"); + + for my $node (sort keys %{$nodes}) { + my $sdns = decode_json($nodes->{$node}); + + for my $id (sort keys %{$sdns}) { + next if !$rpcenv->check($authuser, "/sdn/zones/$id", ['SDN.Audit'], 1); + my $sdn = $sdns->{$id}; + my $entry = { + id => "sdn/$node/$id", + sdn => $id, + node => $node, + type => 'sdn', + status => $sdn->{'status'}, + }; + + $entry->{zone_type} = $sdn->{zone_type} if defined($sdn->{zone_type}); + + push @$res, $entry; } } } diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm index 862bf8b43..84e8cf7c0 100755 --- a/PVE/Service/pvestatd.pm +++ b/PVE/Service/pvestatd.pm @@ -15,6 +15,7 @@ use PVE::CpuSet; use Filesys::Df; use PVE::INotify; use PVE::Network; +use PVE::Network::SDN::Zones; use PVE::RS::SDN::Fabrics; use PVE::NodeConfig; use PVE::Cluster qw(cfs_read_file); @@ -38,12 +39,6 @@ use PVE::Status::Plugin; use base qw(PVE::Daemon); -my $have_sdn; -eval { - require PVE::Network::SDN; - $have_sdn = 1; -}; - my $opt_debug; my $restart_request; @@ -767,13 +762,10 @@ sub update_ceph_metadata { } sub update_sdn_status { + my ($zone_status, $vnet_status) = PVE::Network::SDN::Zones::status(); - if ($have_sdn) { - my ($transport_status, $vnet_status) = PVE::Network::SDN::status(); - - my $status = $transport_status ? encode_json($transport_status) : undef; - PVE::Cluster::broadcast_node_kv("sdn", $status); - } + my $status = $zone_status ? encode_json($zone_status) : undef; + PVE::Cluster::broadcast_node_kv("sdn", $status); } sub update_network_status { -- 2.47.3 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel