[PATCH pve-network v2 2/2] sdn: Remove unneeded registered formats

Arthur Bied-Charreton
2026-02-06T16:12:53Z

Simple ID format verifications like length constraints and patterns have
been moved to the schema definitions. Remove the now redundant custom
verification code, iff no other code depends on the registered format.

Signed-off-by: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
---
src/PVE/Network/SDN/Controllers/Plugin.pm | 14 --------------
src/PVE/Network/SDN/Dns/Plugin.pm | 13 -------------
src/PVE/Network/SDN/Ipams/Plugin.pm | 13 -------------
src/PVE/Network/SDN/VnetPlugin.pm | 14 --------------
src/PVE/Network/SDN/Zones/Plugin.pm | 14 --------------
5 files changed, 68 deletions(-)

diff --git a/src/PVE/Network/SDN/Controllers/Plugin.pm b/src/PVE/Network/SDN/Controllers/Plugin.pm
index 73eaa0b..0a6e4e8 100644
--- a/src/PVE/Network/SDN/Controllers/Plugin.pm
+++ b/src/PVE/Network/SDN/Controllers/Plugin.pm
@@ -21,26 +21,12 @@ PVE::JSONSchema::register_standard_option(
{
description => "The SDN controller object identifier.",
type => 'string',
- format => 'pve-sdn-controller-id',
minLength => 2,
maxLength => 64,
pattern => '[a-zA-Z][a-zA-Z0-9_-]*[a-zA-Z0-9]',
},
);

-PVE::JSONSchema::register_format('pve-sdn-controller-id', \&parse_sdn_controller_id);
-
-sub parse_sdn_controller_id {
- my ($id, $noerr) = @_;
-
- if ($id !~ m/^[a-z][a-z0-9_-]*[a-z0-9]$/i) {
- return undef if $noerr;
- die "controller ID '$id' contains illegal characters\n";
- }
- die "controller ID '$id' can't be more length than 64 characters\n" if length($id) > 64;
- return $id;
-}
-
my $defaultData = {

propertyList => {
diff --git a/src/PVE/Network/SDN/Dns/Plugin.pm b/src/PVE/Network/SDN/Dns/Plugin.pm
index 8e623ba..4fc15b2 100644
--- a/src/PVE/Network/SDN/Dns/Plugin.pm
+++ b/src/PVE/Network/SDN/Dns/Plugin.pm
@@ -23,24 +23,11 @@ PVE::JSONSchema::register_standard_option(
{
description => "The SDN dns object identifier.",
type => 'string',
- format => 'pve-sdn-dns-id',
pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
minLength => 2,
},
);

-PVE::JSONSchema::register_format('pve-sdn-dns-id', \&parse_sdn_dns_id);
-
-sub parse_sdn_dns_id {
- my ($id, $noerr) = @_;
-
- if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) {
- return undef if $noerr;
- die "dns ID '$id' contains illegal characters\n";
- }
- return $id;
-}
-
my $defaultData = {

propertyList => {
diff --git a/src/PVE/Network/SDN/Ipams/Plugin.pm b/src/PVE/Network/SDN/Ipams/Plugin.pm
index 422fbc8..26d0931 100644
--- a/src/PVE/Network/SDN/Ipams/Plugin.pm
+++ b/src/PVE/Network/SDN/Ipams/Plugin.pm
@@ -24,24 +24,11 @@ PVE::JSONSchema::register_standard_option(
{
description => "The SDN ipam object identifier.",
type => 'string',
- format => 'pve-sdn-ipam-id',
pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
minLength => 2,
},
);

-PVE::JSONSchema::register_format('pve-sdn-ipam-id', \&parse_sdn_ipam_id);
-
-sub parse_sdn_ipam_id {
- my ($id, $noerr) = @_;
-
- if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) {
- return undef if $noerr;
- die "ipam ID '$id' contains illegal characters\n";
- }
- return $id;
-}
-
my $defaultData = {

propertyList => {
diff --git a/src/PVE/Network/SDN/VnetPlugin.pm b/src/PVE/Network/SDN/VnetPlugin.pm
index 5ceb3a1..e041575 100644
--- a/src/PVE/Network/SDN/VnetPlugin.pm
+++ b/src/PVE/Network/SDN/VnetPlugin.pm
@@ -21,26 +21,12 @@ PVE::JSONSchema::register_standard_option(
{
description => "The SDN vnet object identifier.",
type => 'string',
- format => 'pve-sdn-vnet-id',
pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
minLength => 2,
maxLength => 8,
},
);

-PVE::JSONSchema::register_format('pve-sdn-vnet-id', \&parse_sdn_vnet_id);
-
-sub parse_sdn_vnet_id {
- my ($id, $noerr) = @_;
-
- if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) {
- return undef if $noerr;
- die "vnet ID '$id' contains illegal characters\n";
- }
- die "vnet ID '$id' can't be more length than 8 characters\n" if length($id) > 8;
- return $id;
-}
-
my $defaultData = {

propertyList => {
diff --git a/src/PVE/Network/SDN/Zones/Plugin.pm b/src/PVE/Network/SDN/Zones/Plugin.pm
index 2a02278..5d858af 100644
--- a/src/PVE/Network/SDN/Zones/Plugin.pm
+++ b/src/PVE/Network/SDN/Zones/Plugin.pm
@@ -23,26 +23,12 @@ PVE::JSONSchema::register_standard_option(
{
description => "The SDN zone object identifier.",
type => 'string',
- format => 'pve-sdn-zone-id',
pattern => '[a-zA-Z][a-zA-Z0-9]*[a-zA-Z0-9]',
minLength => 2,
maxLength => 8,
},
);

-PVE::JSONSchema::register_format('pve-sdn-zone-id', \&parse_sdn_zone_id);
-
-sub parse_sdn_zone_id {
- my ($id, $noerr) = @_;
-
- if ($id !~ m/^[a-z][a-z0-9]*[a-z0-9]$/i) {
- return undef if $noerr;
- die "zone ID '$id' contains illegal characters\n";
- }
- die "zone ID '$id' can't be more length than 8 characters\n" if length($id) > 8;
- return $id;
-}
-
my $defaultData = {

propertyList => {
--
2.47.3