From: Gabriel Goller <g.goller@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-manager v2 1/3] pvestatd: add fabrics status to pvestatd
Date: Fri, 22 Aug 2025 11:00:42 +0200 [thread overview]
Message-ID: <20250822090102.102949-11-g.goller@proxmox.com> (raw)
In-Reply-To: <20250822090102.102949-1-g.goller@proxmox.com>
Add the fabric status returned by SDN::status to the pvestatd resources.
This makes the fabrics visible in the SDN resources and in the node
resources. Previously the only SDN entity to be added where the SDN
zones, so a bit of restructuring is needed:
* we also return (and add to the resources) a `sdn_type`, which shows
which type of sdn entity this is (e.g. fabric, zone, etc.).
* we return/add to resources the `protocol` for fabrics as well, so in
the future we can do protocol-specific views.
Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
---
PVE/API2/Cluster.pm | 73 +++++++++++++++++++++++++++++++++--------
PVE/Service/pvestatd.pm | 12 ++++---
2 files changed, 68 insertions(+), 17 deletions(-)
diff --git a/PVE/API2/Cluster.pm b/PVE/API2/Cluster.pm
index 02a7ceffee02..c22f8d4fb0e1 100644
--- a/PVE/API2/Cluster.pm
+++ b/PVE/API2/Cluster.pm
@@ -423,6 +423,21 @@ __PACKAGE__->register_method({
optional => 1,
default => 0,
},
+ sdn => {
+ description => "The name of the sdn entity.",
+ type => "string",
+ optional => 1,
+ },
+ sdn_type => {
+ description => "The protocol if this item is a SDN fabric.",
+ type => "string",
+ optional => 1,
+ },
+ protocol => {
+ description => "The protocol if this item is a SDN fabric.",
+ type => "string",
+ optional => 1,
+ },
},
},
},
@@ -585,6 +600,8 @@ __PACKAGE__->register_method({
node => $node,
type => 'sdn',
status => 'ok',
+ # in the UI we want to show the localnetwork as a zone
+ sdn_type => 'zone',
};
push @$res, $local_sdn;
}
@@ -594,19 +611,49 @@ __PACKAGE__->register_method({
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 $node_config = decode_json($nodes->{$node});
+
+ # iterate through all sdn item types (vnet, zone, fabric, etc.)
+ for my $item_type (sort keys %{$node_config}) {
+ # the configuration of a sdn item type (all zones, all fabrics, etc.)
+ my $type_config = $node_config->{$item_type};
+ for my $id (sort keys %{$type_config}) {
+ my $status = $type_config->{$id};
+
+ my $new_entry = {
+ "sdn" => $id,
+ "node" => $node,
+ "type" => 'sdn',
+ "sdn_type" => $item_type,
+ "status" => $status->{status},
+ };
+
+ if ($item_type eq "zone") {
+ next
+ if !$rpcenv->check($authuser, "/sdn/zones/$id", ['SDN.Audit'],
+ 1);
+
+ $new_entry->{id} = "sdn/$node/$item_type/$id";
+ push @$res, $new_entry;
+ } elsif ($item_type eq "fabric") {
+ next
+ if !$rpcenv->check_any(
+ $authuser,
+ "/sdn/fabrics/$id",
+ ['SDN.Audit', 'SDN.Allocate'],
+ 1,
+ );
+
+ my $protocol = $status->{protocol};
+ $new_entry->{id} = "sdn/$node/$item_type/$protocol/$id";
+ $new_entry->{protocol} = $protocol;
+ push @$res, $new_entry;
+ } else {
+ # if the sdn type is not zones or fabric, just add it
+ $new_entry->{id} = "sdn/$node/$item_type/$id";
+ push @$res, $new_entry;
+ }
+ }
}
}
}
diff --git a/PVE/Service/pvestatd.pm b/PVE/Service/pvestatd.pm
index 618d6139af3e..507df4f6c475 100755
--- a/PVE/Service/pvestatd.pm
+++ b/PVE/Service/pvestatd.pm
@@ -766,12 +766,16 @@ sub update_ceph_metadata {
}
sub update_sdn_status {
-
if ($have_sdn) {
- my ($transport_status, $vnet_status) = PVE::Network::SDN::status();
+ my ($zone_status, $vnet_status, $fabric_status) = PVE::Network::SDN::status();
+
+ my $status = {};
+ $status->{zone} = $zone_status;
+ # don't include vnet status, as we don't have a UI panel to show infos for it
+ #$status->{vnet} = $vnet_status;
+ $status->{fabric} = $fabric_status;
- my $status = $transport_status ? encode_json($transport_status) : undef;
- PVE::Cluster::broadcast_node_kv("sdn", $status);
+ PVE::Cluster::broadcast_node_kv("sdn", encode_json($status));
}
}
--
2.47.2
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-08-22 9:01 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-22 9:00 [pve-devel] [PATCH manager/network/proxmox{-ve-rs, -perl-rs} v2 00/12] Add fabric status view Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-ve-rs v2 1/2] frr: make room for deserialization structs Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-ve-rs v2 2/2] frr: add deserialization types for openfabric and ospf Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 1/4] pve: fabrics: update proxmox-frr import path Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 2/4] fabrics: add function to get status of fabric Gabriel Goller
2025-08-25 8:11 ` Wolfgang Bumiller
2025-08-25 8:25 ` Wolfgang Bumiller
2025-08-25 11:39 ` Gabriel Goller
2025-08-25 14:37 ` Wolfgang Bumiller
2025-08-25 15:33 ` Gabriel Goller
2025-08-26 7:55 ` Wolfgang Bumiller
2025-08-26 8:29 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 3/4] fabrics: add function to get all routes distributed by the fabrics Gabriel Goller
2025-08-25 8:22 ` Wolfgang Bumiller
2025-08-25 11:40 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH proxmox-perl-rs v2 4/4] fabrics: add function to get all neighbors of the fabric Gabriel Goller
2025-08-25 8:28 ` Wolfgang Bumiller
2025-08-25 11:41 ` Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-network v2 1/3] fabrics: add fabrics status to SDN::status function Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-network v2 2/3] fabrics: add api endpoint to return fabrics routes Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-network v2 3/3] fabrics: add api endpoint to return fabric neighbors Gabriel Goller
2025-08-22 9:00 ` Gabriel Goller [this message]
2025-08-22 9:00 ` [pve-devel] [PATCH pve-manager v2 2/3] fabrics: add resource view for fabrics Gabriel Goller
2025-08-22 9:00 ` [pve-devel] [PATCH pve-manager v2 3/3] permissions: differentiate between zone and fabric paths Gabriel Goller
2025-08-26 9:52 ` [pve-devel] [PATCH manager/network/proxmox{-ve-rs, -perl-rs} v2 00/12] Add fabric status view Gabriel Goller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250822090102.102949-11-g.goller@proxmox.com \
--to=g.goller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.