[pve-devel] [PATCH pve-network] fix dhcpv6 router advertisement

2023-11-21 Thread Alexandre Derumier
- don't listen to ip address, but use interface= instead
- generate 1 config file by vnet instead 1 by subnet
- enable-ra is global to server, enable it in default conf

Signed-off-by: Alexandre Derumier 
---
 src/PVE/Network/SDN/Dhcp.pm | 33 +-
 src/PVE/Network/SDN/Dhcp/Dnsmasq.pm | 36 +++--
 src/PVE/Network/SDN/Dhcp/Plugin.pm  |  9 ++--
 3 files changed, 48 insertions(+), 30 deletions(-)

diff --git a/src/PVE/Network/SDN/Dhcp.pm b/src/PVE/Network/SDN/Dhcp.pm
index fc33f08..2c2d019 100644
--- a/src/PVE/Network/SDN/Dhcp.pm
+++ b/src/PVE/Network/SDN/Dhcp.pm
@@ -59,6 +59,7 @@ sub regenerate_config {
 my $cfg = PVE::Network::SDN::running_config();
 
 my $zone_cfg = $cfg->{zones};
+my $vnet_cfg = $cfg->{vnets};
 my $subnet_cfg = $cfg->{subnets};
 return if !$zone_cfg && !$subnet_cfg;
 
@@ -84,22 +85,32 @@ sub regenerate_config {
eval { $dhcp_plugin->before_configure($zoneid) };
die "Could not run before_configure for DHCP server $zoneid $@\n" if $@;
 
+   for my $vnetid (sort keys %{$vnet_cfg->{ids}}) {
+   my $vnet = $vnet_cfg->{ids}->{$vnetid};
+   next if $vnet->{zone} ne $zoneid;
 
-   foreach my $subnet_id (keys %{$subnet_cfg->{ids}}) {
-   my $subnet_config = 
PVE::Network::SDN::Subnets::sdn_subnets_config($subnet_cfg, $subnet_id);
-   my $dhcp_ranges = 
PVE::Network::SDN::Subnets::get_dhcp_ranges($subnet_config);
+   my $config = [];
+   my $subnets = PVE::Network::SDN::Vnets::get_subnets($vnetid);
 
-   my ($zone, $subnet_network, $subnet_mask) = split(/-/, $subnet_id);
-   next if $zone ne $zoneid;
-   next if !$dhcp_ranges;
+   foreach my $subnet_id (sort keys %{$subnets}) {
+   my $subnet_config = $subnets->{$subnet_id};
+   my $dhcp_ranges = 
PVE::Network::SDN::Subnets::get_dhcp_ranges($subnet_config);
 
-   eval { $dhcp_plugin->configure_subnet($zoneid, $subnet_config) };
-   warn "Could not configure subnet $subnet_id: $@\n" if $@;
+   my ($zone, $subnet_network, $subnet_mask) = split(/-/, 
$subnet_id);
+   next if $zone ne $zoneid;
+   next if !$dhcp_ranges;
 
-   foreach my $dhcp_range (@$dhcp_ranges) {
-   eval { $dhcp_plugin->configure_range($zoneid, $subnet_config, 
$dhcp_range) };
-   warn "Could not configure DHCP range for $subnet_id: $@\n" if 
$@;
+   eval { $dhcp_plugin->configure_subnet($config, $zoneid, 
$vnetid, $subnet_config) };
+   warn "Could not configure subnet $subnet_id: $@\n" if $@;
+
+   foreach my $dhcp_range (@$dhcp_ranges) {
+   eval { $dhcp_plugin->configure_range($config, $zoneid, 
$vnetid, $subnet_config, $dhcp_range) };
+   warn "Could not configure DHCP range for $subnet_id: $@\n" 
if $@;
+   }
}
+
+   eval { $dhcp_plugin->configure_vnet($config, $zoneid, $vnetid, 
$vnet) };
+   warn "Could not configure vnet $vnetid: $@\n" if $@;
}
 
eval { $dhcp_plugin->after_configure($zoneid) };
diff --git a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm 
b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
index 7b54532..4c0de25 100644
--- a/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
+++ b/src/PVE/Network/SDN/Dhcp/Dnsmasq.pm
@@ -101,39 +101,29 @@ sub add_ip_mapping {
 }
 
 sub configure_subnet {
-my ($class, $dhcpid, $subnet_config) = @_;
+my ($class, $config, $dhcpid, $vnetid, $subnet_config) = @_;
 
 die "No gateway defined for subnet $subnet_config->{id}"
if !$subnet_config->{gateway};
 
 my $tag = $subnet_config->{id};
 
-my @dnsmasq_config = (
-   "listen-address=$subnet_config->{gateway}",
-);
-
 my $option_string;
 if (ip_is_ipv6($subnet_config->{network})) {
$option_string = 'option6';
-   push @dnsmasq_config, "enable-ra";
 } else {
$option_string = 'option';
-   push @dnsmasq_config, 
"dhcp-option=tag:$tag,$option_string:router,$subnet_config->{gateway}";
+   push @{$config}, 
"dhcp-option=tag:$tag,$option_string:router,$subnet_config->{gateway}";
 }
 
-push @dnsmasq_config, 
"dhcp-option=tag:$tag,$option_string:dns-server,$subnet_config->{'dhcp-dns-server'}"
+push @{$config}, 
"dhcp-option=tag:$tag,$option_string:dns-server,$subnet_config->{'dhcp-dns-server'}"
if $subnet_config->{'dhcp-dns-server'};
 
-PVE::Tools::file_set_contents(
-   "$DNSMASQ_CONFIG_ROOT/$dhcpid/10-$subnet_config->{id}.conf",
-   join("\n", @dnsmasq_config) . "\n"
-);
 }
 
 sub configure_range {
-my ($class, $dhcpid, $subnet_config, $range_config) = @_;
+my ($class, $config, $dhcpid, $vnetid, $subnet_config, $range_config) = @_;
 
-my $subnet_file = 
"$DNSMASQ_CONFIG_ROOT/$dhcpid/10-$subnet_config->{id}.conf";
 my $tag = $subnet_config->{id};
 
 my ($zone, $network, $mask) = split(/-/, 

[pve-devel] [TurnKey Linux] Looking to update our signing key... Advice?

2023-11-21 Thread Jeremy Davis

Hi,

Apologies in advance if this is not the right place to post this. Please 
redirect me to the appropriate forum if not. I'm also happy to discuss 
off list if that is deemed more appropriate.


My name is Jeremy and I work with TurnKey Linux.

As a housekeeping matter, we're looking to update our GPG signing key - 
that we sign the index file we provide for downloading our LXC templates 
via the PVE UI (which includes hashes of our templates).


The current key recently expired (caught us a bit unawares). We updated 
the expiry to keep it alive. And it doesn't seem to have caused any 
issues (at least not in my local PVE servers).


However, the key is quite old and doesn't have current best practice 
size (RSA-4098 AFAIK?). So I'd like to rotate it.


I was hoping that someone with some authoritative knowledge of the 
relevant PVE components would be willing to give me some guidance on the 
process (not generating the key itself, just the PVE integration 
specific bits). Hopefully that can ensure that key rotation causes 
minimal disruptions to users.


Also if there are any specific PVE recommendations/requirements re the 
new GPG keypair to generate, that would also be great.


Thanks in advance.

Regards,
Jeremy Davis
TurnKey Linux


OpenPGP_signature.asc
Description: OpenPGP digital signature
___
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


[pve-devel] applied: [PATCH v4 pve-manager 17/33] sdn: regenerate DHCP config on reload

2023-11-21 Thread Thomas Lamprecht
Am 17/11/2023 um 12:39 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich 
> ---
>  PVE/API2/Network.pm | 1 +
>  1 file changed, 1 insertion(+)
> 
>

applied the manager ones, thanks!


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



[pve-devel] applied: [PATCH pve-manager] sdn: subnet: proper change detect for dhcp range panel

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 20:46 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich 
> ---
>  www/manager6/sdn/SubnetEdit.js | 51 +-
>  1 file changed, 38 insertions(+), 13 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 pve-manager 2/2] sdn: Update IPAM API endpoints

2023-11-21 Thread Thomas Lamprecht
Am 20/11/2023 um 17:28 schrieb Stefan Hanreich:
> The IPAM-related API endpoints were moved, reflect those changes in
> the UI as well.
> 
> Signed-off-by: Stefan Hanreich 
> ---
>  www/manager6/sdn/IpamEdit.js  |  4 +++-
>  www/manager6/tree/DhcpTree.js | 15 +++
>  2 files changed, 14 insertions(+), 5 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 kernel-helper] add dedicated removable installation

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 21:19 schrieb Stoiko Ivanov:
> seems adding `--removable` makes grub install ignore most other
> information - e.g. the bootloader-id (guessed based on [0]).
> add dedicated call with out `--removable` in addition
> 
> Seems that's the reason why our installer also 'rolls its own
> removable' [1]
> 
> minimally tested with an ISO with this installed and an install with
> ZFS on / (RAID1).
> 
> [0] https://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-install.c#n1142
> [1] 
> https://git.proxmox.com/?p=pve-installer.git;a=blob;f=Proxmox/Install.pm;h=8825699416475b1934527531db4fbb40e9473ce8;hb=HEAD#l608
> 
> Signed-off-by: Stoiko Ivanov 
> ---
>  src/bin/proxmox-boot-tool | 8 
>  1 file changed, 8 insertions(+)
> 
>

applied, surely one cannot have enough grubs installed, thanks!


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



[pve-devel] [PATCH kernel-helper] add dedicated removable installation

2023-11-21 Thread Stoiko Ivanov
seems adding `--removable` makes grub install ignore most other
information - e.g. the bootloader-id (guessed based on [0]).
add dedicated call with out `--removable` in addition

Seems that's the reason why our installer also 'rolls its own
removable' [1]

minimally tested with an ISO with this installed and an install with
ZFS on / (RAID1).

[0] https://git.savannah.gnu.org/cgit/grub.git/tree/util/grub-install.c#n1142
[1] 
https://git.proxmox.com/?p=pve-installer.git;a=blob;f=Proxmox/Install.pm;h=8825699416475b1934527531db4fbb40e9473ce8;hb=HEAD#l608

Signed-off-by: Stoiko Ivanov 
---
 src/bin/proxmox-boot-tool | 8 
 1 file changed, 8 insertions(+)

diff --git a/src/bin/proxmox-boot-tool b/src/bin/proxmox-boot-tool
index e70850a..2903ff3 100755
--- a/src/bin/proxmox-boot-tool
+++ b/src/bin/proxmox-boot-tool
@@ -161,6 +161,14 @@ init_bootloader() {
if [ -d /sys/firmware/efi ]; then
if [ -n "$mode" ] && [ "$mode" = "grub" ]; then
echo "Installing grub x86_64 target.."
+   grub-install.real \
+   --boot-directory "${esp_mp}" \
+   --target x86_64-efi \
+   --no-floppy \
+   --efi-directory "${esp_mp}" \
+   --bootloader-id 'proxmox' \
+   "/dev/$PKNAME"
+   echo "Installing grub x86_64 target (removable).."
grub-install.real \
--boot-directory "${esp_mp}" \
--target x86_64-efi \
-- 
2.39.2



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



[pve-devel] applied-series: [PATCH network/container/qemu-server 0/3] sdn: register a new IP at VM start if missing

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 15:55 schrieb Stefan Lendl:
> 
> If a VM or LXC starts and no IP was found in the IPAM, register a new one.
> 
> This is very seful as a fallback if for some reason an IP mapping was deleted
> or there is a bug somewhere that does not register an IP.
> 
> This acts more like DHCP to allocate an IP on demand.
> 
> Special case that is not covered:
>   If a subnet with IPv4 exists and VMs are present, adding a new subnet with
>   IPv6, this will not register an IPv6. And vice-versa.
> 
> 
> 
> pve-network:
> 
> Stefan Lendl (1):
>   sdn: register MAC in IPAM if not found
> 
>  src/PVE/Network/SDN/Vnets.pm | 10 --
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> 
> pve-container:
> 
> Stefan Lendl (1):
>   sdn: pass vmid and hostname to add_dhcp_mapping
> 
>  src/PVE/LXC.pm| 4 ++--
>  src/lxc-pve-prestart-hook | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> 
> qemu-server:
> 
> Stefan Lendl (1):
>   sdn: pass vmid and hostname to add_dhcp_mapping
> 
>  PVE/QemuServer.pm | 2 +-
>  vm-network-scripts/pve-bridge | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> 
> Summary over all repositories:
>   5 files changed, 14 insertions(+), 8 deletions(-)
> 


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 pve-container] sdn: fix wrong vmid parameter in prestart-hook

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 18:50 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich 
> ---
>  src/lxc-pve-prestart-hook | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
>

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 proxmox-widget-toolkit 4/4] notification ui: add appropriate onlineHelp anchors

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 15:47 schrieb Lukas Wagner:
> This links the dialog windows to the correct help section (different
> target types, matchers).
> 
> Signed-off-by: Lukas Wagner 
> ---
>  src/panel/GotifyEditPanel.js  | 1 +
>  src/panel/NotificationConfigView.js   | 1 +
>  src/panel/SendmailEditPanel.js| 1 +
>  src/panel/SmtpEditPanel.js| 1 +
>  src/window/NotificationMatcherEdit.js | 1 +
>  5 files changed, 5 insertions(+)
> 
>

applied, thanks!


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



[pve-devel] applied-series: [PATCH docs/proxmox-widget-toolkit 0/2] notifications: document 'unknown' severity and add to GUI

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 17:01 schrieb Lukas Wagner:
> This is the severity used for forwarded mails, since we cannot
> reasonably infer a priority here.
> 
> 
> 
> pve-docs:
> 
> Lukas Wagner (1):
>   notification: document 'unknown' severity
> 
>  notifications.adoc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> 
> proxmox-widget-toolkit:
> 
> Lukas Wagner (1):
>   notification ui: add 'unknown' to match-severity dropdown
> 
>  src/window/NotificationMatcherEdit.js | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> 
> Summary over all repositories:
>   2 files changed, 3 insertions(+), 2 deletions(-)
> 


applied, thanks!


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



[pve-devel] [PATCH pve-manager] sdn: subnet: proper change detect for dhcp range panel

2023-11-21 Thread Stefan Hanreich
Signed-off-by: Stefan Hanreich 
---
 www/manager6/sdn/SubnetEdit.js | 51 +-
 1 file changed, 38 insertions(+), 13 deletions(-)

diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 4fe16ab92..8851b013a 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -67,25 +67,37 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
me.initField();
 },
 
+// since value is an array of objects we need to override isEquals here
+isEqual: function(value1, value2) {
+   return JSON.stringify(value1) === JSON.stringify(value2);
+},
+
 getValue: function() {
let me = this;
let store = me.lookup('grid').getStore();
 
-   let data = [];
+   let value = [];
 
store.getData()
-   .each((item) =>
-   
data.push(`start-address=${item.data['start-address']},end-address=${item.data['end-address']}`),
-   );
+   .each((item) => {
+   // needs a deep copy otherwise we run in to ExtJS reference
+   // shenaningans
+   value.push({
+   'start-address': item.data['start-address'],
+   'end-address': item.data['end-address'],
+   });
+   });
 
-   return data;
+   return value;
 },
 
 getSubmitData: function() {
let me = this;
 
let data = {};
-   let value = me.getValue();
+
+   let value = me.getValue()
+   .map((item) => 
`start-address=${item['start-address']},end-address=${item['end-address']}`);
 
if (value.length) {
data[me.getName()] = value;
@@ -97,7 +109,19 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
 setValue: function(dhcpRanges) {
let me = this;
let store = me.lookup('grid').getStore();
-   store.setData(dhcpRanges);
+
+   let data = [];
+
+   dhcpRanges.forEach((item) => {
+   // needs a deep copy otherwise we run in to ExtJS reference
+   // shenaningans
+   data.push({
+   'start-address': item['start-address'],
+   'end-address': item['end-address'],
+   });
+   });
+
+   store.setData(data);
 },
 
 getErrors: function() {
@@ -113,6 +137,8 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
addRange: function() {
let me = this;
me.lookup('grid').getStore().add({});
+
+   me.getView().checkChange();
},
 
removeRange: function(field) {
@@ -120,6 +146,8 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
let record = field.getWidgetRecord();
 
me.lookup('grid').getStore().remove(record);
+
+   me.getView().checkChange();
},
 
onValueChange: function(field, value) {
@@ -129,6 +157,8 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
 
record.set(column.dataIndex, value);
record.commit();
+
+   me.getView().checkChange();
},
 
control: {
@@ -249,12 +279,7 @@ Ext.define('PVE.sdn.SubnetEdit', {
if (!me.isCreate) {
me.load({
success: function(response, options) {
-   let values = response.result.data;
-   ipanel.setValues(values);
-
-   if (values['dhcp-range']) {
-   dhcpPanel.setValue(values['dhcp-range']);
-   }
+   me.setValues(response.result.data);
},
});
}
-- 
2.39.2


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



[pve-devel] applied: [PATCH v4 pve-docs 33/33] sdn: dhcp: Add documentation for DHCP

2023-11-21 Thread Thomas Lamprecht
Am 17/11/2023 um 12:40 schrieb Stefan Hanreich:
> Signed-off-by: Stefan Hanreich 
> ---
>  pvesdn.adoc | 122 
>  1 file changed, 122 insertions(+)
> 
>

applied, with some merge conflicts resolved, maybe you could also
recheck to ensure nothing is off, thanks!


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



[pve-devel] [PATCH pve-network] subnet: fix dhcp-dns-server format

2023-11-21 Thread Stefan Hanreich
Signed-off-by: Stefan Hanreich 
---
 src/PVE/Network/SDN/SubnetPlugin.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/SubnetPlugin.pm 
b/src/PVE/Network/SDN/SubnetPlugin.pm
index 88933f5..37b6b2b 100644
--- a/src/PVE/Network/SDN/SubnetPlugin.pm
+++ b/src/PVE/Network/SDN/SubnetPlugin.pm
@@ -107,7 +107,7 @@ sub properties {
}
},
'dhcp-dns-server' => {
-   type => 'ip',
+   type => 'string', format => 'ip',
description => 'IP address for the DNS server',
optional => 1,
},
-- 
2.39.2


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



Re: [pve-devel] [PATCH v4 cluster/network/manager/qemu-server/container/docs 00/33] Add support for DHCP servers to SDN

2023-11-21 Thread DERUMIER, Alexandre

"DERUMIER, Alexandre"  writes:

> Another example with custom dhcpv6 options + client script
> 
> https://antiphishing.cetsi.fr/proxy/v3?i=Z09lbVhROVBaOHd3NjZZMVfTogSU
> UCLtvQYv_TI7-
> Qg=eVVJWkdic3NtZTdZV2pycd0wEJhcfg3n60sFMbDyx7fGbFFjGiZx-
> 8mpk_5ozxPQiZBWULDfan1Z0cBIdGk9Gw=UU9IMnpkdmJmSk9YOHVtc4QQq34JU-
> jw9SwzciT7i6aSKaghiIfZ2rZSqVj1KJWC=https%3A//serverfault.com/a/5284
> 25=eFRI

>>Thank you very much for clarifying. So the /128 is fine.

>>I also tried to ping6 dead:beef::1 to reach the gateway or from the
>>host
>>to reach the VM and that did not work.  So I assume RA is not working
>>correctly then?

Personnally, I can't get the RA feature of dnsmasq working.

I have done some tcpdump on vnet, I don't see any RA packet sent
regulary,  on RA response packet after an RS request.


I have done with with radvd daemon, and it's working out of the box...

Maybe it's missing something in dnsmasq config, but I don't have found
i t yet.


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


[pve-devel] [PATCH pve-container] sdn: fix wrong vmid parameter in prestart-hook

2023-11-21 Thread Stefan Hanreich
Signed-off-by: Stefan Hanreich 
---
 src/lxc-pve-prestart-hook | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index 4f5c7e2..6a60856 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
next if $k !~ /^net(\d+)/;
my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
next if $net->{type} ne 'veth';
-   PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{hwaddr}, $conf->{vmid}, $conf->{hostname});
+   PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{hwaddr}, $vmid, $conf->{hostname});
}
 }
 });
-- 
2.39.2


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



Re: [pve-devel] [PATCH pve-container 2/3] sdn: pass vmid and hostname to add_dhcp_mapping

2023-11-21 Thread Stefan Hanreich
see below

On 11/21/23 15:55, Stefan Lendl wrote:
> If no DHCP mapping was found in IPAM it will request a new IP.
> In order to register an IPAM mapping it requires these values.
> 
> Signed-off-by: Stefan Lendl 
> ---
>  src/PVE/LXC.pm| 4 ++--
>  src/lxc-pve-prestart-hook | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
> index 9361823..7883cfb 100644
> --- a/src/PVE/LXC.pm
> +++ b/src/PVE/LXC.pm
> @@ -993,7 +993,7 @@ sub update_net {
>   warn $@ if $@;
>  
>   PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, 
> $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
> - PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
> $newnet->{hwaddr});
> + PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
> $newnet->{hwaddr}, $vmid, $conf->{hostname});
>   }
>  
>   delete $conf->{$opt};
> @@ -1046,7 +1046,7 @@ sub update_net {
>  } else {
>   if ($have_sdn) {
>   PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, 
> $conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
> - PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
> $newnet->{hwaddr});
> + PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
> $newnet->{hwaddr}, $vmid, $conf->{hostname});
>   }
>  
>   hotplug_net($vmid, $conf, $opt, $newnet, $netid);
> diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
> index ab35774..4f5c7e2 100755
> --- a/src/lxc-pve-prestart-hook
> +++ b/src/lxc-pve-prestart-hook
> @@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
>   next if $k !~ /^net(\d+)/;
>   my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
>   next if $net->{type} ne 'veth';
> - PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
> $net->{hwaddr});
> + PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
> $net->{hwaddr}, $conf->{vmid}, $conf->{hostname});

The $conf->{vmid} variable does not exist, a simple $vmid would work
here. I've sent a patch correcting this issue.

Other than that consider this series

Tested-by: Stefan Hanreich 


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



[pve-devel] applied: [PATCH kernel-helper] grub-install: provide --removable to grub-install

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 17:56 schrieb Stoiko Ivanov:
> noticed while installing with secure-boot enabled on ZFS RAID1:
> The system has no entry to boot from in the efi-vars and
> the entry for the first disk simply does not boot (I assume OVMF tries
> the default bootx64.efi.
> 
> Since `proxmox-boot-tool init` should only be done for ESPs, which are
> dedicated to proxmox products I don't think that this will cause many
> regressions
> 
> For comparison - our installer has done the manual equivalent of the
> --removable option for installs on ext4 for quite a while.
> 
> minimally tested on a VM during install.
> 
> Reported-by: Thomas Lamprecht 
> Signed-off-by: Stoiko Ivanov 
> ---
> ftr: In Mira's tests a RAID1 install on ZFS booted fine as long as both
> disks were added to the boot-options (which I cannot explain)
> 
>  src/bin/proxmox-boot-tool | 1 +
>  1 file changed, 1 insertion(+)
> 
>

applied, thanks!


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



[pve-devel] [PATCH kernel-helper] grub-install: provide --removable to grub-install

2023-11-21 Thread Stoiko Ivanov
noticed while installing with secure-boot enabled on ZFS RAID1:
The system has no entry to boot from in the efi-vars and
the entry for the first disk simply does not boot (I assume OVMF tries
the default bootx64.efi.

Since `proxmox-boot-tool init` should only be done for ESPs, which are
dedicated to proxmox products I don't think that this will cause many
regressions

For comparison - our installer has done the manual equivalent of the
--removable option for installs on ext4 for quite a while.

minimally tested on a VM during install.

Reported-by: Thomas Lamprecht 
Signed-off-by: Stoiko Ivanov 
---
ftr: In Mira's tests a RAID1 install on ZFS booted fine as long as both
disks were added to the boot-options (which I cannot explain)

 src/bin/proxmox-boot-tool | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/bin/proxmox-boot-tool b/src/bin/proxmox-boot-tool
index befa2fb..e70850a 100755
--- a/src/bin/proxmox-boot-tool
+++ b/src/bin/proxmox-boot-tool
@@ -166,6 +166,7 @@ init_bootloader() {
--target x86_64-efi \
--no-floppy \
--efi-directory "${esp_mp}" \
+   --removable \
--bootloader-id 'proxmox' \
"/dev/$PKNAME"
else
-- 
2.39.2



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



Re: [pve-devel] [PATCH pve-manager 2/4] ui: sdn: fix onlineHelp anchors

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 15:47 schrieb Lukas Wagner:
> These have been renamed in:
> bcb72b 'sdn: overall language and consistency rework' in pve-docs

I reverted that part in the docs before I saw you patch and will keep it that
way, IMO one should have good reasons to break links than just vnet vs vnets..



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



[pve-devel] applied: [PATCH pve-manager 3/4] ui: dc: config: remove onlineHelp for notification config view

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 15:47 schrieb Lukas Wagner:
> The 'onlineHelp' is now set in the component definition in
> 'proxmox-widget-toolkit'.
> 
> Signed-off-by: Lukas Wagner 
> ---
>  www/manager6/dc/Config.js | 1 -
>  1 file changed, 1 deletion(-)
> 
>

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 pve-docs 1/4] notification: add anchors for target types/matchers

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 15:47 schrieb Lukas Wagner:
> This enables us to directly link to the appropriate section from the
> UI.
> 
> Signed-off-by: Lukas Wagner 
> ---
>  notifications.adoc | 6 ++
>  1 file changed, 6 insertions(+)
> 
>

applied this one, needing a bump for the other ones, thanks!


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



Re: [pve-devel] [PATCH v4 cluster/network/manager/qemu-server/container/docs 00/33] Add support for DHCP servers to SDN

2023-11-21 Thread Stefan Lendl
"DERUMIER, Alexandre"  writes:

> Another example with custom dhcpv6 options + client script
>
> https://serverfault.com/a/528425

Thank you very much for clarifying. So the /128 is fine.

I also tried to ping6 dead:beef::1 to reach the gateway or from the host
to reach the VM and that did not work.  So I assume RA is not working
correctly then?


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



[pve-devel] applied-series: [PATCH v4 manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 13:52 schrieb Lukas Wagner:
> This patch series adds the 'notification-mode' setting for backup jobs.
> It allows users to choose between the 'old-style' notifications 
> (mail to configured address, directly via a call to sendmail) or 
> the 'new-style' notification system.
> 
> notification-mode has three possible values:
>   - legacy-sendmail: Use old system, considering mailto/mailtnotification 
> parameters
>   - notification-system: Use the new system (always sending a notification, 
> irregardless 
> of success/failure. The user is supposed to configure filtering/matching 
> in 
> notification settings)
>   - auto: use old system if mailto is set, or new system if not
> 
> This should provide a fix/workaround for the users' reports of
>   - double notifications (these happened in case mailto was set to the same 
> address
> as root@pam)
>   - notifications always being sent, even if 'mailnotification' is set to 
> failure
> 
> Changes v2 -> v3:
>   - change field text in the GUI for the 'mailnotification' param
> This should highlight that this setting only affects the 
> 'legacy-sendmail' 
> notification mails
> 
> Changes v3 -> v4:
>   - fix eslint warnings (thx @Philipp)
>   - drop already applied pve-guest-common patch
> 
> 
> 
> pve-manager:
> 
> Lukas Wagner (4):
>   vzdump: support 'notification-mode' parameter
>   ui: backup jobs: add 'notification-mode' selector for backup jobs
>   ui: backup: add 'notification-mode' param for one-shot backup jobs.
>   ui: backup job: change field text for 'mailnotification' field
> 
>  PVE/VZDump.pm | 95 +++
>  www/manager6/dc/Backup.js | 34 ++-
>  .../form/NotificationPolicySelector.js|  2 +-
>  www/manager6/window/Backup.js | 25 +
>  4 files changed, 116 insertions(+), 40 deletions(-)
> 
> 
> Summary over all repositories:
>   4 files changed, 116 insertions(+), 40 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 proxmox-mail-forward] do not forward on PBS systems if co-installed with PVE

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 16:53 schrieb Lukas Wagner:
> With the newly built-in targets/matchers, we should not add
> a target/matcher manually any more. In fact, this broke mail
> forwarding on PBS because 'default-matcher' already existed as a
> built-in and could thus not be created.
> We now simply do an early return.
> 
> Also initialize notify-context before instantiating the config,
> since that already requires the context to be set.
> 
> Signed-off-by: Lukas Wagner 
> ---
>  src/main.rs | 38 ++
>  1 file changed, 14 insertions(+), 24 deletions(-)
> 
>

applied, thanks!


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



[pve-devel] [PATCH pve-docs 1/2] notification: document 'unknown' severity

2023-11-21 Thread Lukas Wagner
This is the severity used for forwarded mails, since we cannot
reasonably infer a priority here.

Signed-off-by: Lukas Wagner 
---
 notifications.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/notifications.adoc b/notifications.adoc
index 74447e5..8059953 100644
--- a/notifications.adoc
+++ b/notifications.adoc
@@ -228,7 +228,7 @@ A notification has a associated severity that can be 
matched.
 * `match-severity warning,error`: Match warnings and error
 
 The following severities are in use:
-`info`, `notice`, `warning`, `error`.
+`info`, `notice`, `warning`, `error`, `unknown`.
 
 
 Examples
-- 
2.39.2



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



[pve-devel] [PATCH docs/proxmox-widget-toolkit 0/2] notifications: document 'unknown' severity and add to GUI

2023-11-21 Thread Lukas Wagner
This is the severity used for forwarded mails, since we cannot
reasonably infer a priority here.



pve-docs:

Lukas Wagner (1):
  notification: document 'unknown' severity

 notifications.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


proxmox-widget-toolkit:

Lukas Wagner (1):
  notification ui: add 'unknown' to match-severity dropdown

 src/window/NotificationMatcherEdit.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)


Summary over all repositories:
  2 files changed, 3 insertions(+), 2 deletions(-)

-- 
murpp v0.4.0



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



[pve-devel] [PATCH proxmox-widget-toolkit 2/2] notification ui: add 'unknown' to match-severity dropdown

2023-11-21 Thread Lukas Wagner
This is the severity used for forwarded mails, since we cannot
reasonably infer a priority here.

Signed-off-by: Lukas Wagner 
---
 src/window/NotificationMatcherEdit.js | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/window/NotificationMatcherEdit.js 
b/src/window/NotificationMatcherEdit.js
index ee08c16..1e755dd 100644
--- a/src/window/NotificationMatcherEdit.js
+++ b/src/window/NotificationMatcherEdit.js
@@ -341,7 +341,7 @@ Ext.define('Proxmox.panel.NotificationRulesEditPanel', {
switch (value) {
case 'match-severity':
data = {
-   value: ['info', 'notice', 'warning', 'error'],
+   value: ['info', 'notice', 'warning', 'error', 
'unknown'],
};
break;
case 'match-field':
@@ -1096,6 +1096,7 @@ Ext.define('Proxmox.panel.NotificationMatchRuleSettings', 
{
['notice', gettext('Notice')],
['warning', gettext('Warning')],
['error', gettext('Error')],
+   ['unknown', gettext('Unknown')],
],
},
{
-- 
2.39.2



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



[pve-devel] [PATCH proxmox-mail-forward] do not forward on PBS systems if co-installed with PVE

2023-11-21 Thread Lukas Wagner
With the newly built-in targets/matchers, we should not add
a target/matcher manually any more. In fact, this broke mail
forwarding on PBS because 'default-matcher' already existed as a
built-in and could thus not be created.
We now simply do an early return.

Also initialize notify-context before instantiating the config,
since that already requires the context to be set.

Signed-off-by: Lukas Wagner 
---
 src/main.rs | 38 ++
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index e56bc1e..4662ffa 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -25,8 +25,6 @@ use anyhow::Error;
 
 use proxmox_notify::context::pbs::PBS_CONTEXT;
 use proxmox_notify::context::pve::PVE_CONTEXT;
-use proxmox_notify::endpoints::sendmail::SendmailConfig;
-use proxmox_notify::matcher::MatcherConfig;
 use proxmox_notify::Config;
 use proxmox_sys::fs;
 
@@ -74,48 +72,40 @@ fn forward_common(mail: &[u8], config: ) -> 
Result<(), Error> {
 
 /// Forward a mail to PVE's notification system
 fn forward_for_pve(mail: &[u8]) -> Result<(), Error> {
+proxmox_notify::context::set_context(_CONTEXT);
 let config = 
attempt_file_read(PVE_PUB_NOTIFICATION_CFG_FILENAME).unwrap_or_default();
 let priv_config = 
attempt_file_read(PVE_PRIV_NOTIFICATION_CFG_FILENAME).unwrap_or_default();
 
 let config = Config::new(, _config)?;
 
-proxmox_notify::context::set_context(_CONTEXT);
 forward_common(mail, )
 }
 
 /// Forward a mail to PBS's notification system
 fn forward_for_pbs(mail: &[u8], has_pve: bool) -> Result<(), Error> {
+proxmox_notify::context::set_context(_CONTEXT);
+
 let config = if Path::new(PBS_PUB_NOTIFICATION_CFG_FILENAME).exists() {
 let config = 
attempt_file_read(PBS_PUB_NOTIFICATION_CFG_FILENAME).unwrap_or_default();
 let priv_config = 
attempt_file_read(PBS_PRIV_NOTIFICATION_CFG_FILENAME).unwrap_or_default();
 
 Config::new(, _config)?
 } else {
-// TODO: This can be removed once PBS has full notification integration
-let mut config = Config::new("", "")?;
-if !has_pve {
-proxmox_notify::api::sendmail::add_endpoint(
- config,
- {
-name: "default-target".to_string(),
-mailto_user: Some(vec!["root@pam".to_string()]),
-..Default::default()
-},
-)?;
-
-proxmox_notify::api::matcher::add_matcher(
- config,
- {
-name: "default-matcher".to_string(),
-target: Some(vec!["default-target".to_string()]),
-..Default::default()
-},
-)?;
+// Instantiate empty config.
+// Note: This will contain the default built-in targets/matchers.
+let config = Config::new("", "")?;
+if has_pve {
+// Skip forwarding if we are co-installed with PVE AND
+// we do not have our own notifications.cfg file yet
+// --> We assume that PVE has a sane matcher configured that
+// forwards the mail properly
+// TODO: This can be removed once PBS has full notification 
integration
+
+return Ok(());
 }
 config
 };
 
-proxmox_notify::context::set_context(_CONTEXT);
 forward_common(mail, )?;
 
 Ok(())
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 4/7] gui: use basic grid in country/timezone panel

2023-11-21 Thread Maximiliano Sandoval
Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 34 --
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/proxinstall b/proxinstall
index 69c48b4..bdff22d 100755
--- a/proxinstall
+++ b/proxinstall
@@ -648,12 +648,12 @@ sub update_layout {
 
 my $lastzonecb;
 sub update_zonelist {
-my ($box, $cc) = @_;
+my ($grid, $cc) = @_;
 
 my $sel = Proxmox::Install::Config::get_timezone(); # initial default
 if ($lastzonecb) {
$sel = $lastzonecb->get_active_text();
-   $box->remove($lastzonecb);
+   $grid->remove($lastzonecb);
 }
 
 my $cb = $lastzonecb = Gtk3::ComboBoxText->new();
@@ -679,7 +679,7 @@ sub update_zonelist {
 $cb->set_active($selected_index || 0);
 
 $cb->show;
-$box->pack_start($cb, 0, 0, 0);
+$grid->attach($cb, 1, 1, 1, 1);
 }
 
 sub create_password_view {
@@ -775,10 +775,8 @@ sub create_country_view {
 
 my $locales = $iso_env->{locales};
 
-my $vbox2 =  Gtk3::Box->new('vertical', 0);
-$gtk_state->{inbox}->pack_start($vbox2, 1, 0, 0);
-my $vbox =  Gtk3::Box->new('vertical', 0);
-$vbox2->pack_start($vbox, 0, 0, 10);
+my $grid = &$create_basic_grid();
+$gtk_state->{inbox}->pack_start($grid, 0, 0, 0);
 
 my $w = Gtk3::Entry->new();
 $w->set_size_request(200, -1);
@@ -789,18 +787,16 @@ sub create_country_view {
 $c->set_popup_set_width(1);
 $c->set_inline_completion(1);
 
-my $hbox2 = Gtk3::Box->new('horizontal', 0);
 my $label = Gtk3::Label->new("Time zone");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox2->pack_start($label, 0, 0, 10);
-update_zonelist ($hbox2);
+$grid->attach($label, 0, 1, 1, 1);
+update_zonelist ($grid);
 
-my $hbox3 = Gtk3::Box->new('horizontal', 0);
 $label = Gtk3::Label->new("Keyboard Layout");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox3->pack_start($label, 0, 0, 10);
+$grid->attach($label, 0, 2, 1, 1);
 
 my $kmapcb = Gtk3::ComboBoxText->new();
 $kmapcb->set_size_request (200, -1);
@@ -809,7 +805,7 @@ sub create_country_view {
 }
 
 update_layout($kmapcb);
-$hbox3->pack_start ($kmapcb, 0, 0, 0);
+$grid->attach($kmapcb, 1, 2, 1, 1);
 
 $kmapcb->signal_connect ('changed' => sub {
my $sel = $kmapcb->get_active_text();
@@ -846,7 +842,7 @@ sub create_country_view {
my $text = $entry->get_text;
 
if (my $cc = $locales->{countryhash}->{lc($text)}) {
-   update_zonelist($hbox2, $cc);
+   update_zonelist($grid, $cc);
my $kmap = $locales->{country}->{$cc}->{kmap} || 'en-us';
update_layout($kmapcb, $kmap);
}
@@ -906,17 +902,11 @@ sub create_country_view {
 
 $w->set_completion ($c);
 
-my $hbox =  Gtk3::Box->new('horizontal', 0);
-
 $label = Gtk3::Label->new("Country");
 $label->set_xalign(1.0);
 $label->set_size_request(150, -1);
-$hbox->pack_start($label, 0, 0, 10);
-$hbox->pack_start($w, 0, 0, 0);
-
-$vbox->pack_start($hbox, 0, 0, 5);
-$vbox->pack_start($hbox2, 0, 0, 5);
-$vbox->pack_start($hbox3, 0, 0, 5);
+$grid->attach($label, 0, 0, 1, 1);
+$grid->attach($w, 1, 0, 1, 1);
 
 my $country = Proxmox::Install::Config::get_country();
 if ($country && (my $entry = $locales->{country}->{$country})) {
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 7/7] gui: remove trailing spaces and colons

2023-11-21 Thread Maximiliano Sandoval
For consistency sake, all colons and trailing spaces in labels that were
followed with an entry were removed, this matches other panels such as
the password and country/timezone panels.

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/proxinstall b/proxinstall
index 9551a89..015cf7b 100755
--- a/proxinstall
+++ b/proxinstall
@@ -416,7 +416,7 @@ sub create_ipconf_view {
$device_cb->set_active(0);
 }
 
-my $label = Gtk3::Label->new("Management Interface:");
+my $label = Gtk3::Label->new("Management Interface");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
 
@@ -428,7 +428,7 @@ sub create_ipconf_view {
 my $domain = $ipconf->{domain} || "example.invalid";
 $fqdn //= "$hostname.$domain";
 
-my ($host_label, $hostentry) = create_text_input($fqdn, 'Hostname 
(FQDN):');
+my ($host_label, $hostentry) = create_text_input($fqdn, 'Hostname (FQDN)');
 $grid->attach($host_label, 0, 1, 1, 1);
 $grid->attach($hostentry, 1, 1, 1, 1);
 
@@ -438,14 +438,14 @@ sub create_ipconf_view {
 my $cfg_gateway = Proxmox::Install::Config::get_gateway();
 my $gateway = $cfg_gateway // $ipconf->{gateway} || '192.168.100.1';
 
-my ($gw_label, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:');
+my ($gw_label, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway');
 $grid->attach($gw_label, 0, 3, 1, 1);
 $grid->attach($ipconf_entry_gw, 1, 3, 1, 1);
 
 my $cfg_dns = Proxmox::Install::Config::get_dns();
 my $dnsserver = $cfg_dns // $ipconf->{dnsserver} || $gateway;
 
-my ($dns_label, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS 
Server:');
+my ($dns_label, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS 
Server');
 
 $grid->attach($dns_label, 0, 4, 1, 1);
 $grid->attach($ipconf_entry_dns, 1, 4, 1, 1);
@@ -1332,7 +1332,7 @@ sub create_hdoption_view {
$target_hd_label->set_text("Target: $filesys ");
$options_stack->set_visible_child_name("raiddisk");
} else {
-   $target_hd_label->set_text("Target Harddisk: ");
+   $target_hd_label->set_text("Target Harddisk");
}
 
if ($raid) {
@@ -1438,7 +1438,7 @@ sub create_hdsel_view {
Proxmox::Install::Config::set_target_hd($devname);
 }
 
-$target_hd_label = Gtk3::Label->new("Target Harddisk: ");
+$target_hd_label = Gtk3::Label->new("Target Harddisk");
 $hbox->pack_start($target_hd_label, 0, 0, 0);
 
 $target_hd_combo = Gtk3::ComboBoxText->new();
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 3/7] gui: use basic grid in password panel

2023-11-21 Thread Maximiliano Sandoval
The extra 10px margin on the email row was added to account for the
removed line:

$vbox->pack_start($hbox3, 0, 0, 15);

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 29 +++--
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/proxinstall b/proxinstall
index a5de06c..69c48b4 100755
--- a/proxinstall
+++ b/proxinstall
@@ -688,47 +688,40 @@ sub create_password_view {
 
 my $password = Proxmox::Install::Config::get_password();
 
-my $vbox2 =  Gtk3::Box->new('vertical', 0);
-$gtk_state->{inbox}->pack_start($vbox2, 1, 0, 0);
-my $vbox =  Gtk3::Box->new('vertical', 0);
-$vbox2->pack_start($vbox, 0, 0, 10);
+my $grid = &$create_basic_grid();
+$gtk_state->{inbox}->pack_start($grid, 0, 0, 0);
 
-my $hbox1 = Gtk3::Box->new('horizontal', 0);
 my $label = Gtk3::Label->new("Password");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox1->pack_start($label, 0, 0, 10);
+$grid->attach($label, 0, 0, 1, 1);
 my $pwe1 = Gtk3::Entry->new();
 $pwe1->set_visibility(0);
 $pwe1->set_text($password) if $password;
 $pwe1->set_size_request(200, -1);
-$hbox1->pack_start($pwe1, 0, 0, 0);
+$grid->attach($pwe1, 1, 0, 1, 1);
 
-my $hbox2 = Gtk3::Box->new('horizontal', 0);
 $label = Gtk3::Label->new("Confirm");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox2->pack_start($label, 0, 0, 10);
+$grid->attach($label, 0, 1, 1, 1);
 my $pwe2 = Gtk3::Entry->new();
 $pwe2->set_visibility(0);
 $pwe2->set_text($password) if $password;
 $pwe2->set_size_request(200, -1);
-$hbox2->pack_start($pwe2, 0, 0, 0);
+$grid->attach($pwe2, 1, 1, 1, 1);
 
-my $hbox3 = Gtk3::Box->new('horizontal', 0);
 $label = Gtk3::Label->new("Email");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox3->pack_start($label, 0, 0, 10);
+$label->set_margin_top(10);
+$grid->attach($label, 0, 2, 1, 1);
+
 my $eme = Gtk3::Entry->new();
 $eme->set_size_request(200, -1);
 $eme->set_text(Proxmox::Install::Config::get_mailto());
-$hbox3->pack_start($eme, 0, 0, 0);
-
-
-$vbox->pack_start($hbox1, 0, 0, 5);
-$vbox->pack_start($hbox2, 0, 0, 5);
-$vbox->pack_start($hbox3, 0, 0, 15);
+$eme->set_margin_top(10);
+$grid->attach($eme, 1, 2, 1, 1);
 
 $gtk_state->{inbox}->show_all;
 
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 2/7] gui: expand ip address Gtk3::Entry

2023-11-21 Thread Maximiliano Sandoval
This accounts for the different layout set in the previous commit.

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 8f40234..a5de06c 100755
--- a/proxinstall
+++ b/proxinstall
@@ -308,7 +308,7 @@ sub create_cidr_inputs {
 
 my $ip_el = Gtk3::Entry->new();
 $ip_el->set_width_chars(28);
-$hbox->pack_start($ip_el, 0, 0, 0);
+$hbox->pack_start($ip_el, 1, 1, 0);
 $ip_el->set_text($default_ip);
 
 $label = Gtk3::Label->new('/');
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 6/7] gui: use basic grid in the network panel

2023-11-21 Thread Maximiliano Sandoval
Using boxes causes the labels to not align correctly in certain
circumstances. In the following commits we replace the use of boxes with
grids and set the margins and spacing directly on the respective grid.

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 52 
 1 file changed, 24 insertions(+), 28 deletions(-)

diff --git a/proxinstall b/proxinstall
index 87e81fd..9551a89 100755
--- a/proxinstall
+++ b/proxinstall
@@ -281,18 +281,14 @@ sub check_number {
 sub create_text_input {
 my ($default, $text) = @_;
 
-my $hbox = Gtk3::Box->new('horizontal', 0);
-
 my $label = Gtk3::Label->new($text);
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox->pack_start($label, 0, 0, 10);
 my $e1 = Gtk3::Entry->new();
 $e1->set_width_chars(35);
-$hbox->pack_start($e1, 0, 0, 0);
 $e1->set_text($default);
 
-return ($hbox, $e1);
+return ($label, $e1);
 }
 sub create_cidr_inputs {
 my ($cidr) = @_;
@@ -304,23 +300,22 @@ sub create_cidr_inputs {
 my $label = Gtk3::Label->new('IP Address (CIDR)');
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$hbox->pack_start($label, 0, 0, 10);
 
 my $ip_el = Gtk3::Entry->new();
 $ip_el->set_width_chars(28);
 $hbox->pack_start($ip_el, 1, 1, 0);
 $ip_el->set_text($default_ip);
 
-$label = Gtk3::Label->new('/');
-$label->set_size_request(10, -1);
-$hbox->pack_start($label, 0, 0, 2);
+my $dash_label = Gtk3::Label->new('/');
+$dash_label->set_size_request(10, -1);
+$hbox->pack_start($dash_label, 0, 0, 2);
 
 my $cidr_el = Gtk3::Entry->new();
 $cidr_el->set_width_chars(3);
 $hbox->pack_start($cidr_el, 0, 0, 0);
 $cidr_el->set_text($default_mask);
 
-return ($hbox, $ip_el, $cidr_el);
+return ($label, $hbox, $ip_el, $cidr_el);
 }
 
 my $ipconf_first_view = 1;
@@ -345,16 +340,15 @@ sub create_ipconf_view {
 cleanup_view();
 Proxmox::UI::display_html('ipconf.htm');
 
-my $vcontainer = Gtk3::Box->new('vertical', 0);
-$gtk_state->{inbox}->pack_start($vcontainer, 1, 0, 0);
-my $hcontainer =  Gtk3::Box->new('horizontal', 0);
-$vcontainer->pack_start($hcontainer, 0, 0, 10);
-my $vbox =  Gtk3::Box->new('vertical', 0);
-$hcontainer->add($vbox);
+my $grid = &$create_basic_grid();
+$grid->set_row_spacing(10);
+$grid->set_column_spacing(10);
+
+$gtk_state->{inbox}->pack_start($grid, 0, 0, 0);
 
 my $cidr = Proxmox::Install::Config::get_cidr() // '192.168.100.2/24';
 
-my ($cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = 
create_cidr_inputs($cidr);
+my ($cidr_label, $cidr_box, $ipconf_entry_addr, $ipconf_entry_mask) = 
create_cidr_inputs($cidr);
 
 my $device_model = Gtk3::ListStore->new('Glib::String', 'Glib::String');
 my $device_cb = Gtk3::ComboBox->new_with_model($device_model);
@@ -422,37 +416,39 @@ sub create_ipconf_view {
$device_cb->set_active(0);
 }
 
-my $devicebox = Gtk3::Box->new('horizontal', 0);
 my $label = Gtk3::Label->new("Management Interface:");
 $label->set_size_request(150, -1);
 $label->set_xalign(1.0);
-$devicebox->pack_start($label, 0, 0, 10);
-$devicebox->pack_start($device_cb, 0, 0, 0);
 
-$vbox->pack_start($devicebox, 0, 0, 2);
+$grid->attach($label, 0, 0, 1, 1);
+$grid->attach($device_cb, 1, 0, 1, 1);
 
 my $fqdn = Proxmox::Install::Config::get_fqdn();
 my $hostname = $run_env->{network}->{hostname} || $iso_env->{product};
 my $domain = $ipconf->{domain} || "example.invalid";
 $fqdn //= "$hostname.$domain";
 
-my ($hostbox, $hostentry) = create_text_input($fqdn, 'Hostname (FQDN):');
-$vbox->pack_start($hostbox, 0, 0, 2);
+my ($host_label, $hostentry) = create_text_input($fqdn, 'Hostname 
(FQDN):');
+$grid->attach($host_label, 0, 1, 1, 1);
+$grid->attach($hostentry, 1, 1, 1, 1);
 
-$vbox->pack_start($cidr_box, 0, 0, 2);
+$grid->attach($cidr_label, 0, 2, 1, 1);
+$grid->attach($cidr_box, 1, 2, 1, 1);
 
 my $cfg_gateway = Proxmox::Install::Config::get_gateway();
 my $gateway = $cfg_gateway // $ipconf->{gateway} || '192.168.100.1';
 
-my ($gwbox, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:');
-$vbox->pack_start($gwbox, 0, 0, 2);
+my ($gw_label, $ipconf_entry_gw) = create_text_input($gateway, 'Gateway:');
+$grid->attach($gw_label, 0, 3, 1, 1);
+$grid->attach($ipconf_entry_gw, 1, 3, 1, 1);
 
 my $cfg_dns = Proxmox::Install::Config::get_dns();
 my $dnsserver = $cfg_dns // $ipconf->{dnsserver} || $gateway;
 
-my ($dnsbox, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS 
Server:');
+my ($dns_label, $ipconf_entry_dns) = create_text_input($dnsserver, 'DNS 
Server:');
 
-$vbox->pack_start($dnsbox, 0, 0, 0);
+$grid->attach($dns_label, 0, 4, 1, 1);
+$grid->attach($ipconf_entry_dns, 1, 4, 1, 1);
 
 $gtk_state->{inbox}->show_all;

[pve-devel] [PATCH installer v2 5/7] gui: change margins in create_basic_grid

2023-11-21 Thread Maximiliano Sandoval
Previously the grids were inserted in a succession of boxes each with
its own set of margins and spacing. We define the margins now
exclusively in the grid and account for previous values.

Note that we match the top and bottom margins of the 'Target Harddisk'
panel which does not need to use a grid.

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/proxinstall b/proxinstall
index bdff22d..87e81fd 100755
--- a/proxinstall
+++ b/proxinstall
@@ -332,10 +332,10 @@ my $create_basic_grid = sub {
 $grid->set_row_spacing(10);
 $grid->set_hexpand(1);
 
-$grid->set_margin_start(10);
+$grid->set_margin_start(20);
 $grid->set_margin_end(20);
-$grid->set_margin_top(5);
-$grid->set_margin_bottom(5);
+$grid->set_margin_top(10);
+$grid->set_margin_bottom(10);
 
 return $grid;
 };
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 1/7] gui: move create_basic_grid subroutine definition up

2023-11-21 Thread Maximiliano Sandoval
This will be used in future commits to create grids so we need it to be defined.

Signed-off-by: Maximiliano Sandoval 
---
 proxinstall | 30 +++---
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/proxinstall b/proxinstall
index 01d4cfe..8f40234 100755
--- a/proxinstall
+++ b/proxinstall
@@ -325,6 +325,21 @@ sub create_cidr_inputs {
 
 my $ipconf_first_view = 1;
 
+my $create_basic_grid = sub {
+my $grid =  Gtk3::Grid->new();
+$grid->set_visible(1);
+$grid->set_column_spacing(10);
+$grid->set_row_spacing(10);
+$grid->set_hexpand(1);
+
+$grid->set_margin_start(10);
+$grid->set_margin_end(20);
+$grid->set_margin_top(5);
+$grid->set_margin_bottom(5);
+
+return $grid;
+};
+
 sub create_ipconf_view {
 
 cleanup_view();
@@ -941,21 +956,6 @@ my $target_hd_label;
 
 my $hdoption_first_setup = 1;
 
-my $create_basic_grid = sub {
-my $grid =  Gtk3::Grid->new();
-$grid->set_visible(1);
-$grid->set_column_spacing(10);
-$grid->set_row_spacing(10);
-$grid->set_hexpand(1);
-
-$grid->set_margin_start(10);
-$grid->set_margin_end(20);
-$grid->set_margin_top(5);
-$grid->set_margin_bottom(5);
-
-return $grid;
-};
-
 # takes an array ref of rows with [$label_text, $widget, $suffix_label] array 
refs as columns
 # $suffix_label is optional
 my $create_label_widget_grid = sub {
-- 
2.39.2



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



[pve-devel] [PATCH installer v2 0/7] gui: use gtk grids when possible

2023-11-21 Thread Maximiliano Sandoval
We replace the use of nested boxes with grids when possible to ensure correct
margins and alignment of widgets.

At the end we also remove trailing spaces and colons from labels preceding an
input widget, e.g. we replace `DNS Server: ` with `DNS Server`.

Differences from v1:
  - Rebased on top of master

Maximiliano Sandoval (7):
  gui: move create_basic_grid subroutine definition up
  gui: expand ip address Gtk3::Entry
  gui: use basic grid in password panel
  gui: use basic grid in country/timezone panel
  gui: change margins in create_basic_grid
  gui: use basic grid in the network panel
  gui: remove trailing spaces and colons

 proxinstall | 153 +++-
 1 file changed, 66 insertions(+), 87 deletions(-)

-- 
2.39.2



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



[pve-devel] [PATCH pve-container 2/3] sdn: pass vmid and hostname to add_dhcp_mapping

2023-11-21 Thread Stefan Lendl
If no DHCP mapping was found in IPAM it will request a new IP.
In order to register an IPAM mapping it requires these values.

Signed-off-by: Stefan Lendl 
---
 src/PVE/LXC.pm| 4 ++--
 src/lxc-pve-prestart-hook | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index 9361823..7883cfb 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -993,7 +993,7 @@ sub update_net {
warn $@ if $@;
 
PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, 
$conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{hwaddr});
+   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{hwaddr}, $vmid, $conf->{hostname});
}
 
delete $conf->{$opt};
@@ -1046,7 +1046,7 @@ sub update_net {
 } else {
if ($have_sdn) {
PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, 
$conf->{hostname}, $newnet->{hwaddr}, $vmid, undef, 1);
-   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{hwaddr});
+   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{hwaddr}, $vmid, $conf->{hostname});
}
 
hotplug_net($vmid, $conf, $opt, $newnet, $netid);
diff --git a/src/lxc-pve-prestart-hook b/src/lxc-pve-prestart-hook
index ab35774..4f5c7e2 100755
--- a/src/lxc-pve-prestart-hook
+++ b/src/lxc-pve-prestart-hook
@@ -210,7 +210,7 @@ PVE::LXC::Tools::lxc_hook('pre-start', 'lxc', sub {
next if $k !~ /^net(\d+)/;
my $net = PVE::LXC::Config->parse_lxc_network($conf->{$k});
next if $net->{type} ne 'veth';
-   PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{hwaddr});
+   PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{hwaddr}, $conf->{vmid}, $conf->{hostname});
}
 }
 });
-- 
2.42.0



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



[pve-devel] [PATCH qemu-server 3/3] sdn: pass vmid and hostname to add_dhcp_mapping

2023-11-21 Thread Stefan Lendl
if no DHCP mapping was found in IPAM it will request a new IP which
requires these values.

Signed-off-by: Stefan Lendl 
---
 PVE/QemuServer.pm | 2 +-
 vm-network-scripts/pve-bridge | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 3028e70..978aac7 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -5381,7 +5381,7 @@ sub vmconfig_update_net {
 if ($hotplug) {
if ($have_sdn) {
PVE::Network::SDN::Vnets::add_next_free_cidr($newnet->{bridge}, 
$conf->{name}, $newnet->{macaddr}, $vmid, undef, 1);
-   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{macaddr});
+   PVE::Network::SDN::Vnets::add_dhcp_mapping($newnet->{bridge}, 
$newnet->{macaddr}, $vmid, $conf->{name});
}
vm_deviceplug($storecfg, $conf, $vmid, $opt, $newnet, $arch, 
$machine_type);
 } else {
diff --git a/vm-network-scripts/pve-bridge b/vm-network-scripts/pve-bridge
index e8f8798..85997a0 100755
--- a/vm-network-scripts/pve-bridge
+++ b/vm-network-scripts/pve-bridge
@@ -37,7 +37,7 @@ my $conf = PVE::QemuConfig->load_config($vmid, $migratedfrom);
 my $netconf = $conf->{$netid};
 
 $netconf = $conf->{pending}->{$netid} if !$migratedfrom && 
defined($conf->{pending}->{$netid}); 
- 
+
 die "unable to get network config '$netid'\n"
 if !defined($netconf);
 
@@ -45,7 +45,7 @@ my $net = PVE::QemuServer::parse_net($netconf);
 die "unable to parse network config '$netid'\n" if !$net;
 
 if ($have_sdn) {
-PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{macaddr});
+PVE::Network::SDN::Vnets::add_dhcp_mapping($net->{bridge}, 
$net->{macaddr}, $vmid, $conf->{name});
 PVE::Network::SDN::Zones::tap_create($iface, $net->{bridge});
 PVE::Network::SDN::Zones::tap_plug($iface, $net->{bridge}, $net->{tag}, 
$net->{firewall}, $net->{trunks}, $net->{rate});
 } else {
-- 
2.42.0



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



[pve-devel] [PATCH pve-network 1/3] sdn: register MAC in IPAM if not found

2023-11-21 Thread Stefan Lendl
if inside add_dhcp_mapping, which is called at VM or LCX start, we do
not find an IP in IPAM, register the MAC.

This is very useful as a fallback if for some reason an IP mapping was
deleted or there is a bug somewhere that does not register an IP.

This acts more like DHCP to allocate an IP on demand.

In order to properly register the IP, the VMID and hostname is required
as a parameter.

Signed-off-by: Stefan Lendl 
---
 src/PVE/Network/SDN/Vnets.pm | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN/Vnets.pm b/src/PVE/Network/SDN/Vnets.pm
index 09378ff..0dfdfd7 100644
--- a/src/PVE/Network/SDN/Vnets.pm
+++ b/src/PVE/Network/SDN/Vnets.pm
@@ -186,7 +186,7 @@ sub del_ips_from_mac {
 }
 
 sub add_dhcp_mapping {
-my ($vnetid, $mac) = @_;
+my ($vnetid, $mac, $vmid, $name) = @_;
 
 my $vnet = PVE::Network::SDN::Vnets::get_vnet($vnetid);
 return if !$vnet;
@@ -195,7 +195,13 @@ sub add_dhcp_mapping {
 
 return if !$zone->{ipam} || !$zone->{dhcp};
 
-my ($ip4,$ip6) = PVE::Network::SDN::Vnets::get_ips_from_mac($vnetid, $mac);
+my ($ip4, $ip6) = PVE::Network::SDN::Vnets::get_ips_from_mac($vnetid, 
$mac);
+if ( ! ($ip4 || $ip6) ) {
+   print "No IP found for MAC: $mac for VMID:$vmid\n";
+   add_next_free_cidr($vnetid, $name, $mac, "$vmid", undef, 1);
+   ($ip4, $ip6) = PVE::Network::SDN::Vnets::get_ips_from_mac($vnetid, 
$mac);
+   print "got new IP from IPAM: $ip4 $ip6\n";
+}
 PVE::Network::SDN::Dhcp::add_mapping($vnetid, $mac, $ip4, $ip6) if $ip4 || 
$ip6;
 }
 
-- 
2.42.0



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



[pve-devel] [PATCH network/container/qemu-server 0/3] sdn: register a new IP at VM start if missing

2023-11-21 Thread Stefan Lendl


If a VM or LXC starts and no IP was found in the IPAM, register a new one.

This is very seful as a fallback if for some reason an IP mapping was deleted
or there is a bug somewhere that does not register an IP.

This acts more like DHCP to allocate an IP on demand.

Special case that is not covered:
  If a subnet with IPv4 exists and VMs are present, adding a new subnet with
  IPv6, this will not register an IPv6. And vice-versa.



pve-network:

Stefan Lendl (1):
  sdn: register MAC in IPAM if not found

 src/PVE/Network/SDN/Vnets.pm | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)


pve-container:

Stefan Lendl (1):
  sdn: pass vmid and hostname to add_dhcp_mapping

 src/PVE/LXC.pm| 4 ++--
 src/lxc-pve-prestart-hook | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)


qemu-server:

Stefan Lendl (1):
  sdn: pass vmid and hostname to add_dhcp_mapping

 PVE/QemuServer.pm | 2 +-
 vm-network-scripts/pve-bridge | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Summary over all repositories:
  5 files changed, 14 insertions(+), 8 deletions(-)

-- 
murpp v0.4.0



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



[pve-devel] [PATCH pve-manager 2/4] ui: sdn: fix onlineHelp anchors

2023-11-21 Thread Lukas Wagner
These have been renamed in:
bcb72b 'sdn: overall language and consistency rework' in pve-docs

Signed-off-by: Lukas Wagner 
---
 www/manager6/sdn/VnetPanel.js| 2 +-
 www/manager6/sdn/VnetView.js | 6 +++---
 www/manager6/sdn/ZoneContentPanel.js | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/www/manager6/sdn/VnetPanel.js b/www/manager6/sdn/VnetPanel.js
index b8377cbc..107ecc9b 100644
--- a/www/manager6/sdn/VnetPanel.js
+++ b/www/manager6/sdn/VnetPanel.js
@@ -4,7 +4,7 @@ Ext.define('PVE.sdn.Vnet', {
 
 title: 'VNet',
 
-onlineHelp: 'pvesdn_config_vnet',
+onlineHelp: 'pvesdn_config_vnets',
 
 initComponent: function() {
var me = this;
diff --git a/www/manager6/sdn/VnetView.js b/www/manager6/sdn/VnetView.js
index 3fd3c916..65e5c00a 100644
--- a/www/manager6/sdn/VnetView.js
+++ b/www/manager6/sdn/VnetView.js
@@ -2,7 +2,7 @@ Ext.define('PVE.sdn.VnetView', {
 extend: 'Ext.grid.GridPanel',
 alias: 'widget.pveSDNVnetView',
 
-onlineHelp: 'pvesdn_config_vnet',
+onlineHelp: 'pvesdn_config_vnets',
 
 stateful: true,
 stateId: 'grid-sdn-vnet',
@@ -33,7 +33,7 @@ Ext.define('PVE.sdn.VnetView', {
 
let win = Ext.create('PVE.sdn.VnetEdit', {
autoShow: true,
-   onlineHelp: 'pvesdn_config_vnet',
+   onlineHelp: 'pvesdn_config_vnets',
vnet: rec.data.vnet,
});
win.on('destroy', reload);
@@ -74,7 +74,7 @@ Ext.define('PVE.sdn.VnetView', {
handler: function() {
let win = Ext.create('PVE.sdn.VnetEdit', {
autoShow: true,
-   onlineHelp: 'pvesdn_config_vnet',
+   onlineHelp: 'pvesdn_config_vnets',
type: 'vnet',
});
win.on('destroy', reload);
diff --git a/www/manager6/sdn/ZoneContentPanel.js 
b/www/manager6/sdn/ZoneContentPanel.js
index b5c7f492..e9058f9a 100644
--- a/www/manager6/sdn/ZoneContentPanel.js
+++ b/www/manager6/sdn/ZoneContentPanel.js
@@ -4,7 +4,7 @@ Ext.define('PVE.sdn.ZoneContentPanel', {
 
 title: 'VNet',
 
-onlineHelp: 'pvesdn_config_vnet',
+onlineHelp: 'pvesdn_config_vnets',
 
 initComponent: function() {
var me = this;
-- 
2.39.2



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



[pve-devel] [PATCH pve-docs 1/4] notification: add anchors for target types/matchers

2023-11-21 Thread Lukas Wagner
This enables us to directly link to the appropriate section from the
UI.

Signed-off-by: Lukas Wagner 
---
 notifications.adoc | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/notifications.adoc b/notifications.adoc
index 74447e5..21e13c4 100644
--- a/notifications.adoc
+++ b/notifications.adoc
@@ -39,6 +39,7 @@ passwords or authentication tokens for notification targets.
 Notification Targets
 
 
+[[notification_targets_sendmail]]
 Sendmail
 
 The sendmail binary is a program commonly found on Unix-like operating systems
@@ -80,6 +81,7 @@ sendmail: example
 comment Send to multiple users/addresses
 
 
+[[notification_targets_smtp]]
 SMTP
 
 
@@ -126,6 +128,7 @@ smtp: example
 password somepassword
 
 
+[[notification_targets_gotify]]
 Gotify
 ~~
 
@@ -196,6 +199,7 @@ a matcher must be true. Defaults to `all`.
 * `match-severity`: Match the notification's severity
 * `comment`: Comment for this matcher
 
+[[notification_matchers_calendar]]
 Calendar Matching Rules
 ~~~
 A calendar matcher matches the time when a notification is sent agaist a
@@ -206,6 +210,7 @@ configurable schedule.
 * `match-calendar mon-fri 9:00-17:00`
 * `match-calendar sun,tue-wed,fri 9-17`
 
+[[notification_matchers_field]]
 Field Matching Rules
 
 Notifications have a selection of metadata fields that can be matched.
@@ -220,6 +225,7 @@ For instance, a `match-field regex:hostname=.*` directive 
will only match
 notifications that have an arbitraty `hostname` metadata field, but will
 not match if the field does not exist.
 
+[[notification_matchers_severity]]
 Severity Matching Rules
 ~~~
 A notification has a associated severity that can be matched.
-- 
2.39.2



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



[pve-devel] [PATCH proxmox-widget-toolkit 4/4] notification ui: add appropriate onlineHelp anchors

2023-11-21 Thread Lukas Wagner
This links the dialog windows to the correct help section (different
target types, matchers).

Signed-off-by: Lukas Wagner 
---
 src/panel/GotifyEditPanel.js  | 1 +
 src/panel/NotificationConfigView.js   | 1 +
 src/panel/SendmailEditPanel.js| 1 +
 src/panel/SmtpEditPanel.js| 1 +
 src/window/NotificationMatcherEdit.js | 1 +
 5 files changed, 5 insertions(+)

diff --git a/src/panel/GotifyEditPanel.js b/src/panel/GotifyEditPanel.js
index 7e6ecd8..0e8cac4 100644
--- a/src/panel/GotifyEditPanel.js
+++ b/src/panel/GotifyEditPanel.js
@@ -2,6 +2,7 @@ Ext.define('Proxmox.panel.GotifyEditPanel', {
 extend: 'Proxmox.panel.InputPanel',
 xtype: 'pmxGotifyEditPanel',
 mixins: ['Proxmox.Mixin.CBind'],
+onlineHelp: 'notification_targets_gotify',
 
 type: 'gotify',
 
diff --git a/src/panel/NotificationConfigView.js 
b/src/panel/NotificationConfigView.js
index 4695da5..4d3ee46 100644
--- a/src/panel/NotificationConfigView.js
+++ b/src/panel/NotificationConfigView.js
@@ -2,6 +2,7 @@ Ext.define('Proxmox.panel.NotificationConfigView', {
 extend: 'Ext.panel.Panel',
 alias: 'widget.pmxNotificationConfigView',
 mixins: ['Proxmox.Mixin.CBind'],
+onlineHelp: 'chapter_notifications',
 layout: {
type: 'border',
 },
diff --git a/src/panel/SendmailEditPanel.js b/src/panel/SendmailEditPanel.js
index b744787..5a154c1 100644
--- a/src/panel/SendmailEditPanel.js
+++ b/src/panel/SendmailEditPanel.js
@@ -4,6 +4,7 @@ Ext.define('Proxmox.panel.SendmailEditPanel', {
 mixins: ['Proxmox.Mixin.CBind'],
 
 type: 'sendmail',
+onlineHelp: 'notification_targets_sendmail',
 
 mailValidator: function() {
let mailto_user = this.down(`[name=mailto-user]`);
diff --git a/src/panel/SmtpEditPanel.js b/src/panel/SmtpEditPanel.js
index 218485d..8b258e0 100644
--- a/src/panel/SmtpEditPanel.js
+++ b/src/panel/SmtpEditPanel.js
@@ -2,6 +2,7 @@ Ext.define('Proxmox.panel.SmtpEditPanel', {
 extend: 'Proxmox.panel.InputPanel',
 xtype: 'pmxSmtpEditPanel',
 mixins: ['Proxmox.Mixin.CBind'],
+onlineHelp: 'notification_targets_smtp',
 
 type: 'smtp',
 
diff --git a/src/window/NotificationMatcherEdit.js 
b/src/window/NotificationMatcherEdit.js
index ee08c16..9ee34fd 100644
--- a/src/window/NotificationMatcherEdit.js
+++ b/src/window/NotificationMatcherEdit.js
@@ -73,6 +73,7 @@ Ext.define('Proxmox.window.NotificationMatcherEdit', {
 extend: 'Proxmox.window.Edit',
 
 isAdd: true,
+onlineHelp: 'notification_matchers',
 
 fieldDefaults: {
labelWidth: 120,
-- 
2.39.2



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



[pve-devel] [PATCH docs/manager/proxmox-widget-toolkit 0/4] notifications: add help buttons, linking to the appropriate sections

2023-11-21 Thread Lukas Wagner
Add help buttons for notification related UIs, linking to the appropriate
section in the documentation.

First patch for pve-manager fixes the build against the latest
pve-doc-generator package from the current git master. 

Requires pve-doc packages to be bumped (due to new section anchors)



pve-docs:

Lukas Wagner (1):
  notification: add anchors for target types/matchers

 notifications.adoc | 6 ++
 1 file changed, 6 insertions(+)


pve-manager:

Lukas Wagner (2):
  ui: sdn: fix onlineHelp anchors
  ui: dc: config: remove onlineHelp for notification config view

 www/manager6/dc/Config.js| 1 -
 www/manager6/sdn/VnetPanel.js| 2 +-
 www/manager6/sdn/VnetView.js | 6 +++---
 www/manager6/sdn/ZoneContentPanel.js | 2 +-
 4 files changed, 5 insertions(+), 6 deletions(-)


proxmox-widget-toolkit:

Lukas Wagner (1):
  notification ui: add appropriate onlineHelp anchors

 src/panel/GotifyEditPanel.js  | 1 +
 src/panel/NotificationConfigView.js   | 1 +
 src/panel/SendmailEditPanel.js| 1 +
 src/panel/SmtpEditPanel.js| 1 +
 src/window/NotificationMatcherEdit.js | 1 +
 5 files changed, 5 insertions(+)


Summary over all repositories:
  10 files changed, 16 insertions(+), 6 deletions(-)

-- 
murpp v0.4.0



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



[pve-devel] [PATCH pve-manager 3/4] ui: dc: config: remove onlineHelp for notification config view

2023-11-21 Thread Lukas Wagner
The 'onlineHelp' is now set in the component definition in
'proxmox-widget-toolkit'.

Signed-off-by: Lukas Wagner 
---
 www/manager6/dc/Config.js | 1 -
 1 file changed, 1 deletion(-)

diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 74a84e91..f22688f8 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -324,7 +324,6 @@ Ext.define('PVE.dc.Config', {
{
xtype: 'pmxNotificationConfigView',
title: gettext('Notifications'),
-   onlineHelp: 'notification_targets',
itemId: 'notification-targets',
iconCls: 'fa fa-bell-o',
baseUrl: '/cluster/notifications',
-- 
2.39.2



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



Re: [pve-devel] [PATCH storage v3 0/4] pbs: fix #5008: Prevent adding pbs storage with invalid namespace

2023-11-21 Thread Philipp Hufnagl



On 11/21/23 14:40, Christian Ebner wrote:
> 
>> On 21.11.2023 14:12 CET Philipp Hufnagl  wrote:
>>
>>
>> Hmmm...  thats very curios. I tried that on my end and it worked fine.
>>
>> What datastore did you try to delete? Did you have a valid
>> configuration for it?
> 
> Not deleting a datastore (that works fine), I was testing if I am able
> to deactivate it (or edit it in general).
> 
> Datastore config is valid, and as stated without your patches applied
> it works as expected. I just double checked with a freshly created
> datastore, still got the same behavior.
> 
> Cheers,
> Chris

I have managed to reproduce it. Thank you

I look into it. Thank you


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



[pve-devel] applied-series: [PATCH v4 qemu-server 21/33] vmnic add|remove : add|del ip in ipam

2023-11-21 Thread Wolfgang Bumiller
applied qemu-server series (also with a small $have_sdn guard fixup ;-)
)
thanks


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



[pve-devel] applied: [PATCH pve-network] dhcp: fix allocating IP for every defined dhcp-range

2023-11-21 Thread Wolfgang Bumiller
applied, thanks


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



[pve-devel] applied-series: [PATCH v4 pve-container 27/33] nic hotplug : add|del ips in ipam

2023-11-21 Thread Wolfgang Bumiller
applied container series with a small `$have_sdn` guard fixup


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



[pve-devel] applied-series: [PATCH pve-network 1/2] sdn: require ipam in simple plugin for dhcp

2023-11-21 Thread Wolfgang Bumiller
applied both, thanks


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



Re: [pve-devel] [PATCH storage v3 0/4] pbs: fix #5008: Prevent adding pbs storage with invalid namespace

2023-11-21 Thread Christian Ebner


> On 21.11.2023 14:12 CET Philipp Hufnagl  wrote:
> 
> 
> Hmmm...  thats very curios. I tried that on my end and it worked fine.
> 
> What datastore did you try to delete? Did you have a valid
> configuration for it?

Not deleting a datastore (that works fine), I was testing if I am able
to deactivate it (or edit it in general).

Datastore config is valid, and as stated without your patches applied
it works as expected. I just double checked with a freshly created
datastore, still got the same behavior.

Cheers,
Chris


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



[pve-devel] applied: [PATCH manager v4 0/3] fix 2515 use size defaults

2023-11-21 Thread Thomas Lamprecht
Am 29/09/2023 um 15:02 schrieb Aaron Lauterer:
> The main goal of this series is to improve the handling of configured
> default size & min_size values when creating a new Ceph Pool in the GUI.
> 
> A new Ceph API endpoint, 'cfg/value', is added. It allows us to fetch
> values for config keys that are set either in the config DB of Ceph or
> in the ceph.conf file.
> 
> changes since
> v3: rebased
> 
> v2:
> * API rework has been already applied
> * cleaned up JS code to set default values right where we get them from
>   the API instead of at multiple places in the CephPoolInputPanel
>   itself.
> 
> Aaron Lauterer (3):
>   api: ceph: add endpoint to fetch config keys
>   fix #2515: ui: ceph pool create: use configured defaults for size and
> min_size
>   ui: ceph pool edit: rework with controller and formulas
> 
>  PVE/API2/Ceph/Cfg.pm  |  82 ++
>  www/manager6/ceph/Pool.js | 144 +-
>  2 files changed, 191 insertions(+), 35 deletions(-)
> 


applied series with Maximilano's T-b, 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] ui: qemu wizard: use better boot order for second cd drive

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 09:35 schrieb Dominik Csapak:
> in the case we add a second cd drive (for windows), we don't want the
> backend logic to only include the first one, since we cannot know
> which is bootable and which is (probably) the virtio iso.
> 
> so instead, emulate the backend logic for the wizard but include both cd
> drives in that case, otherwise let the backend decide like before
> 
> Signed-off-by: Dominik Csapak 
> ---
> this is a follow up to "ui: vm wizard: allow second iso for windows vms":
> https://lists.proxmox.com/pipermail/pve-devel/2023-November/060546.html
> 
>  www/manager6/qemu/CreateWizard.js | 49 ++-
>  1 file changed, 48 insertions(+), 1 deletion(-)
> 
>

applied, thanks!


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



[pve-devel] [PATCH pve-network 1/2] sdn: require ipam in simple plugin for dhcp

2023-11-21 Thread Stefan Hanreich
Suggested-By: Wolfgang Bumiller 
Signed-off-by: Stefan Hanreich 
---
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm 
b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index f30278c..f4525d5 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -30,6 +30,7 @@ sub properties {
dhcp => {
type => 'pve-configid',
description => 'ID of the DHCP server responsible for managing this 
range',
+   requires => 'ipam',
},
 };
 }
-- 
2.39.2


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



[pve-devel] [PATCH pve-network 2/2] sdn: simple: Improve dhcp property description and validation

2023-11-21 Thread Stefan Hanreich
Signed-off-by: Stefan Hanreich 
---
 src/PVE/Network/SDN/Zones/SimplePlugin.pm | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/PVE/Network/SDN/Zones/SimplePlugin.pm 
b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
index f4525d5..7cb65c2 100644
--- a/src/PVE/Network/SDN/Zones/SimplePlugin.pm
+++ b/src/PVE/Network/SDN/Zones/SimplePlugin.pm
@@ -3,6 +3,7 @@ package PVE::Network::SDN::Zones::SimplePlugin;
 use strict;
 use warnings;
 use PVE::Network::SDN::Zones::Plugin;
+use PVE::Network::SDN::Dhcp::Plugin;
 use PVE::Exception qw(raise raise_param_exc);
 use PVE::Cluster;
 use PVE::Tools;
@@ -28,8 +29,9 @@ sub properties {
description => "dns domain zone  ex: mydomain.com",
},
dhcp => {
-   type => 'pve-configid',
-   description => 'ID of the DHCP server responsible for managing this 
range',
+   description => 'Type of the DHCP backend for this zone',
+   type => 'string',
+   enum => PVE::Network::SDN::Dhcp::Plugin->lookup_types(),
requires => 'ipam',
},
 };
-- 
2.39.2


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



[pve-devel] applied: [PATCH docs v15 2/2] add VNC clipboard documentation

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 13:39 schrieb Markus Frank:
> Signed-off-by: Markus Frank 
> Reviewed-by: Dominik Csapak 
> Tested-by: Dominik Csapak 
> ---
>  qm.adoc | 18 ++
>  1 file changed, 18 insertions(+)
> 
>

applied, thanks!


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



Re: [pve-devel] [PATCH v4 cluster/network/manager/qemu-server/container/docs 00/33] Add support for DHCP servers to SDN

2023-11-21 Thread DERUMIER, Alexandre
Another example with custom dhcpv6 options + client script

https://serverfault.com/a/528425

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



Re: [pve-devel] [PATCH v4 manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Philipp Hufnagl



On 11/21/23 13:52, Lukas Wagner wrote:
> This patch series adds the 'notification-mode' setting for backup jobs.
> It allows users to choose between the 'old-style' notifications 
> (mail to configured address, directly via a call to sendmail) or 
> the 'new-style' notification system.
> 
> notification-mode has three possible values:
>   - legacy-sendmail: Use old system, considering mailto/mailtnotification 
> parameters
>   - notification-system: Use the new system (always sending a notification, 
> irregardless 
> of success/failure. The user is supposed to configure filtering/matching 
> in 
> notification settings)
>   - auto: use old system if mailto is set, or new system if not
> 
> This should provide a fix/workaround for the users' reports of
>   - double notifications (these happened in case mailto was set to the same 
> address
> as root@pam)
>   - notifications always being sent, even if 'mailnotification' is set to 
> failure
> 
> Changes v2 -> v3:
>   - change field text in the GUI for the 'mailnotification' param
> This should highlight that this setting only affects the 
> 'legacy-sendmail' 
> notification mails
> 
> Changes v3 -> v4:
>   - fix eslint warnings (thx @Philipp)
>   - drop already applied pve-guest-common patch
> 
> 
> 
> pve-manager:
> 
> Lukas Wagner (4):
>   vzdump: support 'notification-mode' parameter
>   ui: backup jobs: add 'notification-mode' selector for backup jobs
>   ui: backup: add 'notification-mode' param for one-shot backup jobs.
>   ui: backup job: change field text for 'mailnotification' field
> 
>  PVE/VZDump.pm | 95 +++
>  www/manager6/dc/Backup.js | 34 ++-
>  .../form/NotificationPolicySelector.js|  2 +-
>  www/manager6/window/Backup.js | 25 +
>  4 files changed, 116 insertions(+), 40 deletions(-)
> 
> 
> Summary over all repositories:
>   4 files changed, 116 insertions(+), 40 deletions(-)
> 

I do not know if this is expected but when I enter an invalid email
address for a user, and then press "Test" for SMTP, I get a message
that the email has been sent successfully, however the receiver does
not get any email and the sender account gets "Undelivered Mail
Returned to Sender".


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



Re: [pve-devel] [PATCH v4 cluster/network/manager/qemu-server/container/docs 00/33] Add support for DHCP servers to SDN

2023-11-21 Thread DERUMIER, Alexandre
see this old article: 

https://www.isc.org/blogs/routing-configuration-over-dhcpv6-2/

for the custom dhcp option + script on client side

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



[pve-devel] applied: [PATCH manager v2 1/2] ui: refactor iso selector out of the cd input panel

2023-11-21 Thread Thomas Lamprecht
Am 20/11/2023 um 16:45 schrieb Dominik Csapak:
> and make it into a proper field
> it's intended to be used like a single field and exactly as before
> 
> Signed-off-by: Dominik Csapak 
> ---
> no changes
>  www/manager6/Makefile|   1 +
>  www/manager6/form/IsoSelector.js | 107 +++
>  www/manager6/qemu/CDEdit.js  |  38 ++-
>  3 files changed, 115 insertions(+), 31 deletions(-)
>  create mode 100644 www/manager6/form/IsoSelector.js
> 
>

applied series, with slight rename to the boxLabel to better hint
that we expect a virtio driver ISO here, thanks!


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



[pve-devel] applied: [PATCH installer] ZFS: detect and handle secure boot

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 14:13 schrieb Fabian Grünbichler:
> and switch the ESP to grub if it is enabled.
> 
> Signed-off-by: Fabian Grünbichler 
> ---
>  Proxmox/Install.pm | 17 +++--
>  1 file changed, 15 insertions(+), 2 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 installer v2] zfs: create dataset var-lib-vz for /var/lib/vz

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 14:11 schrieb Stoiko Ivanov:
> Creating rpool/var/lib/vz and all intermediate datasets causes a
> service-failure of `var.mount` upon shutdown.
> 
> creating the dataset for /var/lib/vz directly at the rpool and setting
> its mountpoint property seems the most robust way to address this.
> 
> The alternative approach of setting `canmount=off` on the `var`
> dataset seems a bit dangerous (users setting a zfs property and
> suddenly hiding their /var contents).
> 
> The only small downside to this approach is that the setting of the
> mountpoint happens quite a bit after extracting the data - but this
> would probably be better addressed with a refactoring of the
> lowlevel-installer code (setting the zfs-pool up under /target and
> getting rid of a few special cases)
> 
> Fixes: dd19d40ceac179ba18652f1d6c3e4c23f246af00
> Suggested-by: Fabian Grünbichler 
> Signed-off-by: Stoiko Ivanov 
> ---
> huge Thanks to Fabian - for the feedback and patiently walking me through
> the potential pitfalls!
> 
>  Proxmox/Install.pm | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
>

applied, thanks!


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


[pve-devel] [PATCH installer 1/3] perform early check on hdsize

2023-11-21 Thread Folke Gleumes
until now it was only checked at install time, failing the whole
installation

Signed-off-by: Folke Gleumes 
---
 proxinstall | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/proxinstall b/proxinstall
index 01d4cfe..cf8f510 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1526,6 +1526,12 @@ sub create_hdsel_view {
$target_hds = [ $target_hd ];
}
 
+   my $hdsize = Proxmox::Install::Config::get_hdsize();
+   if (defined $hdsize && $hdsize < 2.0) {
+   Proxmox::UI::message("Warning: A minimum disk size of 2.0GB is 
expected.\n");
+   return;
+   }
+
$step_number++;
create_country_view();
 });
-- 
2.39.2



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



[pve-devel] [PATCH installer 3/3] only set hdsize when deviating from the maximum

2023-11-21 Thread Folke Gleumes
this prevents a lower hdsize to be set, when intermittently adding a
smaller storage device.

Signed-off-by: Folke Gleumes 
---
 proxinstall | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/proxinstall b/proxinstall
index 4fc31f8..695826d 100755
--- a/proxinstall
+++ b/proxinstall
@@ -1409,7 +1409,10 @@ sub create_hdoption_view {
 
 my $tmp;
 
-if (($tmp = &$get_float($spinbutton_hdsize)) && ($tmp != $hdsize)) {
+if (
+   ($tmp = &$get_float($spinbutton_hdsize)) && ($tmp != $hdsize)
+   && ($tmp != $get_max_hdsize->())
+) {
Proxmox::Install::Config::set_hdsize($tmp);
 } else {
Proxmox::Install::Config::set_hdsize(undef);
-- 
2.39.2



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



[pve-devel] [PATCH installer 2/3] set correct maximum for hdsize input

2023-11-21 Thread Folke Gleumes
previously, when opening the dialog multiple times, the maximum was
determined by the previous set value, not the maxium possible for the
storage

Signed-off-by: Folke Gleumes 
---
 proxinstall | 25 +
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/proxinstall b/proxinstall
index cf8f510..4fc31f8 100755
--- a/proxinstall
+++ b/proxinstall
@@ -985,14 +985,11 @@ my $create_label_widget_grid = sub {
 return $grid;
 };
 
-# only relevant for raid with its multipl diskX to diskY mappings.
-my $get_selected_hdsize = sub {
-my $hdsize = shift;
-return $hdsize if defined($hdsize);
-
-# compute the smallest disk size of the actually selected disks
+# only returns a value when using raid, undef otherwise
+my $get_max_hdsize = sub {
 my $cached_disks = get_cached_disks();
 my $disk_count = scalar(@$cached_disks);
+my $hdsize;
 for (my $i = 0; $i < $disk_count; $i++) {
my $cur_hd = $gtk_state->{disk_selection}->{$i} // next;
my $disksize = int(@$cur_hd[2] / (2 * 1024 * 1024.0)); # size in GB
@@ -1000,6 +997,16 @@ my $get_selected_hdsize = sub {
$hdsize = $disksize if $disksize < $hdsize;
 }
 
+return $hdsize;
+};
+
+# only relevant for raid with its multipl diskX to diskY mappings.
+my $get_selected_hdsize = sub {
+my $hdsize = shift;
+return $hdsize if defined($hdsize);
+
+$hdsize = $get_max_hdsize->();
+
 if (my $cfg_hdsize = Proxmox::Install::Config::get_hdsize()) {
# had the dialog open previously and set an even lower size than the 
disk selection allows
$hdsize = $cfg_hdsize if $cfg_hdsize < $hdsize;
@@ -1011,17 +1018,19 @@ my sub update_hdsize_adjustment {
 my ($adjustment, $hdsize) = @_;
 
 $hdsize = $get_selected_hdsize->($hdsize);
+my $max_hdsize = $get_max_hdsize->() // $hdsize;
 # expect that lower = 0 and step increments = 1 still are valid
-$adjustment->set_upper($hdsize + 1);
+$adjustment->set_upper($max_hdsize + 1);
 $adjustment->set_value($hdsize);
 }
 
 my sub create_hdsize_adjustment {
 my ($hdsize) = @_;
 $hdsize = $get_selected_hdsize->($hdsize);
+my $max_hdsize = $get_max_hdsize->() // $hdsize;
 my $cfg_hdsize = Proxmox::Install::Config::get_hdsize();
 # params are: initial value, lower, upper, step increment, page increment, 
page size
-return Gtk3::Adjustment->new($cfg_hdsize || $hdsize, 0, $hdsize+1, 1, 1, 
1);
+return Gtk3::Adjustment->new($cfg_hdsize || $hdsize, 0, $max_hdsize+1, 1, 
1, 1);
 }
 
 my sub get_hdsize_spin_button {
-- 
2.39.2



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



[pve-devel] [PATCH installer] ZFS: detect and handle secure boot

2023-11-21 Thread Fabian Grünbichler
and switch the ESP to grub if it is enabled.

Signed-off-by: Fabian Grünbichler 
---
 Proxmox/Install.pm | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 1a4ee93..a2f35ae 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -15,7 +15,7 @@ use Proxmox::Install::StorageConfig;
 
 use Proxmox::Sys::Block qw(get_cached_disks wipe_disk partition_bootable_disk);
 use Proxmox::Sys::Command qw(run_command syscmd);
-use Proxmox::Sys::File qw(file_read_firstline file_write_all);
+use Proxmox::Sys::File qw(file_read_all file_read_firstline file_write_all);
 use Proxmox::UI;
 
 # TODO: move somewhere better?
@@ -570,7 +570,20 @@ my sub chroot_chmod {
 sub prepare_proxmox_boot_esp {
 my ($espdev, $targetdir) = @_;
 
-syscmd("chroot $targetdir proxmox-boot-tool init $espdev") == 0 ||
+my $mode = '';
+
+# detect secure boot being enabled and switch to grub-on-ESP if it is
+if (-d "/sys/firmware/efi") {
+   my $content = eval { 
file_read_all("/sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c")
 };
+   if ($@) {
+   warn "Failed to read secure boot state: $@\n";
+   } else {
+   my @secureboot = unpack("C", $content);
+   $mode = 'grub' if $secureboot[4] == 1;
+   }
+}
+
+syscmd("chroot $targetdir proxmox-boot-tool init $espdev $mode") == 0 ||
die "unable to init ESP and install proxmox-boot loader on '$espdev'\n";
 }
 
-- 
2.39.2



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


Re: [pve-devel] [PATCH storage v3 0/4] pbs: fix #5008: Prevent adding pbs storage with invalid namespace

2023-11-21 Thread Philipp Hufnagl



On 11/21/23 13:16, Christian Ebner wrote:
>> On 16.11.2023 11:35 CET Philipp Hufnagl  wrote:
>>
>>  
>> Currently, when adding a PBS storage with a namespace that does not
>> exist, the storage gets added normally, but browsing/using it only
>> returns a cryptic error message.
>>
>> This change checks if the namespace entered when adding is valid and
>> prompts an error if it is not. If no namespace is provided, the storage
>> will be added without error.
>>
>> This is done by adding code to check if the namespace exists and call it
>> as well as existing code to check if a datastore exists on the add and
>> update hooks of the PBS datastore.
>>
>> Signed-off-by: Philipp Hufnagl 
>> ---
>>
>> Changes since v2:
>>  * Typos
>>  * reuse connecton on one more place previously fortotten
>>  * simplify syntax
>>
>> Changes since v1:
>>  * do not add any overhead to activate_storage calls
>>  * splits code from activate_storage so parts of it can be reused
>>  * adds new methods to check namespaces
>>  * calls checks on add/update hooks
>>
>> Philipp Hufnagl (4):
>>   pbs: Move pbs_api_connect earlyer in the code
>>   pbs: Make it possible to reuse PBS connection for datastore API call
>>   pbs: Extraxt check_datastore_exists from activate_storage
>>   pbs: fix #5008: Check if datastore and namespace is valid on add- and
>> update hooks
>>
>>  src/PVE/Storage/PBSPlugin.pm | 122 ---
>>  1 file changed, 84 insertions(+), 38 deletions(-)
>>
>> -- 
>> 2.39.2
> 
> Something is still broken, while testing with your patches applied I am not 
> able to edit an existing PBS storage backend.
> 
> When I try to e.g. disable the storage via the WebUI I get the following 
> error:
> `update storage failed: PBS-local: Cannot find datastore '', check 
> permissions and existence! (500)`
> Without your patches applied everything works as expected again.
> 
> Cheers,
> Chris

Hmmm...  thats very curios. I tried that on my end and it worked fine.

What datastore did you try to delete? Did you have a valid
configuration for it?


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



[pve-devel] [PATCH installer v2] zfs: create dataset var-lib-vz for /var/lib/vz

2023-11-21 Thread Stoiko Ivanov
Creating rpool/var/lib/vz and all intermediate datasets causes a
service-failure of `var.mount` upon shutdown.

creating the dataset for /var/lib/vz directly at the rpool and setting
its mountpoint property seems the most robust way to address this.

The alternative approach of setting `canmount=off` on the `var`
dataset seems a bit dangerous (users setting a zfs property and
suddenly hiding their /var contents).

The only small downside to this approach is that the setting of the
mountpoint happens quite a bit after extracting the data - but this
would probably be better addressed with a refactoring of the
lowlevel-installer code (setting the zfs-pool up under /target and
getting rid of a few special cases)

Fixes: dd19d40ceac179ba18652f1d6c3e4c23f246af00
Suggested-by: Fabian Grünbichler 
Signed-off-by: Stoiko Ivanov 
---
huge Thanks to Fabian - for the feedback and patiently walking me through
the potential pitfalls!

 Proxmox/Install.pm | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Proxmox/Install.pm b/Proxmox/Install.pm
index 811db8c..1ed38c1 100644
--- a/Proxmox/Install.pm
+++ b/Proxmox/Install.pm
@@ -187,8 +187,8 @@ sub zfs_create_rpool {
 
 if ($iso_env->{product} eq 'pve') {
syscmd("zfs create $pool_name/data")  == 0 || die "unable to create zfs 
$pool_name/data volume\n";
-   syscmd("zfs create -p $pool_name/ROOT/$root_volume_name/var/lib/vz")  
== 0 ||
-   die "unable to create zfs 
$pool_name/ROOT/$root_volume_name/var/lib/vz volume\n";
+   syscmd("zfs create -o 
mountpoint=/$pool_name/ROOT/$root_volume_name/var/lib/vz 
$pool_name/var-lib-vz")  == 0 ||
+   die "unable to create zfs $pool_name/var-lib-vz volume\n";
 }
 
 # default to `relatime` on, fast enough for the installer and production
@@ -1335,6 +1335,11 @@ _EOD
syscmd("zfs set mountpoint=/ 
$zfs_pool_name/ROOT/$zfs_root_volume_name") == 0 ||
die "zfs set mountpoint failed\n";
 
+   if ($iso_env->{product} eq 'pve') {
+   syscmd("zfs set mountpoint=/var/lib/vz $zfs_pool_name/var-lib-vz") 
== 0 ||
+   die "zfs set mountpoint for var-lib-vz failed\n";
+   }
+
syscmd("zpool set bootfs=$zfs_pool_name/ROOT/$zfs_root_volume_name 
$zfs_pool_name") == 0 ||
die "zpool set bootfs failed\n";
syscmd("zpool export $zfs_pool_name");
-- 
2.39.2



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


Re: [pve-devel] [PATCH v4 cluster/network/manager/qemu-server/container/docs 00/33] Add support for DHCP servers to SDN

2023-11-21 Thread DERUMIER, Alexandre
>>
>>I tested the DHCPv6 setup now and unfortunately it does not work
>>fully.
>>
>>I have a VNet with both IPv4 and IPv6 subnets.
>>The IPAM part works correctly, registering both IPv4 and IPv6.
>>In the VM I can get an IPv4 from the DHCP but IPv6 does not work.
>>
>>I only get a /128 address but I configured a /64 subnet.

Yes, this is expected with dhcpv6. It's always /128 mask, and all
traffic is forwarded through the local-link if you have a RA.


I have talked about this with other network admin, this is the way
how dhcpv6/RA is implemented.


It can't be use like dhcp4 to send classic routes. (it don't even sent
network mask, on the ip)

The only way is to use static configuration, or hack dhcp protocol,
sending dhcpv6 custom options + a dhclient script on the vm guest side,
parsing theses options and setting config statically.


with slaac, it should always give you a /64 , but this is the same
problem with RA.


RA has been invented for mobile/desktop client, forcing all traffic
through the local-link.
For server, to use true gateway, ipv6 should be set statically.

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



Re: [pve-devel] [PATCH common] fix #5034 ldap attribute regex

2023-11-21 Thread Christoph Heiss


On Wed, Nov 15, 2023 at 02:30:06PM +0100, Thomas Lamprecht wrote:
>
> Am 15/11/2023 um 13:23 schrieb Markus Frank:
> > Change regex from "m/^[a-zA-Z0-9]+$/" to "m/^[a-zA-Z0-9\-]+$/"
> > to allow hyphen in ldap attribute names for pve & pmg.
> > [..]
> > --- a/src/PVE/JSONSchema.pm
> > +++ b/src/PVE/JSONSchema.pm
> > @@ -408,7 +408,7 @@ PVE::JSONSchema::register_format('ldap-simple-attr', 
> > \_ldap_simple_attr);
> >  sub verify_ldap_simple_attr {
> >  my ($attr, $noerr) = @_;
> >
> > -if ($attr =~ m/^[a-zA-Z0-9]+$/) {
> > +if ($attr =~ m/^[a-zA-Z0-9\-]+$/) {
>
> Pre-existing, but shouldn't the regex actually be?
>
> $attr =~ m/^[a-zA-Z][a-zA-Z0-9\-]*$/
>
> I.e., start with a letter and then be any of letter, digit or hyphen (minus).
>
> CCing Christoph, you did a bit more LDAP stuff recently - opinions?

Sorry for the late reply, just saw this now.

I'd definitely agree with Stefan here, that moving away from regex's for
validating LDAP DNs/attributes/etc is the right way, instead of
continuously having to fix them up.
Even if we try to follow the RFCs as closely as possible, that does
unfortunaly still not really guarantee that it is indeed valid and will
be _accepted by the server_.

Just doing a basic sanity check (e.g. not empty, no spaces) and then
querying the actual LDAP server whether that accepts it or not would be
IMHO preferable. Plus, it's less work on our side in the long run.

PBS does it no differently too, so I'd go the same way here too. Being
overly strict does not help anyone, especially with LDAP, which does a
lot of weird things.


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



[pve-devel] [PATCH v4 pve-manager 3/4] ui: backup: add 'notification-mode' param for one-shot backup jobs.

2023-11-21 Thread Lukas Wagner
This selector allows one to selected between the 'old' (send email
directly via sendmail) or the 'new' notification system.

The default is 'auto', which sends and email if one is configured,
and uses the notification system if no email address is set.

Signed-off-by: Lukas Wagner 
---

Notes:
Changes v3 -> v4:
  - Fix eslint warnings

 www/manager6/window/Backup.js | 25 +
 1 file changed, 25 insertions(+)

diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index 8d8c9ff0..4418a9c7 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -36,6 +36,23 @@ Ext.define('PVE.window.Backup', {
emptyText: Proxmox.Utils.noneText,
});
 
+   let notificationModeSelector = Ext.create({
+   xtype: 'proxmoxKVComboBox',
+   comboItems: [
+   ['auto', gettext('Auto')],
+   ['legacy-sendmail', gettext('Email (legacy)')],
+   ['notification-system', gettext('Notification system')],
+   ],
+   fieldLabel: gettext('Notification mode'),
+   name: 'notification-mode',
+   value: 'auto',
+   listeners: {
+   change: function(field, value) {
+   mailtoField.setDisabled(value === 'notification-system');
+   },
+   },
+   });
+
const keepNames = [
['keep-last', gettext('Keep Last')],
['keep-hourly', gettext('Keep Hourly')],
@@ -110,6 +127,9 @@ Ext.define('PVE.window.Backup', {
if (!initialDefaults && data.mailto !== undefined) {
mailtoField.setValue(data.mailto);
}
+   if (!initialDefaults && data['notification-mode'] 
!== undefined) {
+   
notificationModeSelector.setValue(data['notification-mode']);
+   }
if (!initialDefaults && data.mode !== undefined) {
modeSelector.setValue(data.mode);
}
@@ -176,6 +196,7 @@ Ext.define('PVE.window.Backup', {
],
column2: [
compressionSelector,
+   notificationModeSelector,
mailtoField,
removeCheckbox,
],
@@ -256,6 +277,10 @@ Ext.define('PVE.window.Backup', {
params.mailto = values.mailto;
}
 
+   if (values['notification-mode']) {
+   params['notification-mode'] = values['notification-mode'];
+   }
+
if (values.compress) {
params.compress = values.compress;
}
-- 
2.39.2



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



[pve-devel] [PATCH v4 pve-manager 2/4] ui: backup jobs: add 'notification-mode' selector for backup jobs

2023-11-21 Thread Lukas Wagner
This selector allows one to selected between the 'old' (send email
directly via sendmail) or the 'new' notification system.

The default is 'auto', which sends and email if one is configured,
and uses the notification system if no email address is set.

Signed-off-by: Lukas Wagner 
---

Notes:
Changes v3 -> v4:
  - fix eslint warnings

 www/manager6/dc/Backup.js | 32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 9aae4090..1258772b 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -206,12 +206,14 @@ Ext.define('PVE.dc.BackupEdit', {
 viewModel: {
data: {
selMode: 'include',
+   notificationMode: '__default__',
},
 
formulas: {
poolMode: (get) => get('selMode') === 'pool',
disableVMSelection: (get) => get('selMode') !== 'include' && 
get('selMode') !== 'exclude',
-   mailNotificationSelected: (get) => get('notificationMode') === 
'mailto',
+   showMailtoFields: (get) =>
+   ['auto', 'legacy-sendmail', 
'__default__'].includes(get('notificationMode')),
},
 },
 
@@ -301,6 +303,28 @@ Ext.define('PVE.dc.BackupEdit', {
},
],
column2: [
+   {
+   xtype: 'proxmoxKVComboBox',
+   comboItems: [
+   [
+   '__default__',
+   Ext.String.format(
+   gettext('{0} (Auto)'), 
Proxmox.Utils.defaultText,
+   ),
+   ],
+   ['auto', gettext('Auto')],
+   ['legacy-sendmail', gettext('Email 
(legacy)')],
+   ['notification-system', 
gettext('Notification system')],
+   ],
+   fieldLabel: gettext('Notification mode'),
+   name: 'notification-mode',
+   cbind: {
+   deleteEmpty: '{!isCreate}',
+   },
+   bind: {
+   value: '{notificationMode}',
+   },
+   },
{
xtype: 'pveEmailNotificationSelector',
fieldLabel: gettext('Notify'),
@@ -309,11 +333,17 @@ Ext.define('PVE.dc.BackupEdit', {
value: (get) => get('isCreate') ? 
'always' : '',
deleteEmpty: '{!isCreate}',
},
+   bind: {
+   disabled: '{!showMailtoFields}',
+   },
},
{
xtype: 'textfield',
fieldLabel: gettext('Send email to'),
name: 'mailto',
+   bind: {
+   disabled: '{!showMailtoFields}',
+   },
},
{
xtype: 'pveBackupCompressionSelector',
-- 
2.39.2



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



[pve-devel] [PATCH v4 manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Lukas Wagner
This patch series adds the 'notification-mode' setting for backup jobs.
It allows users to choose between the 'old-style' notifications 
(mail to configured address, directly via a call to sendmail) or 
the 'new-style' notification system.

notification-mode has three possible values:
  - legacy-sendmail: Use old system, considering mailto/mailtnotification 
parameters
  - notification-system: Use the new system (always sending a notification, 
irregardless 
of success/failure. The user is supposed to configure filtering/matching in 
notification settings)
  - auto: use old system if mailto is set, or new system if not

This should provide a fix/workaround for the users' reports of
  - double notifications (these happened in case mailto was set to the same 
address
as root@pam)
  - notifications always being sent, even if 'mailnotification' is set to 
failure

Changes v2 -> v3:
  - change field text in the GUI for the 'mailnotification' param
This should highlight that this setting only affects the 'legacy-sendmail' 
notification mails

Changes v3 -> v4:
  - fix eslint warnings (thx @Philipp)
  - drop already applied pve-guest-common patch



pve-manager:

Lukas Wagner (4):
  vzdump: support 'notification-mode' parameter
  ui: backup jobs: add 'notification-mode' selector for backup jobs
  ui: backup: add 'notification-mode' param for one-shot backup jobs.
  ui: backup job: change field text for 'mailnotification' field

 PVE/VZDump.pm | 95 +++
 www/manager6/dc/Backup.js | 34 ++-
 .../form/NotificationPolicySelector.js|  2 +-
 www/manager6/window/Backup.js | 25 +
 4 files changed, 116 insertions(+), 40 deletions(-)


Summary over all repositories:
  4 files changed, 116 insertions(+), 40 deletions(-)

-- 
murpp v0.4.0



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



[pve-devel] [PATCH v4 pve-manager 1/4] vzdump: support 'notification-mode' parameter

2023-11-21 Thread Lukas Wagner
This parameter lets us choose between the 'legacy' notification
system (sendmail to some email addresses) and the 'new' notification
system (pub-sub based system with targets and matchers).
'auto' (default) will use the 'legacy' system if a mail address is
provided and the 'new' system if not.
This is allows users to opt-in/opt-out from the new notification
system, which might be a bit chatty by default.

Signed-off-by: Lukas Wagner 
---
 PVE/VZDump.pm | 95 +++
 1 file changed, 58 insertions(+), 37 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index b0574d41..4185ed62 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -452,12 +452,8 @@ sub send_notification {
 my $opts = $self->{opts};
 my $mailto = $opts->{mailto};
 my $cmdline = $self->{cmdline};
-# Old-style notification policy. This parameter will influce
-# if an ad-hoc notification target/matcher will be created.
-my $policy = $opts->{"notification-policy"} //
-   $opts->{mailnotification} //
-   'always';
-
+my $policy = $opts->{mailnotification} // 'always';
+my $mode = $opts->{"notification-mode"} // 'auto';
 
 sanitize_task_list($tasklist);
 my $error_count = count_failed_tasks($tasklist);
@@ -499,44 +495,69 @@ sub send_notification {
 };
 
 my $fields = {
+   # TODO: There is no straight-forward way yet to get the
+   # backup job id here... (I think pvescheduler would need
+   # to pass that to the vzdump call?)
type => "vzdump",
hostname => $hostname,
 };
 
-my $notification_config = PVE::Notify::read_config();
-
-my $legacy_sendmail = $policy eq "always" || ($policy eq "failure" && 
$failed);
-
-if ($mailto && scalar(@$mailto) && $legacy_sendmail) {
-   # <, >, @ are not allowed in endpoint names, but that is only
-   # verified once the config is serialized. That means that
-   # we can rely on that fact that no other endpoint with this name exists.
-   my $endpoint_name = "";
-   $notification_config->add_sendmail_endpoint(
-   $endpoint_name,
-   $mailto,
-   undef,
-   undef,
-   "vzdump backup tool");
-
-   my $endpoints = [$endpoint_name];
+my $severity = $failed ? "error" : "info";
+my $email_configured = $mailto && scalar(@$mailto);
+
+if (($mode eq 'auto' && $email_configured) || $mode eq 'legacy-sendmail') {
+   if ($email_configured && ($policy eq "always" || ($policy eq "failure" 
&& $failed))) {
+   # Start out with an empty config. Might still contain
+   # built-ins, so we need to disable/remove them.
+   my $notification_config = Proxmox::RS::Notify->parse_config('', '');
+
+   # Remove built-in matchers, since we only want to send an
+   # email to the specified recipients and nobody else.
+   for my $matcher (@{$notification_config->get_matchers()}) {
+   $notification_config->delete_matcher($matcher->{name});
+   }
 
-   $notification_config->add_matcher(
-   "",
-   $endpoints,
+   # <, >, @ are not allowed in endpoint names, but that is only
+   # verified once the config is serialized. That means that
+   # we can rely on that fact that no other endpoint with this name 
exists.
+   my $endpoint_name = "<" . join(",", @$mailto) . ">";
+   $notification_config->add_sendmail_endpoint(
+   $endpoint_name,
+   $mailto,
+   undef,
+   undef,
+   "vzdump backup tool"
+   );
+
+   my $endpoints = [$endpoint_name];
+
+   # Add a matcher that matches all notifications, set our
+   # newly created target as a target.
+   $notification_config->add_matcher(
+   "",
+   $endpoints,
+   );
+
+   PVE::Notify::notify(
+   $severity,
+   $subject_template,
+   $body_template,
+   $notification_props,
+   $fields,
+   $notification_config
+   );
+   }
+} else {
+   # We use the 'new' system, or we are set to 'auto' and
+   # no email addresses were configured.
+   PVE::Notify::notify(
+   $severity,
+   $subject_template,
+   $body_template,
+   $notification_props,
+   $fields,
);
 }
-
-my $severity = $failed ? "error" : "info";
-
-PVE::Notify::notify(
-   $severity,
-   $subject_template,
-   $body_template,
-   $notification_props,
-   $fields,
-   $notification_config
-);
 };
 
 sub new {
-- 
2.39.2



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



[pve-devel] [PATCH v4 pve-manager 4/4] ui: backup job: change field text for 'mailnotification' field

2023-11-21 Thread Lukas Wagner
... to highlight that this setting only affects the 'legacy-sendmail'
mail notifications.

Signed-off-by: Lukas Wagner 
---

Notes:
New in v3.

 www/manager6/dc/Backup.js   | 2 +-
 www/manager6/form/NotificationPolicySelector.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 1258772b..70903bdc 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -327,7 +327,7 @@ Ext.define('PVE.dc.BackupEdit', {
},
{
xtype: 'pveEmailNotificationSelector',
-   fieldLabel: gettext('Notify'),
+   fieldLabel: gettext('Send email'),
name: 'mailnotification',
cbind: {
value: (get) => get('isCreate') ? 
'always' : '',
diff --git a/www/manager6/form/NotificationPolicySelector.js 
b/www/manager6/form/NotificationPolicySelector.js
index f318ea18..d2a51386 100644
--- a/www/manager6/form/NotificationPolicySelector.js
+++ b/www/manager6/form/NotificationPolicySelector.js
@@ -2,7 +2,7 @@ Ext.define('PVE.form.EmailNotificationSelector', {
 extend: 'Proxmox.form.KVComboBox',
 alias: ['widget.pveEmailNotificationSelector'],
 comboItems: [
-   ['always', gettext('Notify always')],
+   ['always', gettext('Always')],
['failure', gettext('On failure only')],
 ],
 });
-- 
2.39.2



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



Re: [pve-devel] [PATCH v3 pve-manager 3/5] ui: backup jobs: add 'notification-mode' selector for backup jobs

2023-11-21 Thread Philipp Hufnagl



On 11/21/23 13:23, Lukas Wagner wrote:
> This selector allows one to selected between the 'old' (send email
> directly via sendmail) or the 'new' notification system.
> 
> The default is 'auto', which sends and email if one is configured,
> and uses the notification system if no email address is set.
> 
> Signed-off-by: Lukas Wagner 
> ---
>  www/manager6/dc/Backup.js | 33 -
>  1 file changed, 32 insertions(+), 1 deletion(-)
> 
> diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
> index 9aae4090..8f7bab5a 100644
> --- a/www/manager6/dc/Backup.js
> +++ b/www/manager6/dc/Backup.js
> @@ -206,12 +206,15 @@ Ext.define('PVE.dc.BackupEdit', {
>  viewModel: {
>   data: {
>   selMode: 'include',
> + notificationMode: '__default__',
>   },
>  
>   formulas: {
>   poolMode: (get) => get('selMode') === 'pool',
>   disableVMSelection: (get) => get('selMode') !== 'include' && 
> get('selMode') !== 'exclude',
> - mailNotificationSelected: (get) => get('notificationMode') === 
> 'mailto',
> + showMailtoFields: (get) => {
> + return ['auto', 'legacy-sendmail', 
> '__default__'].includes(get('notificationMode'));
> + },

WARN: line 215 col 33: arrow-body-style - Unexpected block statement
surrounding arrow body; move the returned value immediately after the
`=>`. (*)

I think it wants you to inline this like

showMailtoFields: (get) => ['auto', 'legacy-sendmail',
'__default__'].includes(get('notificationMode')),



>   },
>  },
>  
> @@ -301,6 +304,28 @@ Ext.define('PVE.dc.BackupEdit', {
>   },
>   ],
>   column2: [
> + {
> + xtype: 'proxmoxKVComboBox',
> + comboItems: [
> + [
> + '__default__',
> + Ext.String.format(
> + gettext('{0} (Auto)'), 
> Proxmox.Utils.defaultText
nit: comma
> + )
nit: comma
> + ],
> + ['auto', gettext('Auto')],
> + ['legacy-sendmail', gettext('Email 
> (legacy)')],
> + ['notification-system', 
> gettext('Notification system')],
> + ],
> + fieldLabel: gettext('Notification mode'),
> + name: 'notification-mode',
> + cbind: {
> + deleteEmpty: '{!isCreate}',
> + },
> + bind: {
> + value: '{notificationMode}',
> + },
> + },
>   {
>   xtype: 'pveEmailNotificationSelector',
>   fieldLabel: gettext('Notify'),
> @@ -309,11 +334,17 @@ Ext.define('PVE.dc.BackupEdit', {
>   value: (get) => get('isCreate') ? 
> 'always' : '',
>   deleteEmpty: '{!isCreate}',
>   },
> + bind: {
> + disabled: '{!showMailtoFields}',
> + }
nit: comma
>   },
>   {
>   xtype: 'textfield',
>   fieldLabel: gettext('Send email to'),
>   name: 'mailto',
> + bind: {
> + disabled: '{!showMailtoFields}',
> + }
nit: comma
>   },
>   {
>   xtype: 'pveBackupCompressionSelector',


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



[pve-devel] [PATCH manager v2 1/1] ui: implement 'Tag View' for the resource tree

2023-11-21 Thread Dominik Csapak
and keep the functionality in ResourceTree as generic as possible.

We achieve this by having an 'itemMap' function that can split one item
from the store into multiple to add to the tree.

for the updates, we have to have an 'idMapFn' (to get the original id
back)

we also have to modify how the move checks work a bit, since we only
want to move the items when the tags changed only in the tagview case

in the ResourceGrid we have to get the id a bit differently since we now
have 'virtual' ids for the entries tag contain the tag (which can't be
found in the resource store)

since we also don't want tooltips for the already expanded tag groups,
we have to add the special condition that the element directly above
the tag should not have the 'full' class (like it is in tag group case)

Signed-off-by: Dominik Csapak 
---
 www/manager6/Makefile |  1 +
 www/manager6/Workspace.js |  3 +-
 www/manager6/form/ViewSelector.js | 32 ++
 www/manager6/grid/ResourceGrid.js |  2 +-
 www/manager6/panel/TagConfig.js   |  8 +
 www/manager6/tree/ResourceTree.js | 54 +++
 6 files changed, 92 insertions(+), 8 deletions(-)
 create mode 100644 www/manager6/panel/TagConfig.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index ee09f0b8..5efd0726 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -105,6 +105,7 @@ JSSRC=  
\
panel/GuestSummary.js   \
panel/TemplateStatusView.js \
panel/MultiDiskEdit.js  \
+   panel/TagConfig.js  \
tree/ResourceTree.js\
tree/SnapshotTree.js\
tree/ResourceMapTree.js \
diff --git a/www/manager6/Workspace.js b/www/manager6/Workspace.js
index 89ca47b7..424023b6 100644
--- a/www/manager6/Workspace.js
+++ b/www/manager6/Workspace.js
@@ -247,6 +247,7 @@ Ext.define('PVE.StdWorkspace', {
storage: 'PVE.storage.Browser',
sdn: 'PVE.sdn.Browser',
pool: 'pvePoolConfig',
+   tag: 'pveTagConfig',
};
PVE.curSelectedNode = treeNode;
me.setContent({
@@ -530,7 +531,7 @@ Ext.define('PVE.StdWorkspace', {
let tagSelectors = [];
['circle', 'dense'].forEach((style) => {
['dark', 'light'].forEach((variant) => {
-   tagSelectors.push(`.proxmox-tags-${style} 
.proxmox-tag-${variant}`);
+   tagSelectors.push(`.proxmox-tags-${style} 
:not(.proxmox-tags-full) > .proxmox-tag-${variant}`);
});
});
 
diff --git a/www/manager6/form/ViewSelector.js 
b/www/manager6/form/ViewSelector.js
index e25547c4..647399ef 100644
--- a/www/manager6/form/ViewSelector.js
+++ b/www/manager6/form/ViewSelector.js
@@ -32,6 +32,38 @@ Ext.define('PVE.form.ViewSelector', {
// Pool View only lists VMs and Containers
filterfn: ({ data }) => data.type === 'qemu' || data.type === 
'lxc' || data.type === 'pool',
},
+   tags: {
+   text: gettext('Tag View'),
+   groups: ['tag'],
+   filterfn: ({ data }) => data.type === 'qemu' || data.type === 
'lxc',
+   groupRenderer: function(info) {
+   let tag = PVE.Utils.renderTags(info.tag, 
PVE.UIOptions.tagOverrides);
+   return `${tag}`;
+   },
+   idMapFn: function(id) {
+   let [realId, _tag] = id.split('-');
+   return realId;
+   },
+   itemMap: function(item) {
+   let tags = (item.data.tags ?? '').split(/[;, ]/);
+   if (tags.length === 1 && tags[0] === '') {
+   return item;
+   }
+   let items = [];
+   for (const tag of tags) {
+   let id = `${item.data.id}-${tag}`;
+   let info = Ext.apply({ leaf: true }, item.data);
+   info.tag = tag;
+   info.realId = info.id;
+   info.id = id;
+   items.push(Ext.create('Ext.data.TreeModel', info));
+   }
+   return items;
+   },
+   attrMoveChecks: {
+   tag: (newitem, olditem) => newitem.data.tags !== 
olditem.data.tags,
+   },
+   },
};
let groupdef = Object.entries(default_views).map(([name, config]) => 
[name, config.text]);
 
diff --git a/www/manager6/grid/ResourceGrid.js 
b/www/manager6/grid/ResourceGrid.js
index 9376bcc2..b212e9e9 100644
--- a/www/manager6/grid/ResourceGrid.js
+++ b/www/manager6/grid/ResourceGrid.js
@@ 

[pve-devel] [PATCH docs/wt/manager v2] implement tagview

2023-11-21 Thread Dominik Csapak
this adds a 'tagview' to the web ui, organizing guests by their tags
(for details see the pve-manager patch)

changes from v1:
* rebase on master
* adapt to recent tooltip changes
* add a comment to TagConfig class to better explain what it does

pve-docs:

Dominik Csapak (1):
  gui: add anchor for tags chapter

 pve-gui.adoc | 1 +
 1 file changed, 1 insertion(+)

proxmox-widget-toolkit:

Dominik Csapak (1):
  css: add some conditions to the tag classes for the tag view

 src/css/ext6-pmx.css | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

pve-manager:

Dominik Csapak (1):
  ui: implement 'Tag View' for the resource tree

 www/manager6/Makefile |  1 +
 www/manager6/Workspace.js |  3 +-
 www/manager6/form/ViewSelector.js | 32 ++
 www/manager6/grid/ResourceGrid.js |  2 +-
 www/manager6/panel/TagConfig.js   |  8 +
 www/manager6/tree/ResourceTree.js | 54 +++
 6 files changed, 92 insertions(+), 8 deletions(-)
 create mode 100644 www/manager6/panel/TagConfig.js

-- 
2.30.2



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



[pve-devel] [PATCH widget-toolkit v2 1/1] css: add some conditions to the tag classes for the tag view

2023-11-21 Thread Dominik Csapak
in the tag view, we have a custom 'full' style in a place where we
can have another tagstyle class above. to compensate for that, we have
to add another condition to those styles, namely that there is not the
'proxmox-tags-full' in between.

Signed-off-by: Dominik Csapak 
---
 src/css/ext6-pmx.css | 22 +++---
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/src/css/ext6-pmx.css b/src/css/ext6-pmx.css
index 2ffd2a8..e088ae1 100644
--- a/src/css/ext6-pmx.css
+++ b/src/css/ext6-pmx.css
@@ -15,7 +15,9 @@
 }
 
 .proxmox-tags-full .x-grid-cell-inner-treecolumn .proxmox-tag-light,
-.proxmox-tags-full .x-grid-cell-inner-treecolumn .proxmox-tag-dark {
+.proxmox-tags-full .x-grid-cell-inner-treecolumn .proxmox-tag-dark,
+.x-grid-cell-inner-treecolumn .proxmox-tags-full .proxmox-tag-light,
+.x-grid-cell-inner-treecolumn .proxmox-tags-full .proxmox-tag-dark {
 display: inherit;
 }
 
@@ -25,8 +27,10 @@
 }
 
 
-.proxmox-tags-circle .proxmox-tag-light,
-.proxmox-tags-circle .proxmox-tag-dark {
+.proxmox-tags-circle :not(span.proxmox-tags-full) > .proxmox-tag-light,
+.proxmox-tags-circle :not(span.proxmox-tags-full) > .proxmox-tag-dark,
+.proxmox-tags-circle > .proxmox-tag-light,
+.proxmox-tags-circle > .proxmox-tag-dark {
 margin: 0px 1px;
 position: relative;
 top: 2px;
@@ -38,13 +42,17 @@
 overflow: hidden;
 }
 
-.proxmox-tags-none .proxmox-tag-light,
-.proxmox-tags-none .proxmox-tag-dark {
+.proxmox-tags-none :not(span.proxmox-tags-full) > .proxmox-tag-light,
+.proxmox-tags-none :not(span.proxmox-tags-full) > .proxmox-tag-dark,
+.proxmox-tags-none > .proxmox-tag-light,
+.proxmox-tags-none > .proxmox-tag-dark {
 display: none;
 }
 
-.proxmox-tags-dense .proxmox-tag-light,
-.proxmox-tags-dense .proxmox-tag-dark {
+.proxmox-tags-dense :not(span.proxmox-tags-full) > .proxmox-tag-light,
+.proxmox-tags-dense :not(span.proxmox-tags-full) > .proxmox-tag-dark,
+.proxmox-tags-dense > .proxmox-tag-light,
+.proxmox-tags-dense > .proxmox-tag-dark {
 width: 6px;
 margin-right: 1px;
 display: inline-block;
-- 
2.30.2



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



[pve-devel] [PATCH docs v2 1/1] gui: add anchor for tags chapter

2023-11-21 Thread Dominik Csapak
Signed-off-by: Dominik Csapak 
---
 pve-gui.adoc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pve-gui.adoc b/pve-gui.adoc
index bda370f..9e4650d 100644
--- a/pve-gui.adoc
+++ b/pve-gui.adoc
@@ -383,6 +383,7 @@ and the corresponding interfaces for each menu item on the 
right.
 * *Permissions:* manage the permissions for the pool.
 
 
+[[gui_tags]]
 Tags
 
 
-- 
2.30.2



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



Re: [pve-devel] [PATCH v3 pve-manager 4/5] ui: backup: add 'notification-mode' param for one-shot backup jobs.

2023-11-21 Thread Lukas Wagner




On 11/21/23 13:38, Philipp Hufnagl wrote:

+   let notificationModeSelector = Ext.create({
+   xtype: 'proxmoxKVComboBox',
+   comboItems: [
+   ['auto', gettext('Auto')],
+   ['legacy-sendmail', gettext('Email (legacy)')],
+   ['notification-system', gettext('Notification system')],
+   ],
+   fieldLabel: gettext('Notification mode'),
+   name: 'notification-mode',
+   value: 'auto',
+   listeners: {
+   change: function(field, value) {
+   mailtoField.setDisabled(value === 'notification-system');
+   }
+   }
+   });
+


nit: you missed the commas on 52 on 53


Argh, thx. Deployed/tested it via `make install` instead via
`make deb`, I think eslint is a bit more linient there.

--
- Lukas


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



[pve-devel] [PATCH manager v15 1/2] add clipboard comboBox to VM Options

2023-11-21 Thread Markus Frank
For SPICE and VNC, a different message is displayed.

Save config in DisplayEdit so that the clipboard setting persist.

Signed-off-by: Markus Frank 
Reviewed-by: Dominik Csapak 
Tested-by: Dominik Csapak 
---
v15:
* changed style of line break in vncHint field

 www/manager6/qemu/DisplayEdit.js |  8 
 www/manager6/qemu/Options.js | 80 
 2 files changed, 88 insertions(+)

diff --git a/www/manager6/qemu/DisplayEdit.js b/www/manager6/qemu/DisplayEdit.js
index 9bb1763e..d7cd51a9 100644
--- a/www/manager6/qemu/DisplayEdit.js
+++ b/www/manager6/qemu/DisplayEdit.js
@@ -4,6 +4,9 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
 onlineHelp: 'qm_display',
 
 onGetValues: function(values) {
+   if (typeof this.originalConfig.clipboard !== 'undefined') {
+   values.clipboard = this.originalConfig.clipboard;
+   }
let ret = PVE.Parser.printPropertyString(values, 'type');
if (ret === '') {
return { 'delete': 'vga' };
@@ -11,6 +14,11 @@ Ext.define('PVE.qemu.DisplayInputPanel', {
return { vga: ret };
 },
 
+onSetValues: function(values) {
+   this.originalConfig = values;
+   return values;
+},
+
 items: [{
name: 'type',
xtype: 'proxmoxKVComboBox',
diff --git a/www/manager6/qemu/Options.js b/www/manager6/qemu/Options.js
index 7b112400..53d0beac 100644
--- a/www/manager6/qemu/Options.js
+++ b/www/manager6/qemu/Options.js
@@ -154,6 +154,86 @@ Ext.define('PVE.qemu.Options', {
},
} : undefined,
},
+   vga: {
+   header: gettext('Clipboard'),
+   defaultValue: false,
+   renderer: function(value) {
+   let vga = PVE.Parser.parsePropertyString(value, 'type');
+   if (vga.clipboard) {
+   return vga.clipboard.toUpperCase();
+   } else {
+   return Proxmox.Utils.defaultText + ' (SPICE)';
+   }
+   },
+   editor: caps.vms['VM.Config.HWType'] ? {
+   xtype: 'proxmoxWindowEdit',
+   subject: gettext('Clipboard'),
+   onlineHelp: 'qm_display',
+   items: {
+   xtype: 'pveDisplayInputPanel',
+   referenceHolder: true,
+   items: [
+   {
+   xtype: 'proxmoxKVComboBox',
+   name: 'clipboard',
+   reference: 'clipboard',
+   itemId: 'clipboardBox',
+   fieldLabel: gettext('Clipboard'),
+   deleteDefaultValue: true,
+   listeners: {
+   change: function(field, value) {
+   let inputpanel = field.up("inputpanel");
+   let isVnc = value === 'vnc';
+   
inputpanel.lookup('vncHint').setVisible(isVnc);
+   
inputpanel.lookup('defaultHint').setVisible(!isVnc);
+   },
+   },
+   value: '__default__',
+   comboItems: [
+   ['__default__', Proxmox.Utils.defaultText + 
' (SPICE)'],
+   ['vnc', 'VNC'],
+   ],
+   },
+   {
+   itemId: 'vncHint',
+   name: 'vncHint',
+   reference: 'vncHint',
+   xtype: 'displayfield',
+   userCls: 'pmx-hint',
+   hidden: true,
+   value: gettext('You cannot use the default 
SPICE clipboard if the VNC Clipboard is selected.') + ' ' +
+   gettext('VNC Clipboard requires spice-tools 
installed in the Guest-VM.'),
+   },
+   {
+   itemId: 'defaultHint',
+   name: 'defaultHint',
+   reference: 'defaultHint',
+   xtype: 'displayfield',
+   userCls: 'pmx-hint',
+   hidden: false,
+   value: gettext('This option depends on your 
display type.') + ' ' +
+   gettext('If the display type uses SPICE you 
are able to use the default SPICE Clipboard.'),
+   },
+   ],
+   onGetValues: function(values) {
+   values = 

[pve-devel] [PATCH pve-network] dhcp: fix allocating IP for every defined dhcp-range

2023-11-21 Thread Stefan Hanreich
Due to the wrong check an IP was allocated for every DHCP range,
instead of only allocating an IP in the first free DHCP range.

Suggested-By: Stefan Lendl 
Signed-off-by: Stefan Hanreich 
---
The fix I talked about off-list was actually unrelated to this. It
prevented allocating IP addresses in multiple IPv4/6 subnets, not
allocating multiple IP addresses for multiple DHCP ranges. So I did
not remove anything in this patch.

 src/PVE/Network/SDN/Subnets.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/Network/SDN/Subnets.pm b/src/PVE/Network/SDN/Subnets.pm
index b05b3d9..8e2a6aa 100644
--- a/src/PVE/Network/SDN/Subnets.pm
+++ b/src/PVE/Network/SDN/Subnets.pm
@@ -238,7 +238,7 @@ sub add_next_free_ip {
 
foreach my $range (@$dhcp_ranges) {
$ip = $plugin->add_range_next_freeip($plugin_config, 
$subnet, $range, $data);
-   next if !$ip;
+   last if $ip;
}
} else {
$ip = $plugin->add_next_freeip($plugin_config, $subnetid, 
$subnet, $hostname, $mac, $vmid);
-- 
2.39.2


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



[pve-devel] [PATCH docs v15 2/2] add VNC clipboard documentation

2023-11-21 Thread Markus Frank
Signed-off-by: Markus Frank 
Reviewed-by: Dominik Csapak 
Tested-by: Dominik Csapak 
---
 qm.adoc | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/qm.adoc b/qm.adoc
index 55a4728..cd0d907 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -817,6 +817,24 @@ Selecting `serialX` as display 'type' disables the VGA 
output, and redirects
 the Web Console to the selected serial port. A configured display 'memory'
 setting will be ignored in that case.
 
+.VNC clipboard
+You can enable the VNC clipboard by setting `clipboard` to `vnc`.
+
+
+# qm set  -vga ,clipboard=vnc
+
+
+In order to use the clipboard feature, you must first install the
+SPICE guest tools. On Debian-based distributions, this can be achieved
+by installing `spice-vdagent`. For other Operating Systems search for it
+in the offical repositories or see: https://www.spice-space.org/download.html
+
+Once you have installed the spice guest tools, you can use the VNC clipboard
+function (e.g. in the noVNC console panel). However, if you're using
+SPICE, virtio or virgl, you'll need to choose which clipboard to use.
+This is because the default *SPICE* clipboard will be replaced by the
+*VNC* clipboard, if `clipboard` is set to `vnc`.
+
 [[qm_usb_passthrough]]
 USB Passthrough
 ~~~
-- 
2.39.2



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



Re: [pve-devel] [PATCH v2 guest-common/manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 13:13 schrieb Lukas Wagner:
> On 11/21/23 11:55, Fiona Ebner wrote:
>> Can't we just treat 'failure' mode as always defaulting to legacy
>> sendmail? And properly deprecate the setting, showing a warning/info
>> that new notification system is not used if set to 'failure' for both
>> CLI and UI. And maybe not even allow setting it for new jobs/manual backups?
> 
> I think an explicit switch here is much more obvious and predictable to 
> the user.
> 
> Personally I think we should wait a bit before deprecating/disallowing 
> 'mailto' for new backup jobs. This gives us time to polish the UX of
> creating matchers etc. without 'forcing' the user into the new system.
> 

I think so too, if it would be a new major release we might be a bit more
aggressive here, but for a point release we definitively should avoid
deprecation warnings, that something for next (or next next) major release,
possibly with an automated migration path for existing users (which would
have been a bit to much work to implement and test sanely in the remaining
time for next release)


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



Re: [pve-devel] [PATCH v2 guest-common/manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Fiona Ebner
Am 21.11.23 um 13:13 schrieb Lukas Wagner:
> On 11/21/23 11:55, Fiona Ebner wrote:
>> Am 21.11.23 um 11:22 schrieb Lukas Wagner:
>>> This should provide a fix/workaround for the users' reports of
>>>    - double notifications (these happened in case mailto was set to
>>> the same address
>>>  as root@pam)
>>
>> Can't we detect and avoid this more easily?
> 
> There would be other ways to solve this, yes. I could also deduplicate
> email-addresses in the backend - which isn't is as trivial as it sounds,
> since the 'legacy' mails are sent via separate, temporary target of
> type 'sendmail' - so essentially I'd need to have 'cross-target' context
> or something alike.
> 

Okay, I hoped you could get the information about whether the 'mailto'
address is already notified via existing targets more easily.

>>
>>>    - notifications always being sent, even if 'mailnotification' is
>>> set to failure
>>
>> Can't we just treat 'failure' mode as always defaulting to legacy
>> sendmail? And properly deprecate the setting, showing a warning/info
>> that new notification system is not used if set to 'failure' for both
>> CLI and UI. And maybe not even allow setting it for new jobs/manual
>> backups?
> 
> I think an explicit switch here is much more obvious and predictable to
> the user.
> 

But also more complexity/mental load for both them and us. And having a
deprecation warning would also be obvious and predictable ;) Sure, we
(most likely) can get rid of the extra switch with PVE 9, was just
hoping for something simpler. But if that's not easily possible, then
let's go with the switch.

> Personally I think we should wait a bit before deprecating/disallowing
> 'mailto' for new backup jobs. This gives us time to polish the UX of
> creating matchers etc. without 'forcing' the user into the new system.
> 

I didn't mean deprecating 'mailto' like that, just 'mailnotification'
(being set to 'failure').


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


Re: [pve-devel] [PATCH v2 guest-common/manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 13:29 schrieb Philipp Hufnagl:
> The build in mail-to-root target can be disabled but not be deleted.
> Is this on purpose?
> 

it's built-in after all (hardcoded in the code), so yes.



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



[pve-devel] applied: [PATCH v2 pve-guest-common 1/4] vzdump: config: add 'notification-mode' param for backup jobs

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 11:22 schrieb Lukas Wagner:
> 'legacy-sendmail': Use mailto/mailnotification parameters and send
> emails directly.
> 'notification-system': Always notify via notification system
> 'auto': Notify via mail if mailto is set, otherwise use notification
> system.
> 
> Signed-off-by: Lukas Wagner 
> ---
>  src/PVE/VZDump/Common.pm | 14 ++
>  1 file changed, 14 insertions(+)
> 
>

applied, thanks!


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



Re: [pve-devel] [PATCH v2 guest-common/manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Philipp Hufnagl
The build in mail-to-root target can be disabled but not be deleted.
Is this on purpose?


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



[pve-devel] [PATCH v3 pve-guest-common 1/5] vzdump: config: add 'notification-mode' param for backup jobs

2023-11-21 Thread Lukas Wagner
'legacy-sendmail': Use mailto/mailnotification parameters and send
emails directly.
'notification-system': Always notify via notification system
'auto': Notify via mail if mailto is set, otherwise use notification
system.

Signed-off-by: Lukas Wagner 
---
 src/PVE/VZDump/Common.pm | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/PVE/VZDump/Common.pm b/src/PVE/VZDump/Common.pm
index b93ad86..6ee8d3c 100644
--- a/src/PVE/VZDump/Common.pm
+++ b/src/PVE/VZDump/Common.pm
@@ -188,6 +188,20 @@ my $confdesc = {
enum => [ 'always', 'failure' ],
default => 'always',
 },
+'notification-mode' => {
+   type => 'string',
+   description => "Determine which notification system to use." .
+   " If set to 'legacy-sendmail', vzdump will consider the" .
+   " mailto/mailnotification parameters and send emails to the" .
+   " specified address(es) via the 'sendmail' command." .
+   " If set to 'notification-system', a notification will be sent via 
PVE's" .
+   " notification system and mailto/mailnotification will be ignored" .
+   " If set to 'auto' (default setting), an email will be sent if " .
+   " mailto is set, and the notification system will be used if not.",
+   optional => 1,
+   enum => [ 'auto', 'legacy-sendmail', 'notification-system'],
+   default => 'auto',
+},
 'notification-policy' => {
type => 'string',
description => "Deprecated: Do not use",
-- 
2.39.2



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



[pve-devel] [PATCH v3 guest-common/manager 0/5] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Lukas Wagner
This patch series adds the 'notification-mode' setting for backup jobs.
It allows users to choose between the 'old-style' notifications 
(mail to configured address, directly via a call to sendmail) or 
the 'new-style' notification system.

notification-mode has three possible values:
  - legacy-sendmail: Use old system, considering mailto/mailtnotification 
parameters
  - notification-system: Use the new system (always sending a notification, 
irregardless 
of success/failure. The user is supposed to configure filtering/matching in 
notification settings)
  - auto: use old system if mailto is set, or new system if not

This should provide a fix/workaround for the users' reports of
  - double notifications (these happened in case mailto was set to the same 
address
as root@pam)
  - notifications always being sent, even if 'mailnotification' is set to 
failure

Changes v2 -> v3:
  - change field text in the GUI for the 'mailnotification' param
This should highlight that this setting only affects the 'legacy-sendmail' 
notification mails



pve-guest-common:

Lukas Wagner (1):
  vzdump: config: add 'notification-mode' param for backup jobs

 src/PVE/VZDump/Common.pm | 14 ++
 1 file changed, 14 insertions(+)


pve-manager:

Lukas Wagner (4):
  vzdump: support 'notification-mode' parameter
  ui: backup jobs: add 'notification-mode' selector for backup jobs
  ui: backup: add 'notification-mode' param for one-shot backup jobs.
  ui: backup job: change field text for 'mailnotification' field

 PVE/VZDump.pm | 95 +++
 www/manager6/dc/Backup.js | 35 ++-
 .../form/NotificationPolicySelector.js|  2 +-
 www/manager6/window/Backup.js | 25 +
 4 files changed, 117 insertions(+), 40 deletions(-)


Summary over all repositories:
  5 files changed, 131 insertions(+), 40 deletions(-)

-- 
murpp v0.4.0



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



[pve-devel] [PATCH v3 pve-manager 2/5] vzdump: support 'notification-mode' parameter

2023-11-21 Thread Lukas Wagner
This parameter lets us choose between the 'legacy' notification
system (sendmail to some email addresses) and the 'new' notification
system (pub-sub based system with targets and matchers).
'auto' (default) will use the 'legacy' system if a mail address is
provided and the 'new' system if not.
This is allows users to opt-in/opt-out from the new notification
system, which might be a bit chatty by default.

Signed-off-by: Lukas Wagner 
---
 PVE/VZDump.pm | 95 +++
 1 file changed, 58 insertions(+), 37 deletions(-)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index b0574d41..4185ed62 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -452,12 +452,8 @@ sub send_notification {
 my $opts = $self->{opts};
 my $mailto = $opts->{mailto};
 my $cmdline = $self->{cmdline};
-# Old-style notification policy. This parameter will influce
-# if an ad-hoc notification target/matcher will be created.
-my $policy = $opts->{"notification-policy"} //
-   $opts->{mailnotification} //
-   'always';
-
+my $policy = $opts->{mailnotification} // 'always';
+my $mode = $opts->{"notification-mode"} // 'auto';
 
 sanitize_task_list($tasklist);
 my $error_count = count_failed_tasks($tasklist);
@@ -499,44 +495,69 @@ sub send_notification {
 };
 
 my $fields = {
+   # TODO: There is no straight-forward way yet to get the
+   # backup job id here... (I think pvescheduler would need
+   # to pass that to the vzdump call?)
type => "vzdump",
hostname => $hostname,
 };
 
-my $notification_config = PVE::Notify::read_config();
-
-my $legacy_sendmail = $policy eq "always" || ($policy eq "failure" && 
$failed);
-
-if ($mailto && scalar(@$mailto) && $legacy_sendmail) {
-   # <, >, @ are not allowed in endpoint names, but that is only
-   # verified once the config is serialized. That means that
-   # we can rely on that fact that no other endpoint with this name exists.
-   my $endpoint_name = "";
-   $notification_config->add_sendmail_endpoint(
-   $endpoint_name,
-   $mailto,
-   undef,
-   undef,
-   "vzdump backup tool");
-
-   my $endpoints = [$endpoint_name];
+my $severity = $failed ? "error" : "info";
+my $email_configured = $mailto && scalar(@$mailto);
+
+if (($mode eq 'auto' && $email_configured) || $mode eq 'legacy-sendmail') {
+   if ($email_configured && ($policy eq "always" || ($policy eq "failure" 
&& $failed))) {
+   # Start out with an empty config. Might still contain
+   # built-ins, so we need to disable/remove them.
+   my $notification_config = Proxmox::RS::Notify->parse_config('', '');
+
+   # Remove built-in matchers, since we only want to send an
+   # email to the specified recipients and nobody else.
+   for my $matcher (@{$notification_config->get_matchers()}) {
+   $notification_config->delete_matcher($matcher->{name});
+   }
 
-   $notification_config->add_matcher(
-   "",
-   $endpoints,
+   # <, >, @ are not allowed in endpoint names, but that is only
+   # verified once the config is serialized. That means that
+   # we can rely on that fact that no other endpoint with this name 
exists.
+   my $endpoint_name = "<" . join(",", @$mailto) . ">";
+   $notification_config->add_sendmail_endpoint(
+   $endpoint_name,
+   $mailto,
+   undef,
+   undef,
+   "vzdump backup tool"
+   );
+
+   my $endpoints = [$endpoint_name];
+
+   # Add a matcher that matches all notifications, set our
+   # newly created target as a target.
+   $notification_config->add_matcher(
+   "",
+   $endpoints,
+   );
+
+   PVE::Notify::notify(
+   $severity,
+   $subject_template,
+   $body_template,
+   $notification_props,
+   $fields,
+   $notification_config
+   );
+   }
+} else {
+   # We use the 'new' system, or we are set to 'auto' and
+   # no email addresses were configured.
+   PVE::Notify::notify(
+   $severity,
+   $subject_template,
+   $body_template,
+   $notification_props,
+   $fields,
);
 }
-
-my $severity = $failed ? "error" : "info";
-
-PVE::Notify::notify(
-   $severity,
-   $subject_template,
-   $body_template,
-   $notification_props,
-   $fields,
-   $notification_config
-);
 };
 
 sub new {
-- 
2.39.2



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



[pve-devel] [PATCH v3 pve-manager 4/5] ui: backup: add 'notification-mode' param for one-shot backup jobs.

2023-11-21 Thread Lukas Wagner
This selector allows one to selected between the 'old' (send email
directly via sendmail) or the 'new' notification system.

The default is 'auto', which sends and email if one is configured,
and uses the notification system if no email address is set.

Signed-off-by: Lukas Wagner 
---
 www/manager6/window/Backup.js | 25 +
 1 file changed, 25 insertions(+)

diff --git a/www/manager6/window/Backup.js b/www/manager6/window/Backup.js
index 8d8c9ff0..1733ae7c 100644
--- a/www/manager6/window/Backup.js
+++ b/www/manager6/window/Backup.js
@@ -36,6 +36,23 @@ Ext.define('PVE.window.Backup', {
emptyText: Proxmox.Utils.noneText,
});
 
+   let notificationModeSelector = Ext.create({
+   xtype: 'proxmoxKVComboBox',
+   comboItems: [
+   ['auto', gettext('Auto')],
+   ['legacy-sendmail', gettext('Email (legacy)')],
+   ['notification-system', gettext('Notification system')],
+   ],
+   fieldLabel: gettext('Notification mode'),
+   name: 'notification-mode',
+   value: 'auto',
+   listeners: {
+   change: function(field, value) {
+   mailtoField.setDisabled(value === 'notification-system');
+   }
+   }
+   });
+
const keepNames = [
['keep-last', gettext('Keep Last')],
['keep-hourly', gettext('Keep Hourly')],
@@ -110,6 +127,9 @@ Ext.define('PVE.window.Backup', {
if (!initialDefaults && data.mailto !== undefined) {
mailtoField.setValue(data.mailto);
}
+   if (!initialDefaults && data['notification-mode'] 
!== undefined) {
+   
notificationModeSelector.setValue(data['notification-mode']);
+   }
if (!initialDefaults && data.mode !== undefined) {
modeSelector.setValue(data.mode);
}
@@ -176,6 +196,7 @@ Ext.define('PVE.window.Backup', {
],
column2: [
compressionSelector,
+   notificationModeSelector,
mailtoField,
removeCheckbox,
],
@@ -256,6 +277,10 @@ Ext.define('PVE.window.Backup', {
params.mailto = values.mailto;
}
 
+   if (values['notification-mode']) {
+   params['notification-mode'] = values['notification-mode'];
+   }
+
if (values.compress) {
params.compress = values.compress;
}
-- 
2.39.2



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



[pve-devel] [PATCH v3 pve-manager 5/5] ui: backup job: change field text for 'mailnotification' field

2023-11-21 Thread Lukas Wagner
... to highlight that this setting only affects the 'legacy-sendmail'
mail notifications.

Signed-off-by: Lukas Wagner 
---

Notes:
New in v3.

 www/manager6/dc/Backup.js   | 2 +-
 www/manager6/form/NotificationPolicySelector.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 8f7bab5a..87cdea35 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -328,7 +328,7 @@ Ext.define('PVE.dc.BackupEdit', {
},
{
xtype: 'pveEmailNotificationSelector',
-   fieldLabel: gettext('Notify'),
+   fieldLabel: gettext('Send email'),
name: 'mailnotification',
cbind: {
value: (get) => get('isCreate') ? 
'always' : '',
diff --git a/www/manager6/form/NotificationPolicySelector.js 
b/www/manager6/form/NotificationPolicySelector.js
index f318ea18..d2a51386 100644
--- a/www/manager6/form/NotificationPolicySelector.js
+++ b/www/manager6/form/NotificationPolicySelector.js
@@ -2,7 +2,7 @@ Ext.define('PVE.form.EmailNotificationSelector', {
 extend: 'Proxmox.form.KVComboBox',
 alias: ['widget.pveEmailNotificationSelector'],
 comboItems: [
-   ['always', gettext('Notify always')],
+   ['always', gettext('Always')],
['failure', gettext('On failure only')],
 ],
 });
-- 
2.39.2



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



[pve-devel] [PATCH v3 pve-manager 3/5] ui: backup jobs: add 'notification-mode' selector for backup jobs

2023-11-21 Thread Lukas Wagner
This selector allows one to selected between the 'old' (send email
directly via sendmail) or the 'new' notification system.

The default is 'auto', which sends and email if one is configured,
and uses the notification system if no email address is set.

Signed-off-by: Lukas Wagner 
---
 www/manager6/dc/Backup.js | 33 -
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/www/manager6/dc/Backup.js b/www/manager6/dc/Backup.js
index 9aae4090..8f7bab5a 100644
--- a/www/manager6/dc/Backup.js
+++ b/www/manager6/dc/Backup.js
@@ -206,12 +206,15 @@ Ext.define('PVE.dc.BackupEdit', {
 viewModel: {
data: {
selMode: 'include',
+   notificationMode: '__default__',
},
 
formulas: {
poolMode: (get) => get('selMode') === 'pool',
disableVMSelection: (get) => get('selMode') !== 'include' && 
get('selMode') !== 'exclude',
-   mailNotificationSelected: (get) => get('notificationMode') === 
'mailto',
+   showMailtoFields: (get) => {
+   return ['auto', 'legacy-sendmail', 
'__default__'].includes(get('notificationMode'));
+   },
},
 },
 
@@ -301,6 +304,28 @@ Ext.define('PVE.dc.BackupEdit', {
},
],
column2: [
+   {
+   xtype: 'proxmoxKVComboBox',
+   comboItems: [
+   [
+   '__default__',
+   Ext.String.format(
+   gettext('{0} (Auto)'), 
Proxmox.Utils.defaultText
+   )
+   ],
+   ['auto', gettext('Auto')],
+   ['legacy-sendmail', gettext('Email 
(legacy)')],
+   ['notification-system', 
gettext('Notification system')],
+   ],
+   fieldLabel: gettext('Notification mode'),
+   name: 'notification-mode',
+   cbind: {
+   deleteEmpty: '{!isCreate}',
+   },
+   bind: {
+   value: '{notificationMode}',
+   },
+   },
{
xtype: 'pveEmailNotificationSelector',
fieldLabel: gettext('Notify'),
@@ -309,11 +334,17 @@ Ext.define('PVE.dc.BackupEdit', {
value: (get) => get('isCreate') ? 
'always' : '',
deleteEmpty: '{!isCreate}',
},
+   bind: {
+   disabled: '{!showMailtoFields}',
+   }
},
{
xtype: 'textfield',
fieldLabel: gettext('Send email to'),
name: 'mailto',
+   bind: {
+   disabled: '{!showMailtoFields}',
+   }
},
{
xtype: 'pveBackupCompressionSelector',
-- 
2.39.2



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



[pve-devel] applied: [PATCH installer 0/4] tui: small fixup round

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 11:45 schrieb Christoph Heiss:
> Christoph Heiss (4):
>   tui: do not center EULA text
>   tui: preserve autoreboot checkbox state when switching views
>   tui: add missing argument for low-level installer test-session
>   common: enforce even number of disks for ZFS RAID-10
> 
>  proxmox-installer-common/src/disk_checks.rs |  8 ++
>  proxmox-installer-common/src/setup.rs   |  2 +-
>  proxmox-tui-installer/src/main.rs   | 31 +++--
>  3 files changed, 25 insertions(+), 16 deletions(-)
> 
> --
> 2.42.0

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 installer 2/2] serial installer: add serial config for grub to target system

2023-11-21 Thread Thomas Lamprecht
Am 21/11/2023 um 12:09 schrieb Stoiko Ivanov:
> Matching if a serial will be needed for grub is based on the target
> commandline - the speed is also read from there. The unit is based
> on the ttyS device - although I'd assume that this might not always
> match up.
> 
> Signed-off-by: Stoiko Ivanov 
> ---
>  Proxmox/Install.pm | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
>

applied this one fore now, thanks!


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



Re: [pve-devel] [PATCH storage v3 0/4] pbs: fix #5008: Prevent adding pbs storage with invalid namespace

2023-11-21 Thread Christian Ebner
> On 16.11.2023 11:35 CET Philipp Hufnagl  wrote:
> 
>  
> Currently, when adding a PBS storage with a namespace that does not
> exist, the storage gets added normally, but browsing/using it only
> returns a cryptic error message.
> 
> This change checks if the namespace entered when adding is valid and
> prompts an error if it is not. If no namespace is provided, the storage
> will be added without error.
> 
> This is done by adding code to check if the namespace exists and call it
> as well as existing code to check if a datastore exists on the add and
> update hooks of the PBS datastore.
> 
> Signed-off-by: Philipp Hufnagl 
> ---
> 
> Changes since v2:
>  * Typos
>  * reuse connecton on one more place previously fortotten
>  * simplify syntax
> 
> Changes since v1:
>  * do not add any overhead to activate_storage calls
>  * splits code from activate_storage so parts of it can be reused
>  * adds new methods to check namespaces
>  * calls checks on add/update hooks
> 
> Philipp Hufnagl (4):
>   pbs: Move pbs_api_connect earlyer in the code
>   pbs: Make it possible to reuse PBS connection for datastore API call
>   pbs: Extraxt check_datastore_exists from activate_storage
>   pbs: fix #5008: Check if datastore and namespace is valid on add- and
> update hooks
> 
>  src/PVE/Storage/PBSPlugin.pm | 122 ---
>  1 file changed, 84 insertions(+), 38 deletions(-)
> 
> -- 
> 2.39.2

Something is still broken, while testing with your patches applied I am not 
able to edit an existing PBS storage backend.

When I try to e.g. disable the storage via the WebUI I get the following error:
`update storage failed: PBS-local: Cannot find datastore '', check permissions 
and existence! (500)`
Without your patches applied everything works as expected again.

Cheers,
Chris


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



Re: [pve-devel] [PATCH v2 guest-common/manager 0/4] vzdump: add 'notification-mode' parameter

2023-11-21 Thread Lukas Wagner

On 11/21/23 11:55, Fiona Ebner wrote:

Am 21.11.23 um 11:22 schrieb Lukas Wagner:

This patch series adds the 'notification-mode' setting for backup jobs.
It allows users to choose between the 'old-style' notifications
(mail to configured address, directly via a call to sendmail) or
the 'new-style' notification system.

notification-mode has three possible values:
   - legacy-sendmail: Use old system, considering mailto/mailtnotification 
parameters
   - notification-system: Use the new system (always sending a notification, 
irregardless
 of success/failure. The user is supposed to configure filtering/matching in
 notification settings)
   - auto: use old system if mailto is set, or new system if not

This should provide a fix/workaround for the users' reports of
   - double notifications (these happened in case mailto was set to the same 
address
 as root@pam)


Can't we detect and avoid this more easily?


There would be other ways to solve this, yes. I could also deduplicate
email-addresses in the backend - which isn't is as trivial as it sounds, 
since the 'legacy' mails are sent via separate, temporary target of

type 'sendmail' - so essentially I'd need to have 'cross-target' context
or something alike.




   - notifications always being sent, even if 'mailnotification' is set to 
failure


Can't we just treat 'failure' mode as always defaulting to legacy
sendmail? And properly deprecate the setting, showing a warning/info
that new notification system is not used if set to 'failure' for both
CLI and UI. And maybe not even allow setting it for new jobs/manual backups?


I think an explicit switch here is much more obvious and predictable to 
the user.


Personally I think we should wait a bit before deprecating/disallowing 
'mailto' for new backup jobs. This gives us time to polish the UX of

creating matchers etc. without 'forcing' the user into the new system.

--
- Lukas


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



  1   2   >