public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Arthur Bied-Charreton <a.bied-charreton@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH pve-network v2 2/2] sdn: Remove unneeded registered formats
Date: Fri,  6 Feb 2026 17:12:34 +0100	[thread overview]
Message-ID: <20260206161236.335026-4-a.bied-charreton@proxmox.com> (raw)
In-Reply-To: <20260206161236.335026-1-a.bied-charreton@proxmox.com>

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




  parent reply	other threads:[~2026-02-06 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-06 16:12 [PATCH proxmox, pve-{common,network,storage} v2 0/5] fix #7077: Improve error messages for ID verification Arthur Bied-Charreton
2026-02-06 16:12 ` [PATCH pve-common v2 1/1] fix #7077: Change JSON Schema attribute validation order Arthur Bied-Charreton
2026-02-06 16:12 ` [PATCH pve-network v2 1/2] fix #7077: Enforce ID format in JSON schema definitions Arthur Bied-Charreton
2026-02-06 16:12 ` Arthur Bied-Charreton [this message]
2026-02-06 16:12 ` [PATCH pve-storage v2 1/1] fix #7077: lvm: Improve ID verification error messages Arthur Bied-Charreton
2026-02-06 16:12 ` [PATCH proxmox v2 1/1] fix #7077: Improve SDN ID validation " Arthur Bied-Charreton

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=20260206161236.335026-4-a.bied-charreton@proxmox.com \
    --to=a.bied-charreton@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal