[pve-devel] SPAM: [PATCH pve-network 11/16] ipam: nautobot: add update_ip sub

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
+ use default_headers to avoid code repetition

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 45 ++---
 1 file changed, 39 insertions(+), 6 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index c6581f9..e328c9f 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -32,6 +32,13 @@ sub default_ip_status {
 return 'Active';
 }
 
+sub default_headers {
+my ($plugin_config) = @_;
+my $token = $plugin_config->{token};
+
+return ['Content-Type' => "application/json", 'Authorization' => "token 
$token", 'Accept' => "application/json"];
+}
+
 # implem
 
 sub add_subnet {
@@ -40,9 +47,8 @@ sub add_subnet {
 my $cidr = $subnet->{cidr};
 my $gateway = $subnet->{gateway};
 my $url = $plugin_config->{url};
-my $token = $plugin_config->{token};
 my $namespace = $plugin_config->{namespace};
-my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
+my $headers = default_headers($plugin_config);
 
 my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
 
@@ -64,9 +70,8 @@ sub add_ip {
 
 my $mask = $subnet->{mask};
 my $url = $plugin_config->{url};
-my $token = $plugin_config->{token};
 my $namespace = $plugin_config->{namespace};
-my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
+my $headers = default_headers($plugin_config);
 
 my $description = undef;
 if ($is_gateway) {
@@ -91,13 +96,41 @@ sub add_ip {
 }
 
 
+sub update_ip {
+my ($class, $plugin_config, $subnetid, $subnet, $ip, $hostname, $mac, 
$vmid, $is_gateway, $noerr) = @_;
+
+my $mask = $subnet->{mask};
+my $url = $plugin_config->{url};
+my $namespace = $plugin_config->{namespace};
+my $headers = default_headers($plugin_config);
+
+my $description = undef;
+if ($is_gateway) {
+   $description = 'gateway'
+} elsif ($mac) {
+   $description = "mac:$mac";
+}
+
+my $params = { address => "$ip/$mask", type => "dhcp", dns_name => 
$hostname, description => $description, namespace => $namespace, status => 
default_ip_status()};
+
+my $ip_id = PVE::Network::SDN::Ipams::NetboxPlugin::get_ip_id($url, $ip, 
$headers);
+die "can't find ip $ip in ipam" if !$ip_id;
+
+eval {
+   PVE::Network::SDN::api_request("PATCH", 
"$url/ipam/ip-addresses/$ip_id/", $headers, $params);
+};
+if ($@) {
+   die "error updating ip $ip: $@" if !$noerr;
+}
+}
+
+
 sub verify_api {
 my ($class, $plugin_config) = @_;
 
 my $url = $plugin_config->{url};
-my $token = $plugin_config->{token};
 my $namespace = $plugin_config->{namespace};
-my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
+my $headers = default_headers($plugin_config);
 
 # check that the namespace exists AND that default IP active status
 # exists AND that we have indeed API access
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 14/16] ipam: nautobot: hacky ip range support

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
since nautobot lacks support for IP ranges,
this feature could be dropped / marked unsupported

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 26 -
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index bf9d34a..95e749c 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -104,15 +104,22 @@ sub add_range_next_freeip {
 my $headers = default_headers($plugin_config);
 my $cidr = $subnet->{cidr};
 
-my $range_offset = NetAddr::IP->new($range->{'start-address'}) - 
NetAddr::IP->new($cidr);
+my $minimal_size = NetAddr::IP->new($range->{'start-address'}) - 
NetAddr::IP->new($cidr);
 my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
-my $params = { offset => $range_offset };
 
 eval {
-   my $result = PVE::Network::SDN::api_request("POST", 
"$url/ipam/prefixes/$internalid/available-ips/", $headers, $params);
-   my ($ip, undef) = split(/\//, @{$result}[0]->{address});
-   print "found free ip $ip in range 
$range->{'start-address'}-$range->{'end-address'}\n" if $ip;
-   return $ip
+   my $result = PVE::Network::SDN::api_request("GET", 
"$url/ipam/prefixes/$internalid/available-ips/?limit=$minimal_size", $headers);
+   # v important for NetAddr::IP comparison!
+   my @ips = map((split(/\//,$_->{address}))[0], @{$result});
+   # get 1st result
+   my $ip = (get_ips_within_range($range->{'start-address'}, 
$range->{'end-address'}, @ips))[0];
+
+   if ($ip) {
+   print "found free ip $ip in range 
$range->{'start-address'}-$range->{'end-address'}\n"
+   } else { die "prefix out of space in range"; }
+
+   $class->add_ip($plugin_config, undef,  $subnet, $ip, $data->{hostname}, 
$data->{mac}, undef, 0, 0);
+   return $ip;
 };
 
 if ($@) {
@@ -199,6 +206,13 @@ sub on_update_hook {
 }
 
 # helpers
+sub get_ips_within_range {
+my ($start_address, $end_address, @list) = @_;
+$start_address = NetAddr::IP->new($start_address);
+$end_address = NetAddr::IP->new($end_address);
+return grep($start_address <= NetAddr::IP->new($_) <= $end_address, @list);
+}
+
 sub get_namespace_id {
 my ($url, $namespace, $headers) = @_;
 
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 09/16] ipam: nautobot: simplify query

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Nautobot can infer object IDs itself

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 6675ba4..c6581f9 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -48,10 +48,7 @@ sub add_subnet {
 
 #create subnet
 if (!$internalid) {
-   my $namespace_id = get_namespace_id($url, $namespace, $headers);
-   my $status_id = get_status_id($url, default_ip_status(), $headers);
-
-   my $params = { prefix => $cidr, namespace => { id => $namespace_id}, 
status => { id => $status_id}};
+   my $params = { prefix => $cidr, namespace => $namespace, status => 
default_ip_status()};
 
eval {
my $result = PVE::Network::SDN::api_request("POST", 
"$url/ipam/prefixes/", $headers, $params);
@@ -71,9 +68,6 @@ sub add_ip {
 my $namespace = $plugin_config->{namespace};
 my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
 
-my $namespace_id = get_namespace_id($url, $namespace, $headers);
-my $status_id = get_status_id($url, default_ip_status(), $headers);
-
 my $description = undef;
 if ($is_gateway) {
$description = 'gateway'
@@ -81,7 +75,7 @@ sub add_ip {
$description = "mac:$mac";
 }
 
-my $params = { address => "$ip/$mask", type => "dhcp", dns_name => 
$hostname, description => $description, namespace => { id => $namespace_id }, 
status => { id => $status_id }};
+my $params = { address => "$ip/$mask", type => "dhcp", dns_name => 
$hostname, description => $description, namespace => $namespace, status => 
default_ip_status()};
 
 eval {
PVE::Network::SDN::api_request("POST", "$url/ipam/ip-addresses/", 
$headers, $params);
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 02/16] ipam: add Nautobot plugin sources to Makefile

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Ipams/Makefile 
b/src/PVE/Network/SDN/Ipams/Makefile
index 4e7d65f..75e5b9a 100644
--- a/src/PVE/Network/SDN/Ipams/Makefile
+++ b/src/PVE/Network/SDN/Ipams/Makefile
@@ -1,4 +1,4 @@
-SOURCES=Plugin.pm PhpIpamPlugin.pm NetboxPlugin.pm PVEPlugin.pm
+SOURCES=Plugin.pm PhpIpamPlugin.pm NetboxPlugin.pm PVEPlugin.pm 
NautobotPlugin.pm
 
 
 PERL5DIR=${DESTDIR}/usr/share/perl5
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 03/16] ipam: change verify URL (now common to Nautobot and Netbox)

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
+ minimal module

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 22 -
 src/PVE/Network/SDN/Ipams/NetboxPlugin.pm   |  2 +-
 2 files changed, 1 insertion(+), 23 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 03bd3de..6597bfe 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -12,26 +12,4 @@ sub type {
 return 'nautobot';
 }
 
-sub verify_api {
-my ($class, $plugin_config) = @_;
-
-my $url = $plugin_config->{url};
-my $token = $plugin_config->{token};
-my $headers = [ 'Authorization' => "token $token", 'Accept' => 
"application/json; indent=4" ];
-
-eval {
-   PVE::Network::SDN::api_request("GET", "$url/ipam/namespaces", $headers);
-};
-if ($@) {
-   die "Can't connect to nautobot api: $@";
-}
-}
-
-# helpers
-sub on_update_hook {
-my ($class, $plugin_config) = @_;
-
-PVE::Network::SDN::Ipams::NautobotPlugin::verify_api($class, 
$plugin_config);
-}
-
 1;
diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index d923269..7efccaf 100644
--- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
@@ -240,7 +240,7 @@ sub verify_api {
 
 
 eval {
-   PVE::Network::SDN::api_request("GET", "$url/ipam/aggregates/", 
$headers);
+   PVE::Network::SDN::api_request("GET", "$url/ipam/prefixes/", $headers);
 };
 if ($@) {
die "Can't connect to netbox api: $@";
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 04/16] ipam: nautobot: add verification for ipam namespace plugin parameter

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 45 +
 1 file changed, 45 insertions(+)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 6597bfe..ebdc07b 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -12,4 +12,49 @@ sub type {
 return 'nautobot';
 }
 
+sub properties {
+return {
+   namespace => {
+   type => 'string',
+   },
+};
+}
+
+sub options {
+return {
+   url => { optional => 0 },
+   token => { optional => 0 },
+   namespace => { optional => 0 },
+};
+}
+
+# implem
+sub verify_api {
+my ($class, $plugin_config) = @_;
+
+my $url = $plugin_config->{url};
+my $token = $plugin_config->{token};
+my $namespace = $plugin_config->{namespace};
+my $headers = [ 'Authorization' => "token $token", 'Accept' => 
"application/json; indent=4" ];
+
+# check that the namespace exists AND that we have
+# indeed API access
+eval {
+   PVE::Network::SDN::Ipams::NautobotPlugin::get_namespace_id($url, 
$namespace, $headers) // die "namespace $namespace does not exist";
+};
+if ($@) {
+   die "Can't connect to nautobot api: $@";
+}
+}
+
+# helpers
+sub get_namespace_id {
+my ($url, $namespace, $headers) = @_;
+
+my $result = PVE::Network::SDN::api_request("GET", 
"$url/ipam/namespaces/?q=$namespace", $headers);
+my $data = @{$result->{results}}[0];
+my $internalid = $data->{id};
+return $internalid;
+}
+
 1;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 00/16] add support for Nautobot IPAM

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
This patch series introduce support for Nautobot as an IPAM.

Please note that:
- Some stuff could still be refined, in my opinion.
  I would be happy to receive some comments, as I'm a
  Perl beginner.
- Test code has not been written *yet*.
- Nautobot itself has some restrictions, for instance
  it does not support IP ranges. So I had to hack
  around this a bit. I'd be happy to only do prefix
  allocations, if that's possible.

MfG
--
Lou Lecrivain, WDZ GmbH

Lou Lecrivain (16):
  ipam: nautobot support initial commit
  ipam: add Nautobot plugin sources to Makefile
  ipam: change verify URL (now common to Nautobot and Netbox)
  ipam: nautobot: add verification for ipam namespace plugin parameter
  ipam: nautobot: fix on_update_hook for NautobotPlugin
  ipam: nautobot: add default active status check
  ipam: nautobot: fix typo
  ipam: nautobot: 1st working "add subnet" and "add ip"
  ipam: nautobot: simplify query
  ipam: nautobot: api endpoint change no longer needed
  ipam: nautobot: add update_ip sub
  ipam: nautobot: add get ips for mac function
  ipam: nautobot: 1st draft for allocating ip in dhcp range
  ipam: nautobot: hacky ip range support
  ipam: nautobot: implement plain prefix allocation (without ranges)
  ipam: nautobot: add word of warning for dhcp range support

 src/PVE/API2/Network/SDN/Ipams.pm   |   1 +
 src/PVE/Network/SDN/Ipams.pm|   3 +
 src/PVE/Network/SDN/Ipams/Makefile  |   2 +-
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 263 
 4 files changed, 268 insertions(+), 1 deletion(-)
 create mode 100644 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm

-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 06/16] ipam: nautobot: add default active status check

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 083ab20..53190bc 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -28,7 +28,12 @@ sub options {
 };
 }
 
+sub default_ip_status {
+return 'Active';
+}
+
 # implem
+
 sub verify_api {
 my ($class, $plugin_config) = @_;
 
@@ -37,13 +42,14 @@ sub verify_api {
 my $namespace = $plugin_config->{namespace};
 my $headers = [ 'Authorization' => "token $token", 'Accept' => 
"application/json; indent=4" ];
 
-# check that the namespace exists AND that we have
-# indeed API access
+# check that the namespace exists AND that default IP active status
+# exists AND that we have indeed API access
 eval {
PVE::Network::SDN::Ipams::NautobotPlugin::get_namespace_id($url, 
$namespace, $headers) // die "namespace $namespace does not exist";
+   PVE::Network::SDN::Ipams::NautobotPlugin::get_status_id($url, 
default_ip_status(), $headers) // die "default IP status ". default_ip_status() 
. " not found";
 };
 if ($@) {
-   die "Can't connect to nautobot api: $@";
+   die "Can't use nautobot api: $@";
 }
 }
 
@@ -63,4 +69,13 @@ sub get_namespace_id {
 return $internalid;
 }
 
+sub get_status_id {
+my ($url, $status, $headers) = @_;
+
+my $result = PVE::Network::SDN::api_request("GET", 
"$url/extra/statuses/?q=$status", $headers);
+my $data = @{$result->{results}}[0];
+my $internalid = $data->{id};
+return $internalid;
+}
+
 1;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 13/16] ipam: nautobot: 1st draft for allocating ip in dhcp range

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
offset has to be fixed - we can't guarantee correct start
if IPs outside range have been boked

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 25 +
 1 file changed, 25 insertions(+)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 69e7897..bf9d34a 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -5,6 +5,7 @@ use warnings;
 use PVE::INotify;
 use PVE::Cluster;
 use PVE::Tools;
+use NetAddr::IP;
 
 use base('PVE::Network::SDN::Ipams::NetboxPlugin');
 
@@ -95,6 +96,30 @@ sub add_ip {
 }
 }
 
+sub add_range_next_freeip {
+my ($class, $plugin_config, $subnet, $range, $data, $noerr) = @_;
+
+my $url = $plugin_config->{url};
+my $namespace = $plugin_config->{namespace};
+my $headers = default_headers($plugin_config);
+my $cidr = $subnet->{cidr};
+
+my $range_offset = NetAddr::IP->new($range->{'start-address'}) - 
NetAddr::IP->new($cidr);
+my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
+my $params = { offset => $range_offset };
+
+eval {
+   my $result = PVE::Network::SDN::api_request("POST", 
"$url/ipam/prefixes/$internalid/available-ips/", $headers, $params);
+   my ($ip, undef) = split(/\//, @{$result}[0]->{address});
+   print "found free ip $ip in range 
$range->{'start-address'}-$range->{'end-address'}\n" if $ip;
+   return $ip
+};
+
+if ($@) {
+   die "can't find free ip in range 
$range->{'start-address'}-$range->{'end-address'}: $@" if !$noerr;
+}
+}
+
 
 sub update_ip {
 my ($class, $plugin_config, $subnetid, $subnet, $ip, $hostname, $mac, 
$vmid, $is_gateway, $noerr) = @_;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 08/16] ipam: nautobot: 1st working "add subnet" and "add ip"

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 69 -
 1 file changed, 66 insertions(+), 3 deletions(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index ee0ad49..6675ba4 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -34,19 +34,82 @@ sub default_ip_status {
 
 # implem
 
+sub add_subnet {
+my ($class, $plugin_config, $subnetid, $subnet, $noerr) = @_;
+
+my $cidr = $subnet->{cidr};
+my $gateway = $subnet->{gateway};
+my $url = $plugin_config->{url};
+my $token = $plugin_config->{token};
+my $namespace = $plugin_config->{namespace};
+my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
+
+my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
+
+#create subnet
+if (!$internalid) {
+   my $namespace_id = get_namespace_id($url, $namespace, $headers);
+   my $status_id = get_status_id($url, default_ip_status(), $headers);
+
+   my $params = { prefix => $cidr, namespace => { id => $namespace_id}, 
status => { id => $status_id}};
+
+   eval {
+   my $result = PVE::Network::SDN::api_request("POST", 
"$url/ipam/prefixes/", $headers, $params);
+   };
+   if ($@) {
+   die "error adding subnet to ipam: $@" if !$noerr;
+   }
+}
+}
+
+sub add_ip {
+my ($class, $plugin_config, $subnetid, $subnet, $ip, $hostname, $mac, 
$vmid, $is_gateway, $noerr) = @_;
+
+my $mask = $subnet->{mask};
+my $url = $plugin_config->{url};
+my $token = $plugin_config->{token};
+my $namespace = $plugin_config->{namespace};
+my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
+
+my $namespace_id = get_namespace_id($url, $namespace, $headers);
+my $status_id = get_status_id($url, default_ip_status(), $headers);
+
+my $description = undef;
+if ($is_gateway) {
+   $description = 'gateway'
+} elsif ($mac) {
+   $description = "mac:$mac";
+}
+
+my $params = { address => "$ip/$mask", type => "dhcp", dns_name => 
$hostname, description => $description, namespace => { id => $namespace_id }, 
status => { id => $status_id }};
+
+eval {
+   PVE::Network::SDN::api_request("POST", "$url/ipam/ip-addresses/", 
$headers, $params);
+};
+
+if ($@) {
+   if($is_gateway) {
+   die "error adding subnet ip to ipam: ip $ip already exists: $@" if 
!PVE::Network::SDN::Ipams::NetboxPlugin::is_ip_gateway($url, $ip, $headers) && 
!$noerr;
+   } else {
+   die "error adding subnet ip to ipam: ip $ip already exists: $@" if 
!$noerr;
+   }
+}
+}
+
+
 sub verify_api {
 my ($class, $plugin_config) = @_;
 
 my $url = $plugin_config->{url};
 my $token = $plugin_config->{token};
 my $namespace = $plugin_config->{namespace};
-my $headers = [ 'Authorization' => "token $token", 'Accept' => 
"application/json; indent=4" ];
+my $headers = ['Content-Type' => "application/json", 'Authorization' => 
"token $token", 'Accept' => "application/json"];
 
 # check that the namespace exists AND that default IP active status
 # exists AND that we have indeed API access
 eval {
-   PVE::Network::SDN::Ipams::NautobotPlugin::get_namespace_id($url, 
$namespace, $headers) // die "namespace $namespace does not exist";
-   PVE::Network::SDN::Ipams::NautobotPlugin::get_status_id($url, 
default_ip_status(), $headers) // die "default IP status ". default_ip_status() 
. " not found";
+   get_namespace_id($url, $namespace, $headers) // die "namespace 
$namespace does not exist";
+   get_status_id($url, default_ip_status(), $headers) // die "default IP 
status ". default_ip_status() . " not found";
 };
 if ($@) {
die "Can't use nautobot api: $@";
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 01/16] ipam: nautobot support initial commit

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/API2/Network/SDN/Ipams.pm   |  1 +
 src/PVE/Network/SDN/Ipams.pm|  3 ++
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 37 +
 3 files changed, 41 insertions(+)
 create mode 100644 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm

diff --git a/src/PVE/API2/Network/SDN/Ipams.pm 
b/src/PVE/API2/Network/SDN/Ipams.pm
index 27ead02..8074512 100644
--- a/src/PVE/API2/Network/SDN/Ipams.pm
+++ b/src/PVE/API2/Network/SDN/Ipams.pm
@@ -12,6 +12,7 @@ use PVE::Network::SDN::Ipams::Plugin;
 use PVE::Network::SDN::Ipams::PVEPlugin;
 use PVE::Network::SDN::Ipams::PhpIpamPlugin;
 use PVE::Network::SDN::Ipams::NetboxPlugin;
+use PVE::Network::SDN::Ipams::NautobotPlugin;
 use PVE::Network::SDN::Dhcp;
 use PVE::Network::SDN::Vnets;
 use PVE::Network::SDN::Zones;
diff --git a/src/PVE/Network/SDN/Ipams.pm b/src/PVE/Network/SDN/Ipams.pm
index c689b8f..2ecb75e 100644
--- a/src/PVE/Network/SDN/Ipams.pm
+++ b/src/PVE/Network/SDN/Ipams.pm
@@ -12,11 +12,14 @@ use PVE::Network;
 
 use PVE::Network::SDN::Ipams::PVEPlugin;
 use PVE::Network::SDN::Ipams::NetboxPlugin;
+use PVE::Network::SDN::Ipams::NautobotPlugin;
 use PVE::Network::SDN::Ipams::PhpIpamPlugin;
 use PVE::Network::SDN::Ipams::Plugin;
 
+
 PVE::Network::SDN::Ipams::PVEPlugin->register();
 PVE::Network::SDN::Ipams::NetboxPlugin->register();
+PVE::Network::SDN::Ipams::NautobotPlugin->register();
 PVE::Network::SDN::Ipams::PhpIpamPlugin->register();
 PVE::Network::SDN::Ipams::Plugin->init();
 
diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
new file mode 100644
index 000..03bd3de
--- /dev/null
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -0,0 +1,37 @@
+package PVE::Network::SDN::Ipams::NautobotPlugin;
+
+use strict;
+use warnings;
+use PVE::INotify;
+use PVE::Cluster;
+use PVE::Tools;
+
+use base('PVE::Network::SDN::Ipams::NetboxPlugin');
+
+sub type {
+return 'nautobot';
+}
+
+sub verify_api {
+my ($class, $plugin_config) = @_;
+
+my $url = $plugin_config->{url};
+my $token = $plugin_config->{token};
+my $headers = [ 'Authorization' => "token $token", 'Accept' => 
"application/json; indent=4" ];
+
+eval {
+   PVE::Network::SDN::api_request("GET", "$url/ipam/namespaces", $headers);
+};
+if ($@) {
+   die "Can't connect to nautobot api: $@";
+}
+}
+
+# helpers
+sub on_update_hook {
+my ($class, $plugin_config) = @_;
+
+PVE::Network::SDN::Ipams::NautobotPlugin::verify_api($class, 
$plugin_config);
+}
+
+1;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 12/16] ipam: nautobot: add get ips for mac function

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 24 +
 1 file changed, 24 insertions(+)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index e328c9f..69e7897 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -143,6 +143,30 @@ sub verify_api {
 }
 }
 
+sub get_ips_from_mac {
+my ($class, $plugin_config, $mac, $zoneid) = @_;
+
+my $url = $plugin_config->{url};
+my $namespace = $plugin_config->{namespace};
+my $headers = default_headers($plugin_config);
+
+my $ip4 = undef;
+my $ip6 = undef;
+
+my $data = PVE::Network::SDN::api_request("GET", 
"$url/ipam/ip-addresses/?q=$mac", $headers);
+for my $ip (@{$data->{results}}) {
+   if ($ip->{ip_version} == 4 && !$ip4) {
+   ($ip4, undef) = split(/\//, $ip->{address});
+   }
+
+   if ($ip->{ip_version} == 6 && !$ip6) {
+   ($ip6, undef) = split(/\//, $ip->{address});
+   }
+}
+
+return ($ip4, $ip6);
+}
+
 sub on_update_hook {
 my ($class, $plugin_config) = @_;
 
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 16/16] ipam: nautobot: add word of warning for dhcp range support

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index e3ba57c..22867df 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -131,6 +131,7 @@ sub add_range_next_freeip {
 my $headers = default_headers($plugin_config);
 my $cidr = $subnet->{cidr};
 
+# ranges are not supported natively in nautobot, hence why we have to get 
a little hacky.
 my $minimal_size = NetAddr::IP->new($range->{'start-address'}) - 
NetAddr::IP->new($cidr);
 my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
 
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 07/16] ipam: nautobot: fix typo

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 53190bc..ee0ad49 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -72,7 +72,7 @@ sub get_namespace_id {
 sub get_status_id {
 my ($url, $status, $headers) = @_;
 
-my $result = PVE::Network::SDN::api_request("GET", 
"$url/extra/statuses/?q=$status", $headers);
+my $result = PVE::Network::SDN::api_request("GET", 
"$url/extras/statuses/?q=$status", $headers);
 my $data = @{$result->{results}}[0];
 my $internalid = $data->{id};
 return $internalid;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 05/16] ipam: nautobot: fix on_update_hook for NautobotPlugin

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index ebdc07b..083ab20 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -47,6 +47,12 @@ sub verify_api {
 }
 }
 
+sub on_update_hook {
+my ($class, $plugin_config) = @_;
+
+PVE::Network::SDN::Ipams::NautobotPlugin::verify_api($class, 
$plugin_config);
+}
+
 # helpers
 sub get_namespace_id {
 my ($url, $namespace, $headers) = @_;
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 10/16] ipam: nautobot: api endpoint change no longer needed

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NetboxPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
index 7efccaf..d923269 100644
--- a/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NetboxPlugin.pm
@@ -240,7 +240,7 @@ sub verify_api {
 
 
 eval {
-   PVE::Network::SDN::api_request("GET", "$url/ipam/prefixes/", $headers);
+   PVE::Network::SDN::api_request("GET", "$url/ipam/aggregates/", 
$headers);
 };
 if ($@) {
die "Can't connect to netbox api: $@";
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] SPAM: [PATCH pve-network 15/16] ipam: nautobot: implement plain prefix allocation (without ranges)

2024-11-27 Thread Lou Lecrivain via pve-devel
--- Begin Message ---
+ bugfix (return from eval was garbage-collected, callers got undef)

Signed-off-by: lou lecrivain 
---
 src/PVE/Network/SDN/Ipams/NautobotPlugin.pm | 30 -
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm 
b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
index 95e749c..e3ba57c 100644
--- a/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
+++ b/src/PVE/Network/SDN/Ipams/NautobotPlugin.pm
@@ -96,6 +96,33 @@ sub add_ip {
 }
 }
 
+sub add_next_freeip {
+my ($class, $plugin_config, $subnetid, $subnet, $hostname, $mac, $vmid, 
$noerr) = @_;
+
+my $cidr = $subnet->{cidr};
+
+my $url = $plugin_config->{url};
+my $namespace = $plugin_config->{namespace};
+my $headers = default_headers($plugin_config);
+
+my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
+
+my $description = "mac:$mac" if $mac;
+
+my $params = { type => "dhcp", dns_name => $hostname, description => 
$description, namespace => $namespace, status => default_ip_status() };
+
+my $ip = eval {
+   my $result = PVE::Network::SDN::api_request("POST", 
"$url/ipam/prefixes/$internalid/available-ips/", $headers, $params);
+   my ($ip, undef) = split(/\//, $result->{address});
+   return $ip;
+};
+
+if ($@) {
+   die "can't find free ip in subnet $cidr: $@" if !$noerr;
+}
+return $ip;
+}
+
 sub add_range_next_freeip {
 my ($class, $plugin_config, $subnet, $range, $data, $noerr) = @_;
 
@@ -107,7 +134,7 @@ sub add_range_next_freeip {
 my $minimal_size = NetAddr::IP->new($range->{'start-address'}) - 
NetAddr::IP->new($cidr);
 my $internalid = 
PVE::Network::SDN::Ipams::NetboxPlugin::get_prefix_id($url, $cidr, $headers);
 
-eval {
+my $ip = eval {
my $result = PVE::Network::SDN::api_request("GET", 
"$url/ipam/prefixes/$internalid/available-ips/?limit=$minimal_size", $headers);
# v important for NetAddr::IP comparison!
my @ips = map((split(/\//,$_->{address}))[0], @{$result});
@@ -125,6 +152,7 @@ sub add_range_next_freeip {
 if ($@) {
die "can't find free ip in range 
$range->{'start-address'}-$range->{'end-address'}: $@" if !$noerr;
 }
+return $ip;
 }
 
 
-- 
2.39.5


--- End Message ---
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] applied: [PATCH pve-kernel/master 0/2] fix two small issues with IOMMU in certain setups

2024-11-27 Thread Thomas Lamprecht
Am 26.11.24 um 17:36 schrieb Stoiko Ivanov:
> stubled across https://bugzilla.proxmox.com/show_bug.cgi?id=5926 which
> mentioned kernel-issues related to the 8.3.0 release - so took a quick look.
> 
> While I think that the issues were not directly related to 8.3 (or the
> kernel version shipped with it (see bugzilla)) - one issue seemed to
> be easily addressable with a cherry-pick from kernel.org stable-6.11.7
> (patch 1/2)
> 
> the second patch addresses an unrleated issue reported in our forums:
> https://forum.proxmox.com/threads/.157266
> see the commit-message of the patch for a bit more information - but it
> basically reverts a patch from Ubuntu-upstream, as this broke iGPU
> passthrough for old Intel-CPUs (without the patch users affected by the
> issue reported to Ubuntu had the options of disabling iommu via
> kernel-cmdline anyways).
> 
> I'd suggest pulling patch 2/2 also for our kernel 6.8.


done

> Stoiko Ivanov (2):
>   fix #5926: cherry-pick ACS-quirk fix from linux-stable/6.11.7
>   revert Ubuntu patch disabling IOMMU functionality for Skylake iGPU
> 
>  ...nable_acs-support-for-the-ACS-quirks.patch | 68 +++
>  ...UCE-iommu-intel-disable-DMAR-for-SKL.patch | 53 +++
>  2 files changed, 121 insertions(+)
>  create mode 100644 
> patches/kernel/0016-PCI-Fix-pci_enable_acs-support-for-the-ACS-quirks.patch
>  create mode 100644 
> patches/kernel/0017-Revert-UBUNTU-SAUCE-iommu-intel-disable-DMAR-for-SKL.patch
> 


applied series, thanks!


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] applied: [PATCH proxmox-i18n] es: update translations

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 14:39 schrieb Maximiliano Sandoval:
> We make some words as 'snapshot' or 'media' be consistently lowercased.
> 
> Signed-off-by: Maximiliano Sandoval 
> ---
>  es.po | 74 ++-
>  1 file changed, 33 insertions(+), 41 deletions(-)
> 
>

applied, thanks!


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] applied: [PATCH manager] status: influxdb: always quote tags

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 12:18 schrieb Dominik Csapak:
> Since tags are mostly free-form, a single tag with a numeric value will
> get sent to influxdb as a number by default. Change that to always quote
> the tags as a string, like we do for the 'name' field. (InfluxDB can
> only have one type per field, so either a string or a number type).
> 
> This won't fix influxdb databases after there are already numeric values
> in there, but I guess most tags won't be purely numeric, so this won't
> be an issue for most users, and fixes the reverse case where purely
> numeric tags won't show up in influxdb.
> 
> reported in the community forum:
> https://forum.proxmox.com/threads/138004/#post-724127
> 
> Signed-off-by: Dominik Csapak 
> ---
>  PVE/Status/InfluxDB.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
>

applied, thanks!


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



Re: [pve-devel] Arbitrary file reading via malicious VM config

2024-11-27 Thread Thomas Lamprecht
Hello,

First, if you, or anybody else, think they found a problem with security 
implications
then please use our dedicated confidential channels for evaluating that 
initially:

https://pve.proxmox.com/wiki/Security_Reporting

If it's a real problem then other users might not be happy about a public 
broadcast
for all potential attackers to read and basically act as how-to.

Am 27.11.24 um 01:14 schrieb James Brown:
> I suspect a security flaw within ESXi VM import. If a malicious actor forges a
> VMWare VM config with root paths such as /var/log/auth.log, could lead to 
> potential
> data leak if the import task is executed.

The core assumption is that the admin doing the import fully controls both 
sides,
VMWare ESXi and Proxmox VE.
As otherwise this feature makes no sense, if the ESXi isn't trusted, it can do 
all
sorts of bad things that just cannot be protected against, like e.g., inject 
some
rootkits into the VM data stream at any time. And yes, it might also leak some
data from the PVE host.

For OVA imports we hedge against that by disallowing disks with 
additional/external
references. For ESXi we do not do so because 1) it's more common there to have 
legit
references in the disks (which are not trivial to tell apart from bad ones) and 
2)
because compared to allowing third-party/not fully trusted users uploading 
images
allowing one to add an ESXi storage and then import from there is IMO a rather
non-existent use case, and that would also mean that ESXi and Proxmox VE are 
either
in the same LAN or tunneled, as otherwise they should be shielded off from 
public
access already anyway.

But do you have an actual use case we missed and would break our assumptions 
here?
What we might do is documenting this more explicitly, possibly even showing a 
hint
in the UI.

- Thomas


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] applied: [PATCH proxmox-i18n] es: update translations

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 11:16 schrieb Maximiliano Sandoval:
> Signed-off-by: Maximiliano Sandoval 
> ---
>  es.po | 82 +++
>  1 file changed, 32 insertions(+), 50 deletions(-)
> 
>

applied, thanks!


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



Re: [pve-devel] Arbitrary file reading via malicious VM config

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 09:09 schrieb Thomas Lamprecht:
> The core assumption is that the admin doing the import fully controls both 
> sides,
> VMWare ESXi and Proxmox VE.
> As otherwise this feature makes no sense, if the ESXi isn't trusted, it can 
> do all
> sorts of bad things that just cannot be protected against, like e.g., inject 
> some
> rootkits into the VM data stream at any time. And yes, it might also leak some
> data from the PVE host.

btw. what I forgot: This is not really special to the ESXi "storage" that can be
used for import, but any storage attached through network in general.
There is no definitive way to check all potential problems in a race-free way.
But stating that core assumptions one more time explicitly definitively won't 
hurt for our docs.



___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH proxmox-i18n] es: update translations

2024-11-27 Thread Maximiliano Sandoval
Signed-off-by: Maximiliano Sandoval 
---
 es.po | 82 +++
 1 file changed, 32 insertions(+), 50 deletions(-)

diff --git a/es.po b/es.po
index 275dad2..f905062 100644
--- a/es.po
+++ b/es.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Tue Nov 26 12:25:38 2024\n"
-"PO-Revision-Date: 2024-11-21 10:20+0100\n"
+"PO-Revision-Date: 2024-11-27 11:11+0100\n"
 "Last-Translator: Maximiliano Sandoval \n"
 "Language-Team: Spanish\n"
 "Language: es\n"
@@ -2098,14 +2098,12 @@ msgstr ""
 "marcha?"
 
 #: proxmox-widget-toolkit/src/window/ConsentModal.js:15
-#, fuzzy
 msgid "Consent"
-msgstr "Consola"
+msgstr "Consentimiento"
 
 #: proxmox-backup/www/config/NodeOptionView.js:60
-#, fuzzy
 msgid "Consent Text"
-msgstr "Tipo de contenido"
+msgstr "Consentir el texto"
 
 #: proxmox-widget-toolkit/src/Utils.js:708 pmg-gui/js/ServerStatus.js:59
 #: pve-manager/www/manager6/Utils.js:2045
@@ -2576,9 +2574,8 @@ msgid "Datastore is not available"
 msgstr "Almacén de datos no está disponible"
 
 #: proxmox-backup/www/datastore/Summary.js:74
-#, fuzzy
 msgid "Datastore is not mounted"
-msgstr "Almacén de datos no está disponible"
+msgstr "Almacén de datos no está montado"
 
 #: proxmox-backup/www/datastore/DataStoreList.js:196
 msgid "Datastores"
@@ -2949,7 +2946,6 @@ msgid "Device node"
 msgstr "Nodo del dispositivo"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:75
-#, fuzzy
 msgid "Device path"
 msgstr "Ruta del dispositivo"
 
@@ -4351,15 +4347,16 @@ msgstr "Formateando"
 #: pve-manager/www/manager6/grid/FirewallOptions.js:155
 #: pve-manager/www/manager6/grid/FirewallOptions.js:160
 #: pve-manager/www/manager6/grid/FirewallOptions.js:165
-#, fuzzy
 msgid "Forward Policy"
-msgstr "Política de hash"
+msgstr "Política de reenvío"
 
 #: pve-manager/www/manager6/grid/FirewallRules.js:243
 msgid ""
 "Forward rules only take effect when the nftables firewall is activated in "
 "the host options"
 msgstr ""
+"Las reglas de reenvío sólo tienen efecto cuando el contrafuego nftables está "
+"activado en las opciones del host"
 
 #: proxmox-widget-toolkit/src/Utils.js:686
 msgid "Forwarded mails to the local root user"
@@ -5302,9 +5299,8 @@ msgid "Is this token already registered?"
 msgstr "¿Este token ya está registrado?"
 
 #: pve-manager/www/manager6/sdn/VnetEdit.js:81
-#, fuzzy
 msgid "Isolate Ports"
-msgstr "Puerto de retransmisión"
+msgstr "Aislar puertos"
 
 #: proxmox-widget-toolkit/src/panel/Certificates.js:18
 #: proxmox-widget-toolkit/src/window/Certificates.js:26
@@ -5822,9 +5818,8 @@ msgstr "Almacenamiento local"
 
 #: proxmox-backup/www/config/SyncView.js:36
 #: proxmox-backup/www/window/SyncJobEdit.js:39
-#, fuzzy
 msgid "Local User"
-msgstr "Dueño local"
+msgstr "Usuario local"
 
 #: proxmox-backup/www/Utils.js:713
 msgid "Locating"
@@ -6228,7 +6223,7 @@ msgstr "Conjunto de Media"
 
 #: proxmox-backup/www/tape/TapeManagement.js:42
 msgid "Media Pools"
-msgstr "Conjuntos de Media"
+msgstr "Conjuntos de media"
 
 #: proxmox-backup/www/tape/TapeInventory.js:277
 #: proxmox-backup/www/tape/window/TapeRestore.js:313
@@ -6497,9 +6492,8 @@ msgid "Mount"
 msgstr "Montaje"
 
 #: proxmox-backup/www/Utils.js:420
-#, fuzzy
 msgid "Mount Device"
-msgstr "Desde dispositivo"
+msgstr "Montando dispositivo"
 
 #: pve-manager/www/manager6/lxc/MPEdit.js:370
 #: pve-manager/www/manager6/lxc/MPEdit.js:372
@@ -7075,9 +7069,8 @@ msgstr "Ningún VM seleccionado"
 
 #: pve-manager/www/manager6/sdn/FirewallVnetView.js:10
 #: pve-manager/www/manager6/sdn/VnetView.js:6
-#, fuzzy
 msgid "No VNet configured."
-msgstr "Aun no configurado"
+msgstr "No hay VNet configurada."
 
 #: pve-manager/www/manager6/ceph/Status.js:130
 msgid "No Warnings/Errors"
@@ -7124,9 +7117,8 @@ msgid "No default available"
 msgstr "Sin valor por defecto disponible"
 
 #: pve-manager/www/manager6/grid/FirewallRules.js:617
-#, fuzzy
 msgid "No firewall rule configured here."
-msgstr "Ningún destino configurado"
+msgstr "No se ha configurado ninguna regla de contrafuegos aquí."
 
 #: pmg-gui/js/QuarantineList.js:265
 msgid "No match found"
@@ -7206,9 +7198,8 @@ msgid "No valid subscription"
 msgstr "No hay una suscripción válida"
 
 #: pve-manager/www/manager6/sdn/ZoneView.js:6
-#, fuzzy
 msgid "No zone configured."
-msgstr "No {0} configurado."
+msgstr "Ni una zona ha sido configurada."
 
 #: pve-manager/www/manager6/dc/RealmSyncJob.js:8
 msgid "No {0} configured"
@@ -7604,9 +7595,8 @@ msgid "On"
 msgstr "Encendido"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:116
-#, fuzzy
 msgid "On device path"
-msgstr "Ruta del dispositivo"
+msgstr "En la ruta del dispositivo"
 
 #: pve-manager/www/manager6/dc/BackupJobDetail.js:215
 #: pve-manager/www/manager6/form/NotificationPolicySelector.js:6
@@ -8692,13 +8682,12 @@ msgid "Re-Verify After"
 msgstr "Re-verificar después"
 
 #: proxmox-backup/www/window/SyncJobEdit.js:389
-#, fuzzy
 msgid "Re-sync corrupt s

[pve-devel] [PATCH manager] status: influxdb: always quote tags

2024-11-27 Thread Dominik Csapak
Since tags are mostly free-form, a single tag with a numeric value will
get sent to influxdb as a number by default. Change that to always quote
the tags as a string, like we do for the 'name' field. (InfluxDB can
only have one type per field, so either a string or a number type).

This won't fix influxdb databases after there are already numeric values
in there, but I guess most tags won't be purely numeric, so this won't
be an issue for most users, and fixes the reverse case where purely
numeric tags won't show up in influxdb.

reported in the community forum:
https://forum.proxmox.com/threads/138004/#post-724127

Signed-off-by: Dominik Csapak 
---
 PVE/Status/InfluxDB.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/Status/InfluxDB.pm b/PVE/Status/InfluxDB.pm
index 95c1d559..13a96711 100644
--- a/PVE/Status/InfluxDB.pm
+++ b/PVE/Status/InfluxDB.pm
@@ -276,8 +276,8 @@ sub test_connection {
 sub build_influxdb_payload {
 my ($class, $txn, $data, $ctime, $tags, $excluded, $measurement, 
$instance) = @_;
 
-# 'abc' and '123' are both valid hostnames, that confuses influx's type 
detection
-my $to_quote = { name => 1 };
+# 'abc' and '123' are both valid hostnames/tags, that confuses influx's 
type detection
+my $to_quote = { name => 1, tags => 1, };
 
 my @values = ();
 
-- 
2.39.5



___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH i18n] de: update translation

2024-11-27 Thread Shannon Sterz
Signed-off-by: Shannon Sterz 
---
 de.po | 71 +++
 1 file changed, 27 insertions(+), 44 deletions(-)

diff --git a/de.po b/de.po
index fc4684f..4a7ea2a 100644
--- a/de.po
+++ b/de.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Tue Nov 26 12:25:38 2024\n"
-"PO-Revision-Date: 2024-11-19 14:38+0100\n"
+"PO-Revision-Date: 2024-11-27 12:01+0100\n"
 "Last-Translator: Proxmox Support Team \n"
 "Language-Team: German\n"
 "Language: de\n"
@@ -2098,14 +2098,12 @@ msgstr ""
 "Verbindungsfehler. Netzwerkproblem oder nicht-laufende Proxmox VE services?"
 
 #: proxmox-widget-toolkit/src/window/ConsentModal.js:15
-#, fuzzy
 msgid "Consent"
-msgstr "Konsole"
+msgstr "Einverständnis"
 
 #: proxmox-backup/www/config/NodeOptionView.js:60
-#, fuzzy
 msgid "Consent Text"
-msgstr "Inhaltstyp"
+msgstr "Einverständnistext"
 
 #: proxmox-widget-toolkit/src/Utils.js:708 pmg-gui/js/ServerStatus.js:59
 #: pve-manager/www/manager6/Utils.js:2045
@@ -2578,9 +2576,8 @@ msgid "Datastore is not available"
 msgstr "Datastore ist nicht verfügbar"
 
 #: proxmox-backup/www/datastore/Summary.js:74
-#, fuzzy
 msgid "Datastore is not mounted"
-msgstr "Datastore ist nicht verfügbar"
+msgstr "Datastore ist nicht gemountet"
 
 #: proxmox-backup/www/datastore/DataStoreList.js:196
 msgid "Datastores"
@@ -2951,7 +2948,6 @@ msgid "Device node"
 msgstr "Geräteknoten"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:75
-#, fuzzy
 msgid "Device path"
 msgstr "Gerätepfad"
 
@@ -4354,15 +4350,16 @@ msgstr "Formatieren"
 #: pve-manager/www/manager6/grid/FirewallOptions.js:155
 #: pve-manager/www/manager6/grid/FirewallOptions.js:160
 #: pve-manager/www/manager6/grid/FirewallOptions.js:165
-#, fuzzy
 msgid "Forward Policy"
-msgstr "Hash-Policy"
+msgstr "Weiterleitungs-Policy"
 
 #: pve-manager/www/manager6/grid/FirewallRules.js:243
 msgid ""
 "Forward rules only take effect when the nftables firewall is activated in "
 "the host options"
 msgstr ""
+"Weiterleitungs-Regeln funktionieren ohne aktivierte nftables Firewall in den "
+"Host Optionen nicht"
 
 #: proxmox-widget-toolkit/src/Utils.js:686
 msgid "Forwarded mails to the local root user"
@@ -5304,9 +5301,8 @@ msgid "Is this token already registered?"
 msgstr "Ist dieser Token bereits registriert?"
 
 #: pve-manager/www/manager6/sdn/VnetEdit.js:81
-#, fuzzy
 msgid "Isolate Ports"
-msgstr "Relay-Port"
+msgstr "Ports isolieren"
 
 #: proxmox-widget-toolkit/src/panel/Certificates.js:18
 #: proxmox-widget-toolkit/src/window/Certificates.js:26
@@ -5824,9 +5820,8 @@ msgstr "Lokaler Datastore"
 
 #: proxmox-backup/www/config/SyncView.js:36
 #: proxmox-backup/www/window/SyncJobEdit.js:39
-#, fuzzy
 msgid "Local User"
-msgstr "Lokaler Besitzer"
+msgstr "Lokaler Benutzer"
 
 #: proxmox-backup/www/Utils.js:713
 msgid "Locating"
@@ -6504,9 +6499,8 @@ msgid "Mount"
 msgstr "Mount"
 
 #: proxmox-backup/www/Utils.js:420
-#, fuzzy
 msgid "Mount Device"
-msgstr "Von Gerät"
+msgstr "Zu mountentes Gerät"
 
 #: pve-manager/www/manager6/lxc/MPEdit.js:370
 #: pve-manager/www/manager6/lxc/MPEdit.js:372
@@ -7081,9 +7075,8 @@ msgstr "Keine VM ausgewählt"
 
 #: pve-manager/www/manager6/sdn/FirewallVnetView.js:10
 #: pve-manager/www/manager6/sdn/VnetView.js:6
-#, fuzzy
 msgid "No VNet configured."
-msgstr "Noch nicht konfiguriert"
+msgstr "Kein VNet konfiguriert."
 
 #: pve-manager/www/manager6/ceph/Status.js:130
 msgid "No Warnings/Errors"
@@ -7129,9 +7122,8 @@ msgid "No default available"
 msgstr "Kein Standardwert verfügbar"
 
 #: pve-manager/www/manager6/grid/FirewallRules.js:617
-#, fuzzy
 msgid "No firewall rule configured here."
-msgstr "Kein Ziel konfiguriert"
+msgstr "Hier wurde keine Firewall-Regel konfiguriert."
 
 #: pmg-gui/js/QuarantineList.js:265
 msgid "No match found"
@@ -7214,9 +7206,8 @@ msgid "No valid subscription"
 msgstr "Keine gültige Subskription"
 
 #: pve-manager/www/manager6/sdn/ZoneView.js:6
-#, fuzzy
 msgid "No zone configured."
-msgstr "Kein {0} eingerichtet."
+msgstr "Keine Zone konfiguriert."
 
 #: pve-manager/www/manager6/dc/RealmSyncJob.js:8
 msgid "No {0} configured"
@@ -7613,9 +7604,8 @@ msgid "On"
 msgstr "Ein"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:116
-#, fuzzy
 msgid "On device path"
-msgstr "Gerätepfad"
+msgstr "Pfad auf dem Gerät"
 
 #: pve-manager/www/manager6/dc/BackupJobDetail.js:215
 #: pve-manager/www/manager6/form/NotificationPolicySelector.js:6
@@ -8699,13 +8689,13 @@ msgid "Re-Verify After"
 msgstr "Zustand erneut verifizieren nach"
 
 #: proxmox-backup/www/window/SyncJobEdit.js:389
-#, fuzzy
 msgid "Re-sync corrupt snapshots"
-msgstr "Snapshot(s) wiederherstellen"
+msgstr "Korrumpierte Snapshots erneut synchronisieren"
 
 #: proxmox-backup/www/window/SyncJobEdit.js:394
 msgid "Re-sync snapshots, whose verification failed."
 msgstr ""
+"Synchronisiere Snapshots deren Verifikation fehlgeschlagen hat nochmal."
 
 #: proxmox-backup/www/ServerStat

Re: [pve-devel] [PATCH i18n] de: update translation

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 12:19 schrieb Shannon Sterz:
> Signed-off-by: Shannon Sterz 
> ---
>  de.po | 71 +++
>  1 file changed, 27 insertions(+), 44 deletions(-)
> 

>  #: proxmox-backup/www/Utils.js:431
> -#, fuzzy
>  msgid "Unmount Device"
> -msgstr "USB-Gerät"
> +msgstr "Gerät entfernen"

Or "Gerät auswerfen"?

As IIRC mount/unmount is often translated as "einhängen" or "einbinden" and
"auswerfen" or "aushängen".

But no hard feelings from my side in either way here.



___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] applied: [PATCH i18n] de: update translation

2024-11-27 Thread Thomas Lamprecht
Am 27.11.24 um 12:19 schrieb Shannon Sterz:
> Signed-off-by: Shannon Sterz 
> ---
>  de.po | 71 +++
>  1 file changed, 27 insertions(+), 44 deletions(-)
> 
>

applied this now nonetheless, can be still improved later after all, thanks!


___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



[pve-devel] [PATCH proxmox-i18n] es: update translations

2024-11-27 Thread Maximiliano Sandoval
We make some words as 'snapshot' or 'media' be consistently lowercased.

Signed-off-by: Maximiliano Sandoval 
---
 es.po | 74 ++-
 1 file changed, 33 insertions(+), 41 deletions(-)

diff --git a/es.po b/es.po
index cd00fa7..f9ff3ee 100644
--- a/es.po
+++ b/es.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Wed Nov 27 14:13:27 2024\n"
-"PO-Revision-Date: 2024-11-27 11:11+0100\n"
+"PO-Revision-Date: 2024-11-27 14:35+0100\n"
 "Last-Translator: Maximiliano Sandoval \n"
 "Language-Team: Spanish\n"
 "Language: es\n"
@@ -25,7 +25,7 @@ msgstr "(No dispositivo de arranque seleccionado)"
 
 #: proxmox-backup/www/config/SyncView.js:242
 msgid "(remote) store, remote, id, owner, direction"
-msgstr ""
+msgstr "(remoto) almacén de datos, remoto, id, dueño, dirección"
 
 #: proxmox-widget-toolkit/src/window/FileBrowser.js:322
 msgid ".tar.zst"
@@ -60,9 +60,8 @@ msgstr ""
 "ejecución, por favor reinicie"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:117
-#, fuzzy
 msgid "A relative path"
-msgstr "Una dirección absoluta"
+msgstr "Una dirección relativa"
 
 #: pve-manager/www/manager6/window/PCIMapEdit.js:191
 msgid ""
@@ -348,19 +347,16 @@ msgid "Add EFI Disk"
 msgstr "Agregar disco EFI"
 
 #: proxmox-backup/www/datastore/Content.js:1260
-#, fuzzy
 msgid "Add Namespace"
-msgstr "Espacio de nombres"
+msgstr "Agregar espacio de nombres"
 
 #: proxmox-backup/www/config/SyncView.js:195
-#, fuzzy
 msgid "Add Pull Sync Job"
-msgstr "Trabajo de sincronización de reino"
+msgstr "Agregar trabajo de sincronización (pull)"
 
 #: proxmox-backup/www/config/SyncView.js:201
-#, fuzzy
 msgid "Add Push Sync Job"
-msgstr "Trabajo de sincronización"
+msgstr "Agregar trabajo de sincronización (push)"
 
 #: pmg-gui/js/PBSConfig.js:112
 msgid "Add Remote"
@@ -1499,7 +1495,7 @@ msgstr "Catálogo"
 
 #: proxmox-backup/www/Utils.js:406
 msgid "Catalog Media"
-msgstr "Catálogo de Media"
+msgstr "Catálogo de media"
 
 #: pmg-gui/js/ObjectGroup.js:319
 msgid ""
@@ -3501,7 +3497,7 @@ msgstr "Expulsar"
 #: proxmox-backup/www/tape/window/TapeBackup.js:92
 #: proxmox-backup/www/tape/window/TapeBackupJob.js:186
 msgid "Eject Media"
-msgstr "Expulsar Media"
+msgstr "Expulsar media"
 
 #: pve-manager/www/manager6/dc/Backup.js:344
 #: pve-manager/www/manager6/window/Backup.js:43
@@ -4333,7 +4329,7 @@ msgstr "Parada forzosa sí se agota el tiempo de apagado 
del Guest"
 
 #: pmg-gui/js/PBSSnapshotView.js:212
 msgid "Forget Snapshot"
-msgstr "Olvidar Snapshot"
+msgstr "Olvidar snapshot"
 
 #: pve-manager/www/manager6/Utils.js:670
 msgid "Form fields may not be submitted with invalid values"
@@ -5626,7 +5622,7 @@ msgstr "Información de la etiqueta"
 #: proxmox-backup/www/tape/DriveStatus.js:215
 #: proxmox-backup/www/tape/window/LabelMedia.js:8
 msgid "Label Media"
-msgstr "Etiqueta de Media"
+msgstr "Etiqueta de media"
 
 #: proxmox-widget-toolkit/src/window/LanguageEdit.js:36
 #: proxmox-widget-toolkit/src/window/LanguageEdit.js:43
@@ -5780,11 +5776,11 @@ msgstr "Cargar"
 
 #: proxmox-backup/www/Utils.js:418
 msgid "Load Media"
-msgstr "Cargar Media"
+msgstr "Cargar media"
 
 #: proxmox-backup/www/tape/ChangerStatus.js:224
 msgid "Load Media into Drive"
-msgstr "Cargar Media en el disco"
+msgstr "Cargar media en el disco"
 
 #: pve-manager/www/manager6/lxc/CreateWizard.js:165
 #: pve-manager/www/manager6/qemu/SSHKey.js:33
@@ -5835,9 +5831,8 @@ msgid "Local Owner"
 msgstr "Dueño local"
 
 #: proxmox-backup/www/config/SyncView.js:335
-#, fuzzy
 msgid "Local Owner/User"
-msgstr "Dueño local"
+msgstr "Dueño/usuario local"
 
 #: proxmox-backup/www/config/SyncView.js:296
 msgid "Local Store"
@@ -6245,7 +6240,7 @@ msgstr "Media"
 #: proxmox-backup/www/tape/window/TapeBackup.js:55
 #: proxmox-backup/www/tape/window/TapeBackupJob.js:121
 msgid "Media Pool"
-msgstr "Conjunto de Media"
+msgstr "Conjunto de media"
 
 #: proxmox-backup/www/tape/TapeManagement.js:42
 msgid "Media Pools"
@@ -6898,7 +6893,7 @@ msgstr "Siguiente rango de VMID libre"
 
 #: proxmox-backup/www/tape/BackupJobs.js:265
 msgid "Next Media"
-msgstr "Siguiente Media"
+msgstr "Siguiente media"
 
 #: pmg-gui/js/PBSSnapshotView.js:185 pve-manager/www/manager6/dc/Backup.js:835
 #: pve-manager/www/manager6/dc/BackupJobDetail.js:193
@@ -7062,7 +7057,7 @@ msgstr "Sin valores S.M.A.R.T."
 
 #: proxmox-backup/www/tape/window/TapeRestore.js:832
 msgid "No Snapshots"
-msgstr "Ninguna Snapshot"
+msgstr "Ninguna snapshot"
 
 #: pmg-gui/js/SpamInfoGrid.js:26
 msgid "No Spam Info"
@@ -7976,9 +7971,8 @@ msgid "Path has to start with /dev/"
 msgstr "Ruta tiene que comenzar con /dev/"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:116
-#, fuzzy
 msgid "Path on Device"
-msgstr "Montando dispositivo"
+msgstr "Ruta en el dispositivo"
 
 #: pve-manager/www/manager6/Utils.js:2032
 #: pve-manager/www/manager6/qemu/CmdMenu.js:65
@@ -8558,9 +8552,8 @@ msgid "Public Key Type"
 msgstr "Tipo de ll