[pve-devel] [PATCH pve-manager v4 03/10] pvestatd: add network resource to status reporting
Stefan Hanreich
s.hanreich at proxmox.com
Thu Nov 13 17:19:17 CET 2025
From: Gabriel Goller <g.goller at proxmox.com>
The new network resource will act as the top-level resource for all
networking entities (including SDN entities). The network resource
contains a network_type field, which indicates the type of networking
resource - similar to how the storage plugin handles different types
of storages. For now, it contains SDN fabrics and the SDN zones have
been copied over as well.
The main reason for moving over to a new resource type is the current
ID schema of the SDN resource, which is 'sdn/{zone_id}'. This makes it
hard to extend without the possibility of ID collisions. Additionally,
since the ID is used in several places throughout the backend / UI,
changing the schema would break compatibility with nodes that are on
an earlier version and would be an API break as well.
With this patch, nodes will still broadcast the old format for
backwards-compatibility. A subsequent patch for the resources API will
handle this case and ignore the old SDN resources from nodes that are
already sending the new format, to avoid including zones twice in the
returned resource data.
Co-authored-by: Stefan Hanreich <s.hanreich at proxmox.com>
Signed-off-by: Gabriel Goller <g.goller at proxmox.com>
Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
---
PVE/Service/pvestatd.pm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 618d6139a..572eb7eb5 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::RS::SDN::Fabrics;
use PVE::NodeConfig;
use PVE::Cluster qw(cfs_read_file);
use PVE::Storage;
@@ -775,6 +776,28 @@ sub update_sdn_status {
}
}
+sub update_network_status {
+ my $network_status = {};
+
+ my ($fabric_status) = PVE::RS::SDN::Fabrics::status();
+ for my $fabric (values $fabric_status->%*) {
+ $network_status->{"fabric/$fabric->{network}"} = $fabric;
+ }
+
+ my ($zone_status, $vnet_status) = PVE::Network::SDN::Zones::status();
+ for my $id (sort keys $zone_status->%*) {
+ my $zone = $zone_status->{$id};
+
+ $zone->{'network-type'} = 'zone';
+ $zone->{network} = $id;
+ $zone->{type} = 'network';
+
+ $network_status->{"zone/$id"} = $zone;
+ }
+
+ PVE::Cluster::broadcast_node_kv("network", encode_json($network_status));
+}
+
my $broadcast_version_info_done = 0;
my sub broadcast_version_info : prototype() {
if (
@@ -840,6 +863,10 @@ sub update_status {
$err = $@;
syslog('err', "sdn status update error: $err") if $err;
+ eval { update_network_status(); };
+ $err = $@;
+ syslog('err', "network status update error: $err") if $err;
+
eval { broadcast_version_info(); };
$err = $@;
syslog('err', "version info update error: $err") if $err;
--
2.47.3
More information about the pve-devel
mailing list