public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH v2 pve-network] sdn: require mac in IPAM API calls
@ 2023-11-23 16:16 Stefan Lendl
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Lendl @ 2023-11-23 16:16 UTC (permalink / raw)
  To: pve-devel

standard_option for 'mac-addr' is declared in EVPN where mac-addr is optional.
The DELETE endpoint did actually delete from IPAM without a MAC but it would
remain in macs.db which brings ends up in a bad state.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---

Changes v2:
* removed the if($mac) because we require this check when called from other places


 src/PVE/API2/Network/SDN/Ips.pm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Ips.pm b/src/PVE/API2/Network/SDN/Ips.pm
index 0003b2a..0edabd8 100644
--- a/src/PVE/API2/Network/SDN/Ips.pm
+++ b/src/PVE/API2/Network/SDN/Ips.pm
@@ -27,7 +27,11 @@ __PACKAGE__->register_method ({
 	properties => {
 	    zone => get_standard_option('pve-sdn-zone-id'),
 	    vnet => get_standard_option('pve-sdn-vnet-id'),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to delete",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
@@ -66,7 +70,11 @@ __PACKAGE__->register_method ({
 	properties => {
 	    zone => get_standard_option('pve-sdn-zone-id'),
 	    vnet => get_standard_option('pve-sdn-vnet-id'),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to add",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
@@ -104,7 +112,11 @@ __PACKAGE__->register_method ({
 	    vmid => get_standard_option('pve-vmid', {
 		optional => 1,
 	    }),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to update",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
-- 
2.42.0





^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [pve-devel] [PATCH v2 pve-network] sdn: require mac in IPAM API calls
  2023-11-23 16:26 Stefan Lendl
@ 2023-11-23 16:30 ` Stefan Lendl
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Lendl @ 2023-11-23 16:30 UTC (permalink / raw)
  To: pve-devel


sorry, I sent this twice.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH v2 pve-network] sdn: require mac in IPAM API calls
@ 2023-11-23 16:26 Stefan Lendl
  2023-11-23 16:30 ` Stefan Lendl
  0 siblings, 1 reply; 3+ messages in thread
From: Stefan Lendl @ 2023-11-23 16:26 UTC (permalink / raw)
  To: pve-devel

standard_option for 'mac-addr' is declared in EVPN where mac-addr is optional.
The DELETE endpoint did actually delete from IPAM without a MAC but it would
remain in macs.db which brings ends up in a bad state.

Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
---

Changes v2:
* removed the if($mac) because we require this check when called from other places


 src/PVE/API2/Network/SDN/Ips.pm | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/PVE/API2/Network/SDN/Ips.pm b/src/PVE/API2/Network/SDN/Ips.pm
index 0003b2a..0edabd8 100644
--- a/src/PVE/API2/Network/SDN/Ips.pm
+++ b/src/PVE/API2/Network/SDN/Ips.pm
@@ -27,7 +27,11 @@ __PACKAGE__->register_method ({
 	properties => {
 	    zone => get_standard_option('pve-sdn-zone-id'),
 	    vnet => get_standard_option('pve-sdn-vnet-id'),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to delete",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
@@ -66,7 +70,11 @@ __PACKAGE__->register_method ({
 	properties => {
 	    zone => get_standard_option('pve-sdn-zone-id'),
 	    vnet => get_standard_option('pve-sdn-vnet-id'),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to add",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
@@ -104,7 +112,11 @@ __PACKAGE__->register_method ({
 	    vmid => get_standard_option('pve-vmid', {
 		optional => 1,
 	    }),
-	    mac => get_standard_option('mac-addr'),
+	    mac => {
+		type => 'string',
+		description => "MAC Address of the IP to update",
+		format => 'mac-addr'
+	    },
 	    ip => {
 		type => 'string',
 		format => 'ip',
-- 
2.42.0





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-23 16:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-23 16:16 [pve-devel] [PATCH v2 pve-network] sdn: require mac in IPAM API calls Stefan Lendl
2023-11-23 16:26 Stefan Lendl
2023-11-23 16:30 ` Stefan Lendl

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