[pve-devel] [PATCH widget-toolkit] dark-mode: set intentionally black icons to `$icon-color`

2023-10-16 Thread Stefan Sterz
some icons intentionally use black as their color in the light theme.
this includes the little pencil and check mark icon in the acme
overview. change their color to the regular dark-mode icon-color. for
this to work the filter inversion needed for some other icons needs to
be remove too.

Signed-off-by: Stefan Sterz 
---
 src/proxmox-dark/scss/other/_icons.scss | 9 +
 1 file changed, 9 insertions(+)

diff --git a/src/proxmox-dark/scss/other/_icons.scss 
b/src/proxmox-dark/scss/other/_icons.scss
index d4dc316..c045cf4 100644
--- a/src/proxmox-dark/scss/other/_icons.scss
+++ b/src/proxmox-dark/scss/other/_icons.scss
@@ -104,6 +104,9 @@
 }

 // pbs show task log in longest task list column
+.fa.black,
+.fa.black::after,
+.fa.black::before,
 .x-action-col-icon.fa-chevron-right::before {
   filter: none;
 }
@@ -222,6 +225,12 @@
   }
 }

+// set icon color of intentional black icons (e.g.: pencil icon for
+// quickly changing the ACME account)
+.fa.black {
+  color: $icon-color;
+}
+
 // The usage icons dynamically displaying how full a storage is
 .usage-wrapper {
   border: 1px solid $icon-color;
--
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-kernel] backport exposing FLUSHBYASID when running nested VMs on AMD CPUs

2023-10-19 Thread Stefan Sterz
this exposes the FLUSHBYASID CPU flag to nested VMs when running on an
AMD CPU. also reverts a made up check that would advertise
FLUSHBYASID as not supported. this enable certain modern hypervisors
such as VMWare ESXi 7 and Workstation 17 to run nested VMs properly
again.

Signed-off-by: Stefan Sterz 
---
 ...k-for-reserved-encodings-of-TLB_CONT.patch | 49 +++
 ...-Advertise-support-for-flush-by-ASID.patch | 39 +++
 2 files changed, 88 insertions(+)
 create mode 100644 
patches/kernel/0014-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
 create mode 100644 
patches/kernel/0015-KVM-nSVM-Advertise-support-for-flush-by-ASID.patch

diff --git 
a/patches/kernel/0014-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
 
b/patches/kernel/0014-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
new file mode 100644
index 000..2c77272
--- /dev/null
+++ 
b/patches/kernel/0014-Revert-nSVM-Check-for-reserved-encodings-of-TLB_CONT.patch
@@ -0,0 +1,49 @@
+From 379ad2e0326c55682d0bb9391f16f1072fe400d2 Mon Sep 17 00:00:00 2001
+From: Stefan Sterz 
+Date: Wed, 18 Oct 2023 10:45:45 +0200
+Subject: [PATCH 1/2] Revert "nSVM: Check for reserved encodings of TLB_CONTROL
+ in nested VMCB"
+
+This reverts commit 174a921b6975ef959dd82ee9e8844067a62e3ec1.
+
+Signed-off-by: Stefan Sterz 
+---
+ arch/x86/kvm/svm/nested.c | 15 ---
+ 1 file changed, 15 deletions(-)
+
+diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
+index add65dd59756..61a6c0235519 100644
+--- a/arch/x86/kvm/svm/nested.c
 b/arch/x86/kvm/svm/nested.c
+@@ -242,18 +242,6 @@ static bool nested_svm_check_bitmap_pa(struct kvm_vcpu 
*vcpu, u64 pa, u32 size)
+   kvm_vcpu_is_legal_gpa(vcpu, addr + size - 1);
+ }
+
+-static bool nested_svm_check_tlb_ctl(struct kvm_vcpu *vcpu, u8 tlb_ctl)
+-{
+-  /* Nested FLUSHBYASID is not supported yet.  */
+-  switch(tlb_ctl) {
+-  case TLB_CONTROL_DO_NOTHING:
+-  case TLB_CONTROL_FLUSH_ALL_ASID:
+-  return true;
+-  default:
+-  return false;
+-  }
+-}
+-
+ static bool __nested_vmcb_check_controls(struct kvm_vcpu *vcpu,
+struct vmcb_ctrl_area_cached *control)
+ {
+@@ -273,9 +261,6 @@ static bool __nested_vmcb_check_controls(struct kvm_vcpu 
*vcpu,
+  IOPM_SIZE)))
+   return false;
+
+-  if (CC(!nested_svm_check_tlb_ctl(vcpu, control->tlb_ctl)))
+-  return false;
+-
+   return true;
+ }
+
+--
+2.39.2
+
diff --git 
a/patches/kernel/0015-KVM-nSVM-Advertise-support-for-flush-by-ASID.patch 
b/patches/kernel/0015-KVM-nSVM-Advertise-support-for-flush-by-ASID.patch
new file mode 100644
index 000..611a90c
--- /dev/null
+++ b/patches/kernel/0015-KVM-nSVM-Advertise-support-for-flush-by-ASID.patch
@@ -0,0 +1,39 @@
+From 42af81abf0b96ab661591d024aed55c05dd85b91 Mon Sep 17 00:00:00 2001
+From: Sean Christopherson 
+Date: Wed, 18 Oct 2023 12:41:04 -0700
+Subject: [PATCH 2/2] KVM: nSVM: Advertise support for flush-by-ASID
+
+Advertise support for FLUSHBYASID when nested SVM is enabled, as KVM can
+always emulate flushing TLB entries for a vmcb12 ASID, e.g. by running L2
+with a new, fresh ASID in vmcb02.  Some modern hypervisors, e.g. VMWare
+Workstation 17, require FLUSHBYASID support and will refuse to run if it's
+not present.
+
+Punt on proper support, as "Honor L1's request to flush an ASID on nested
+VMRUN" is one of the TODO items in the (incomplete) list of issues that
+need to be addressed in order for KVM to NOT do a full TLB flush on every
+nested SVM transition (see nested_svm_transition_tlb_flush()).
+
+Reported-by: Stefan Sterz 
+Closes: 
https://lkml.kernel.org/r/b9915c9c-4cf6-051a-2d91-44cc6380f455%40proxmox.com
+Signed-off-by: Sean Christopherson 
+Signed-off-by: Stefan Sterz 
+---
+ arch/x86/kvm/svm/svm.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
+index 9a194aa1a75a..0fde9b0c464b 100644
+--- a/arch/x86/kvm/svm/svm.c
 b/arch/x86/kvm/svm/svm.c
+@@ -4880,6 +4880,7 @@ static __init void svm_set_cpu_caps(void)
+   if (nested) {
+   kvm_cpu_cap_set(X86_FEATURE_SVM);
+   kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
++  kvm_cpu_cap_set(X86_FEATURE_FLUSHBYASID);
+
+   if (nrips)
+   kvm_cpu_cap_set(X86_FEATURE_NRIPS);
+--
+2.39.2
+
--
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 common] fix #5034 ldap attribute regex

2023-11-15 Thread Stefan Sterz
On 15.11.23 13:23, Markus Frank wrote:
> Change regex from "m/^[a-zA-Z0-9]+$/" to "m/^[a-zA-Z0-9\-]+$/"
> to allow hyphen in ldap attribute names for pve & pmg.
> 
> Signed-off-by: Markus Frank 
> ---
> There does not seem to be a regex for LDAP attributes in pbs.
> Should a regex be added for this?
> 

we recently moved away from using regex for validating a LDAP
configuration, for two reasons:

1. turns out finding a regex that validates all possible valid LDAP DNs
   is pretty hard and fixing this often comes along with breaking older
   setups
2. even a valid *looking* DN may not actual work against a real LDAP
   server.

so instead we now actually try to query an LDAP server with the provided
config and see if that returns anything. thus, users are more likely to
get what they want, and we don't have to validate for every possible case.

i guess there could be an argument why a regex here makes sense.
however, i'd imagine it's a little odd for users that we are stricter
here than we are with DNs.

>  src/PVE/JSONSchema.pm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
> index 49e0d7a..ef58b62 100644
> --- a/src/PVE/JSONSchema.pm
> +++ b/src/PVE/JSONSchema.pm
> @@ -408,7 +408,7 @@ PVE::JSONSchema::register_format('ldap-simple-attr', 
> \&verify_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\-]+$/) {

if i'm not mistaken, this regex should try to filter an `AttributeValue`
[1]. in case we do stick with this regex approach here, you may want to
relax this even further, as per the standard:

>  If that UTF-8-encoded Unicode string does not have any of the
>  following characters that need escaping, then that string can be used
>  as the string representation
>  of the value.
>
>  - a space (' ' U+0020) or number sign ('#' U+0023) occurring at
>the beginning of the string;
>
>  - a space (' ' U+0020) character occurring at the end of the
>string;
>
>  - one of the characters '"', '+', ',', ';', '<', '>',  or '\'
>(U+0022, U+002B, U+002C, U+003B, U+003C, U+003E, or U+005C,
>respectively);
>
>  - the null (U+) character.
>
>   Other characters may be escaped.

>   return $attr;
>  }
>  



___
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-15 Thread Stefan Sterz
On 15.11.23 14:28, Stefan Sterz wrote:
>>  src/PVE/JSONSchema.pm | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
>> index 49e0d7a..ef58b62 100644
>> --- a/src/PVE/JSONSchema.pm
>> +++ b/src/PVE/JSONSchema.pm
>> @@ -408,7 +408,7 @@ PVE::JSONSchema::register_format('ldap-simple-attr', 
>> \&verify_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\-]+$/) {
> 
> if i'm not mistaken, this regex should try to filter an `AttributeValue`
> [1]. in case we do stick with this regex approach here, you may want to
> relax this even further, as per the standard:
> 

sorry just noticed i forgot to add:

[1]: https://datatracker.ietf.org/doc/html/rfc4514#section-2.4



___
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-15 Thread Stefan Sterz
On 15.11.23 15:49, Thomas Lamprecht wrote:
> Am 15/11/2023 um 14:28 schrieb Stefan Sterz:
>> On 15.11.23 13:23, Markus Frank wrote:

-- >8 snip 8< --

>>
>>>  src/PVE/JSONSchema.pm | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/src/PVE/JSONSchema.pm b/src/PVE/JSONSchema.pm
>>> index 49e0d7a..ef58b62 100644
>>> --- a/src/PVE/JSONSchema.pm
>>> +++ b/src/PVE/JSONSchema.pm
>>> @@ -408,7 +408,7 @@ PVE::JSONSchema::register_format('ldap-simple-attr', 
>>> \&verify_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\-]+$/) {
>>
>> if i'm not mistaken, this regex should try to filter an `AttributeValue`
>> [1]. in case we do stick with this regex approach here, you may want to
>> relax this even further, as per the standard:
>>
>>>  If that UTF-8-encoded Unicode string does not have any of the
>>>  following characters that need escaping, then that string can be used
>>>  as the string representation
>>>  of the value.
>>>
>>>  - a space (' ' U+0020) or number sign ('#' U+0023) occurring at
>>>the beginning of the string;
>>>
>>>  - a space (' ' U+0020) character occurring at the end of the
>>>string;
>>>
>>>  - one of the characters '"', '+', ',', ';', '<', '>',  or '\'
>>>(U+0022, U+002B, U+002C, U+003B, U+003C, U+003E, or U+005C,
>>>respectively);
>>>
>>>  - the null (U+) character.
>>>
> 
> Ack, so I was wrong, the format might still make sense albeit checking
> for above cases would then indeed better, something along the lines of:
> 
> if ($attr !~ /(?:^(?:\s|#))|["+,;<>\0\\]|(?:\s$)/) {
> return $attr;
> }
> 
> If we leave that regex out completely we should ensure that we don't get
> any tainting issues.
> 
> The format could move to PVE::Auth::LDAP too, FWIW, but that's a different
> story.

just to through this out there, my last attempt at validating this [1]
looked something like this:

```
my $escaped  = qr!\\(?:[ "#+,;<=>\\]|[0-9a-fA-F]{2})!;
my $start= qr!(?:${escaped}|[^"+,;<>\\\0 #])!;
my $middle   = qr!(?:${escaped}|[^"+,;<>\\\0])!;
my $end  = qr!(?:${escaped}|[^"+,;<>\\\0 ])!;
my $attr_val = qr!("[^"]+"|${start}(?:${middle}*${end})?)!;
```

since things can also be escaped or in quotes, which makes them valid
again. could probably be improved here, though.

[1]: https://lists.proxmox.com/pipermail/pve-devel/2023-May/056840.html


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



[pve-devel] [PATCH installer] tui: bootdisk zfs config: add a maximum value to the `copies` option

2023-11-17 Thread Stefan Sterz
according to `man zfsprops` the copies option can only be 1, 2, or 3.
limit the field to 3, as setting higher options can't work anyway.

Signed-off-by: Stefan Sterz 
---
i would have added a `min_value` of 1 too, but `IntegerEditView` is
based on `NumericEditView` and that doesn't offer a minimal value.

 proxmox-tui-installer/src/views/bootdisk.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/proxmox-tui-installer/src/views/bootdisk.rs 
b/proxmox-tui-installer/src/views/bootdisk.rs
index 00e6ade..7e13e91 100644
--- a/proxmox-tui-installer/src/views/bootdisk.rs
+++ b/proxmox-tui-installer/src/views/bootdisk.rs
@@ -592,7 +592,7 @@ impl ZfsBootdiskOptionsView {
 .unwrap_or_default(),
 ),
 )
-.child("copies", IntegerEditView::new().content(options.copies))
+.child("copies", 
IntegerEditView::new().content(options.copies).max_value(3))
 .child_conditional(
 is_pve,
 "ARC max size",
--
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 manager] sdn: add model based validation to dhcp ranges

2023-11-23 Thread Stefan Sterz
this patch re-works the validation the in the subnit edit panel to
also validate whether the ip address version in a range match each
other.

Signed-off-by: Stefan Sterz 
---
not super proud of this, but couldn't really find another way to
properly validate accross two columns and also have the panel still work
as intended.

 www/manager6/sdn/SubnetEdit.js | 85 ++
 1 file changed, 76 insertions(+), 9 deletions(-)

diff --git a/www/manager6/sdn/SubnetEdit.js b/www/manager6/sdn/SubnetEdit.js
index 8fc3f52b..cba80d8f 100644
--- a/www/manager6/sdn/SubnetEdit.js
+++ b/www/manager6/sdn/SubnetEdit.js
@@ -59,6 +59,49 @@ Ext.define('PVE.sdn.SubnetInputPanel', {
 ],
 });

+Ext.define('PVE.sdn.model.DhcpRange', {
+extend: 'Ext.data.Model',
+fields: [
+{ name: 'startAddress' },
+{ name: 'endAddress' },
+   {
+   name: 'rangeErrors',
+   depends: ['startAddress', 'endAddress'],
+   calculate: (data) => {
+   let errors = [];
+   let sV4 = Proxmox.Utils.IP4_match.test(data.startAddress);
+   let sV6 = Proxmox.Utils.IP6_match.test(data.startAddress);
+   let eV4 = Proxmox.Utils.IP4_match.test(data.endAddress);
+   let eV6 = Proxmox.Utils.IP6_match.test(data.endAddress);
+
+   if (!((sV4 && eV4) || (sV6 && eV6))) {
+   errors.push("IP address versions do not match.");
+   }
+
+   return errors;
+   },
+   },
+   {
+   name: 'rangeErrorsClass',
+   depends: ['rangeErrors'],
+   calculate: (data) => {
+   if (data.rangeErrors.length !== 0) {
+   return ['x-form-trigger-wrap-default', 
'x-form-trigger-wrap-invalid'];
+   }
+
+   return [];
+   }
+   }
+],
+
+validators: {
+startAddress: (value, record) =>
+   Ext.form.VTypes.IP64Address(value) || gettext("Not a valid IP 
address."),
+   endAddress: (value, record) =>
+   Ext.form.VTypes.IP64Address(value) || gettext("Not a valid IP 
address."),
+},
+});
+
 Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
 extend: 'Ext.form.FieldContainer',
 mixins: ['Ext.form.field.Field'],
@@ -86,8 +129,8 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
// 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'],
+   'start-address': item.data.startAddress,
+   'end-address': item.data.endAddress,
});
});

@@ -121,8 +164,10 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
// needs a deep copy otherwise we run in to ExtJS reference
// shenaningans
data.push({
-   'start-address': item['start-address'],
-   'end-address': item['end-address'],
+   startAddress: item['start-address'],
+   endAddress: item['end-address'],
+   rangeErrors: [],
+   rangeErrorsClass: [],
});
});

@@ -133,6 +178,18 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
let me = this;
 let errors = [];

+   let grid = me.lookup('grid');
+
+   grid.getStore().data.each((row, index) => {
+   if (!row.isValid()) {
+   errors.push(gettext("An entry in the DHCP Range is not a valid 
IP address!"));
+   }
+
+   if (row.data.rangeErrors.length !== 0) {
+   row.data.rangeErrors.forEach((error) => errors.push(error));
+   }
+   });
+
return errors;
 },

@@ -182,27 +239,37 @@ Ext.define('PVE.sdn.SubnetDhcpRangePanel', {
reference: 'grid',
scrollable: true,
store: {
-   fields: ['start-address', 'end-address'],
+   model: 'PVE.sdn.model.DhcpRange',
+   },
+   itemConfig: {
+   viewModel: true,
},
+   modelValidation: true,
columns: [
{
text: gettext('Start Address'),
xtype: 'widgetcolumn',
-   dataIndex: 'start-address',
flex: 1,
widget: {
xtype: 'textfield',
-   vtype: '

Re: [pve-devel] [PATCH docs] installation: reword `nomodeset` section a bit, add link to it

2024-02-26 Thread Stefan Sterz
On Mon Feb 26, 2024 at 12:20 PM CET, Christoph Heiss wrote:
> The `nomodeset` section needs some massaging due to the text flow being
> broken a bit. While at it, link to it above at the 'Terminal UI'
> bootloader tip such that readers can find it more easily.
>
> Suggested-by: Alexander Zeidler 
> Signed-off-by: Christoph Heiss 
> ---
>  pve-installation.adoc | 11 ++-
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/pve-installation.adoc b/pve-installation.adoc
> index 6b44fc0..c799570 100644
> --- a/pve-installation.adoc
> +++ b/pve-installation.adoc
> @@ -88,7 +88,8 @@ Both modes use the same code base for the actual 
> installation process to
>  benefit from more than a decade of bug fixes and ensure feature parity.
>
>  TIP: The 'Terminal UI' option can be used in case the graphical installer 
> does
> -not work correctly, due to e.g. driver issues.
> +not work correctly, due to e.g. driver issues. See also
> +<>.
>
>  Advanced Options: Install {pve} (Graphical, Debug Mode)::
>
> @@ -300,14 +301,14 @@ following command:
>  # zpool add  log 
>  
>
> +[[nomodeset_kernel_param]]
>  Adding the `nomodeset` Kernel Parameter
>  ~
>
>  Problems may arise on very old or very new hardware due to graphics drivers. 
> If
> -the installation hangs during the boot. In that case, you can try adding the
> -`nomodeset` parameter. This prevents the Linux kernel from loading any
> -graphics drivers and forces it to continue using the BIOS/UEFI-provided
> -framebuffer.
> +the installation hangs during the boot, you can try adding the `nomodeset`
> +parameter. This prevents the Linux kernel from loading any graphics drivers 
> and
> +forces it to continue using the BIOS/UEFI-provided framebuffer.
>

nit: "the installation hangs during the boot" doesn't require that
"the". imo "If the installation hangs during boot, you can..."

otherwise sounds good to me

>  On the {pve} bootloader menu, navigate to 'Install {pve} (Terminal UI)' and
>  press `e` to edit the entry. Using the arrow keys, navigate to the line 
> starting



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



Re: [pve-devel] [PATCH docs v2 1/5] package-repos: improve wording partly based on pmg-docs

2024-03-11 Thread Stefan Sterz
On Mon Mar 11, 2024 at 1:29 PM CET, Christoph Heiss wrote:
> Some sentences are phrased better and more expansive in pmg-docs, so
> take them from there and adapt them as needed.
>
> Rephrases some redundant parts (e.g. enterprise repo introduction) and
> moves the email/changelog paragraph to the top, since that applies to
> all repos.
>
> Signed-off-by: Christoph Heiss 
> ---
> Changes v1 -> v2:
>   * deduplicate email/changelog paragraph, move to top
>   * deduplicate enterprise repo introduction sentence
>   * very slightly reword some phrases
>
>  pve-package-repos.adoc | 26 ++
>  1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/pve-package-repos.adoc b/pve-package-repos.adoc
> index b0c2a95..4586f70 100644
> --- a/pve-package-repos.adoc
> +++ b/pve-package-repos.adoc
> @@ -8,6 +8,10 @@ endif::wiki[]
>  {pve} uses http://en.wikipedia.org/wiki/Advanced_Packaging_Tool[APT] as its
>  package management tool like any other Debian-based system.
>
> +{pve} automatically checks for package updates on a daily basis. The 
> `root@pam`
> +user is notified via email about available updates. From the GUI, The

"The" at the end of this line should be lower case.

> +'Changelog' button can be used to see more details about the selected update.
> +
>  Repositories in {pve}
>  ~
>
> @@ -57,21 +61,18 @@ deb http://security.debian.org/debian-security 
> bookworm-security main contrib
>  {pve} Enterprise Repository
>  ~~~
>
> -This is the default, stable, and recommended repository, available for all 
> {pve}
> -subscription users. It contains the most stable packages and is suitable for
> -production use. The `pve-enterprise` repository is enabled by default:
> +This is the recommended repository and available for all {pve} subscription
> +users. It contains the most stable packages and is suitable for production 
> use.
> +The `pve-enterprise` repository is enabled by default:
>
>  .File `/etc/apt/sources.list.d/pve-enterprise.list`
>  
>  deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise
>  
>
> -The `root@pam` user is notified via email about available updates. Click the
> -'Changelog' button in the GUI to see more details about the selected update.
> -
> -You need a valid subscription key to access the `pve-enterprise` repository.
> -Different support levels are available. Further details can be found at
> -{pricing-url}.
> +Please note that you need a valid subscription key to access the
> +`pve-enterprise` repository. We offer different support levels, which you can
> +find further details about at {pricing-url}.
>
>  NOTE: You can disable this repository by commenting out the above line using 
> a
>  `#` (at the start of the line). This prevents error messages if your host 
> does
> @@ -82,9 +83,10 @@ repository in that case.
>  {pve} No-Subscription Repository
>  
>
> -This is the recommended repository for testing and non-production use. Its
> -packages are not as heavily tested and validated. You don't need a 
> subscription key
> -to access the `pve-no-subscription` repository.
> +As the name suggests, you do not need a subscription key to access
> +this repository. It can be used for testing and non-production
> +use. It's not recommended to use this on production servers, as these
> +packages are not always as heavily tested and validated.
>
>  We recommend to configure this repository in `/etc/apt/sources.list`.
>
> --
> 2.43.1
>
>
>
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



___
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 1/2] fix #5198: ceph: mon: fix mon existence check in mon removal assertion

2024-03-13 Thread Stefan Sterz
On Wed Mar 13, 2024 at 3:53 PM CET, Max Carrara wrote:
> The Ceph monitor removal assertion contains a condition that checks
> whether the given mon ID actually exists and thus may be removed.
>
> The first part of the condition checks whether the hash returned by
> `get_services_info` [0] contains the key "mon.$monid". However, the
> hash's keys are never prefixed with "mon.", which makes this check
> incorrect.
>
> This is fixed by just using "$monid" directly.
>
> The second part checks whether the mon hashes returned by
> Ceph contain the "name" key before comparing the key with the given
> mon ID. This key existence check is also incorrect; in particular:
>   * If the lookup `$_->{name}` evaluates to e.g. "foo", the check
> passes, because "foo" is truthy. [1]
>   * If the lookup `$_->{name}` evaluates to "0", the check fails,
> because "0" is falsy (due to it being equivalent to the number 0,
> according to Perl [1]).
>
> This is solved by using the inbuilt `exists()` instead of relying on
> Perl's definition of truthiness.
>
> [0]: 
> https://git.proxmox.com/?p=pve-manager.git;a=blob;f=PVE/Ceph/Services.pm;h=e0f31e8eb6bc9b3777b3d0d548497276efaa5c41;hb=HEAD#l112
> [1]: https://perldoc.perl.org/perldata#Scalar-values
>
> Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=5198
> Signed-off-by: Max Carrara 
> ---
>  PVE/API2/Ceph/MON.pm | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/PVE/API2/Ceph/MON.pm b/PVE/API2/Ceph/MON.pm
> index 1e959ef3..1737c294 100644
> --- a/PVE/API2/Ceph/MON.pm
> +++ b/PVE/API2/Ceph/MON.pm
> @@ -147,8 +147,8 @@ my $assert_mon_prerequisites = sub {
>  my $assert_mon_can_remove = sub {
>  my ($monhash, $monlist, $monid, $mondir) = @_;
>
> -if (!(defined($monhash->{"mon.$monid"}) ||
> -   grep { $_->{name} && $_->{name} eq $monid } @$monlist))

not sure if splitting the fix and the code style clean up makes sense
here but otherwise this works as advertised. So:

Tested-by: Stefan Sterz 

> +if (!(defined($monhash->{$monid}) ||
> +   grep { exists($_->{name}) && $_->{name} eq $monid } @$monlist))
>  {
>   die "no such monitor id '$monid'\n"
>  }



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



Re: [pve-devel] [PATCH manager] ui: pool members: avoid setting request parameter for all edit windows

2024-03-14 Thread Stefan Sterz
On Wed Mar 13, 2024 at 9:44 AM CET, Friedrich Weber wrote:
> Currently, after adding a storage to a pool, opening any edit window
> will send a GET request with a superfluous `poolid` parameter and
> cause a parameter verification error in the GUI. This breaks all edit
> windows of the current session. A workaround is to reload the current
> browser session.
>
> This happens because the `PVE.pool.AddStorage` component inadvertently
> adds `poolid` to an `extraRequestParams` object that is shared by all
> instances of `Proxmox.window.Edit`, affecting all edit windows in the
> current session. Fix this by instead creating a new object that is
> local to the component.
>
> Fixes: cd731902b7a724b1ab747276f9c6343734f1d8cb
> Signed-off-by: Friedrich Weber 
> ---
>
> Notes:
> To check if we have this problem at other places, I did a quick search
> for `extraRequestParams` in PVE+PBS: Seems like for all other usages,
> the object is created fresh already.
>
>  www/manager6/grid/PoolMembers.js | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/www/manager6/grid/PoolMembers.js 
> b/www/manager6/grid/PoolMembers.js
> index 75f20cab..61e27dff 100644
> --- a/www/manager6/grid/PoolMembers.js
> +++ b/www/manager6/grid/PoolMembers.js
> @@ -123,7 +123,7 @@ Ext.define('PVE.pool.AddStorage', {
>   me.isAdd = true;
>   me.url = "/pools/";
>   me.method = 'PUT';
> - me.extraRequestParams.poolid = me.pool;
> + me.extraRequestParams = { 'poolid': me.pool };

note that you don't need to quote `poolid` here as it doesn't contain
hyphens as such. quickly grepping over our codebase it seems that not
quoting keys is preferred if it isn't needed

>
>   Ext.apply(me, {
>   subject: gettext('Storage'),



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



Re: [pve-devel] [PATCH docs] pveceph: document cluster shutdown

2024-03-19 Thread Stefan Sterz
On Tue Mar 19, 2024 at 4:00 PM CET, Aaron Lauterer wrote:
> Signed-off-by: Aaron Lauterer 
> ---
>  pveceph.adoc | 50 ++
>  1 file changed, 50 insertions(+)
>
> diff --git a/pveceph.adoc b/pveceph.adoc
> index 089ac80..7b493c5 100644
> --- a/pveceph.adoc
> +++ b/pveceph.adoc
> @@ -1080,6 +1080,56 @@ scrubs footnote:[Ceph scrubbing 
> {cephdocs-url}/rados/configuration/osd-config-re
>  are executed.
>
>
> +[[pveceph_shutdown]]
> +Shutdown {pve} + Ceph HCI cluster
> +~
> +
> +To shut down the whole {pve} + Ceph cluster, first stop all Ceph clients. 
> This
> +will mainly be VMs and containers. If you have additional clients that might
> +access a Ceph FS or an installed RADOS GW, stop these as well.
> +High available guests will switch their state to 'stopped' when powered down

I think this should be "Highly available" or "High availability".

> +via the {pve} tooling.
> +
> +Once all clients, VMs and containers are off or not accessing the Ceph 
> cluster
> +anymore, verify that the Ceph cluster is in a healthy state. Either via the 
> Web UI
> +or the CLI:
> +
> +
> +ceph -s
> +
> +
> +Then enable the following OSD flags in the Ceph -> OSD panel or the CLI:
> +
> +
> +ceph osd set noout
> +ceph osd set norecover
> +ceph osd set norebalance
> +ceph osd set nobackfill
> +ceph osd set nodown
> +ceph osd set pause
> +
> +
> +This will halt all self-healing actions for Ceph and the 'pause' will stop 
> any client IO.
> +
> +Start powering down the nodes one node at a time. Power down nodes with a
> +Monitor (MON) last.

Might benefit from re-phrasing to avoid people only reading this while
already in the middle of shutting down:

Start powering down your nodes without a monitor (MON). After these
nodes are down, also shut down hosts with monitors.

> +
> +When powering on the cluster, start the nodes with Monitors (MONs) first. 
> Once
> +all nodes are up and running, confirm that all Ceph services are up and 
> running
> +before you unset the OSD flags:
> +
> +
> +ceph osd unset noout
> +ceph osd unset norecover
> +ceph osd unset norebalance
> +ceph osd unset nobackfill
> +ceph osd unset nodown
> +ceph osd unset pause
> +
> +
> +You can now start up the guests. High available guests will change their 
> state

see above

> +to 'started' when they power on.
> +
>  Ceph Monitoring and Troubleshooting
>  ---
>



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



Re: [pve-devel] [PATCH docs] system-requirements: mention that SSDs with PLP should be used

2024-03-20 Thread Stefan Sterz
On Wed Mar 20, 2024 at 10:49 AM CET, Aaron Lauterer wrote:
>
>
> On  2024-03-20  10:30, Fiona Ebner wrote:
> > Am 20.03.24 um 09:56 schrieb Aaron Lauterer:
> >> Signed-off-by: Aaron Lauterer 
> >> ---
> >>   pve-system-requirements.adoc | 2 ++
> >>   1 file changed, 2 insertions(+)
> >>
> >> diff --git a/pve-system-requirements.adoc b/pve-system-requirements.adoc
> >> index bc3689d..4db5358 100644
> >> --- a/pve-system-requirements.adoc
> >> +++ b/pve-system-requirements.adoc
> >> @@ -49,6 +49,8 @@ Recommended System Requirements
> >> (BBU) or non-RAID for ZFS and Ceph. Neither ZFS nor Ceph are 
> >> compatible with a
> >> hardware RAID controller.
> >>   ** Shared and distributed storage is possible.
> >> +** SSDs with Power-Loss-Protection (PLP) are recommended for good 
> >> performance.
> >> +  Using consumer SSDs is discouraged.
> >>
> >
> > Having PLP might correlate with having good performance, but it's not
> > the reason for good performance and good performance is not the reason
> > you want PLP. It's just that both things are present in many enterprise
> > SSDs, I'd mention that explicitly to avoid potential confusion.
>
> When it comes to sync writes, it is definitely one reason for the good
> performance ;)
> But yeah, let's think about it, what about the following?:
>
>
> Enterprise grade SSDs are recommended for good performance. Checking for
>   Power-Loss-Protection (PLP) is a good way to avoid consumer grade
> SSDs. The use of consumer grade SSDs is discouraged.
>
>
> Not too happy with that either, but phrasing it correctly and succinct
> is an art in itself.
>

How about:

Enterprise SSDs with good performance are recommended.
Power-Loss-Protection (PLP) support can help identify such disks. Using
consumer SSDs is discouraged

> >
> >>   * Redundant (Multi-)Gbit NICs, with additional NICs depending on the 
> >> preferred
> >> storage technology and cluster setup.
>
>
> ___
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



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



Re: [pve-devel] [PATCH storage] esxi: detect correct os type in 'other' family

2024-03-21 Thread Stefan Sterz
-->8 snip 8<--

> diff --git a/src/PVE/Storage/ESXiPlugin.pm.tdy 
> b/src/PVE/Storage/ESXiPlugin.pm.tdy
> new file mode 100644
> index 000..2a08986
> --- /dev/null
> +++ b/src/PVE/Storage/ESXiPlugin.pm.tdy
> @@ -0,0 +1,1216 @@
> +package PVE::Storage::ESXiPlugin;
> +

talked off list with gabriel already this file was added accidentally.

-->8 snip 8<--


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



[pve-devel] [PATCH docs 1/2] qm: multiqueue specify that it needs to be vCPUs not cores

2024-03-21 Thread Stefan Sterz
total number of cores != vCPUs if there is more than one socket
configured. according to the redhat docs it should be vCPUs not cores:

> Multi-queue virtio-net provides the greatest performance benefit when:
> [..]
> - The number of queues is equal to the number of vCPUs.

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/virtualization_tuning_and_optimization_guide/sect-virtualization_tuning_optimization_guide-networking-techniques#sect-Virtualization_Tuning_Optimization_Guide-Networking-Multi-queue_virtio-net
Signed-off-by: Stefan Sterz 
---
 qm.adoc | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/qm.adoc b/qm.adoc
index 1170dd1..8630419 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -770,14 +770,15 @@ vhost driver. With this option activated, it is possible 
to pass _multiple_
 network queues to the host kernel for each NIC.
 
 
//https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Tuning_and_Optimization_Guide/sect-Virtualization_Tuning_Optimization_Guide-Networking-Techniques.html#sect-Virtualization_Tuning_Optimization_Guide-Networking-Multi-queue_virtio-net
-When using Multiqueue, it is recommended to set it to a value equal
-to the number of Total Cores of your guest. You also need to set in
-the VM the number of multi-purpose channels on each VirtIO NIC with the ethtool
-command:
+When using Multiqueue, it is recommended to set it to a value equal to the
+number of vCPUs of your guest. Remember that the number of vCPUs is the number
+of sockets times the number of cores configured for the VM. You also need to 
set
+the number of multi-purpose channels on each VirtIO NIC in the VM with this
+ethtool command:
 
 `ethtool -L ens1 combined X`
 
-where X is the number of the number of vcpus of the VM.
+where X is the number of the number of vCPUs of the VM.
 
 You should note that setting the Multiqueue parameter to a value greater
 than one will increase the CPU load on the host and guest systems as the
-- 
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 2/2] qm: add documentation on configuring multiqueue for windows guests

2024-03-21 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 qm.adoc | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/qm.adoc b/qm.adoc
index 8630419..711fa3f 100644
--- a/qm.adoc
+++ b/qm.adoc
@@ -780,6 +780,16 @@ ethtool command:
 
 where X is the number of the number of vCPUs of the VM.
 
+To configure a Windows guest for Multiqueue install the
+https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso[
+Redhat VirtIO Ethernet Adapter drivers], then adapt the NIC's configuration as
+follows. Open the device manager, right click the NIC under "Network adapters",
+and select "Properties". Then open the "Advanced" tab and select "Receive Side
+Scaling" from the list on the left. Make sure it is set to "Enabled". Next,
+navigate to "Maximum number of RSS Queues" in the list and set it to the number
+of vCPUs of your VM. Once you verified that the settings are correct, click 
"OK"
+to confirm them.
+
 You should note that setting the Multiqueue parameter to a value greater
 than one will increase the CPU load on the host and guest systems as the
 traffic increases. We recommend to set this option only when the VM has to
-- 
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 qemu-server 3/3] api: include not mapped resources for running vms in migrate preconditions

2024-03-22 Thread Stefan Sterz
On Wed Mar 20, 2024 at 1:51 PM CET, Dominik Csapak wrote:
> so that we can show a proper warning in the migrate dialog and check it
> in the bulk migrate precondition check
>
> the unavailable_storages and allowed_nodes should be the same as before
>
> Signed-off-by: Dominik Csapak 
> ---
> not super happy with this partial approach, we probably should just
> always return the 'allowed_nodes' and 'not_allowed_nodes' and change
> the gui to handle the running vs not running state?
>
>  PVE/API2/Qemu.pm | 27 +++
>  1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 8581a529..b0f155f7 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -4439,7 +4439,7 @@ __PACKAGE__->register_method({
>   not_allowed_nodes => {
>   type => 'object',
>   optional => 1,
> - description => "List not allowed nodes with additional 
> informations, only passed if VM is offline"
> + description => "List not allowed nodes with additional 
> informations",

"information" has no plural, this should just be "additional
information".

>   },
>   local_disks => {
>   type => 'array',
> @@ -4496,25 +4496,28 @@ __PACKAGE__->register_method({
>
>   # if vm is not running, return target nodes where local storage/mapped 
> devices are available
>   # for offline migration
> + my $checked_nodes = {};
> + my $allowed_nodes = [];
>   if (!$res->{running}) {
> - $res->{allowed_nodes} = [];
> - my $checked_nodes = 
> PVE::QemuServer::check_local_storage_availability($vmconf, $storecfg);
> + $checked_nodes = 
> PVE::QemuServer::check_local_storage_availability($vmconf, $storecfg);
>   delete $checked_nodes->{$localnode};
> + }
>
> - foreach my $node (keys %$checked_nodes) {
> - my $missing_mappings = $missing_mappings_by_node->{$node};
> - if (scalar($missing_mappings->@*)) {
> - $checked_nodes->{$node}->{'unavailable-resources'} = 
> $missing_mappings;
> - next;
> - }
> + foreach my $node ((keys $checked_nodes->%*, keys 
> $missing_mappings_by_node->%*)) {
> + my $missing_mappings = $missing_mappings_by_node->{$node};
> + if (scalar($missing_mappings->@*)) {
> + $checked_nodes->{$node}->{'unavailable-resources'} = 
> $missing_mappings;
> + next;
> + }
>
> + if (!$res->{running}) {
>   if (!defined($checked_nodes->{$node}->{unavailable_storages})) {
> - push @{$res->{allowed_nodes}}, $node;
> + push $allowed_nodes->@*, $node;
>   }
> -
>   }
> - $res->{not_allowed_nodes} = $checked_nodes;
>   }
> + $res->{not_allowed_nodes} = $checked_nodes if 
> scalar(keys($checked_nodes->%*)) || !$res->{running};
> + $res->{allowed_nodes} = $allowed_nodes if scalar($allowed_nodes->@*) || 
> !$res->{running};
>
>   my $local_disks = &$check_vm_disks_local($storecfg, $vmconf, $vmid);
>   $res->{local_disks} = [ values %$local_disks ];;



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



Re: [pve-devel] [PATCH widget-toolkit 3/3] window: edit: avoid shared object for extra request params

2024-04-04 Thread Stefan Sterz
On Wed Apr 3, 2024 at 11:10 AM CEST, Friedrich Weber wrote:
> Currently, `Proxmox.window.Edit` initializes `extraRequestParams` to
> an object that, if not overwritten, is shared between all instances of
> subclasses. This bears the danger of modifying the shared object in a
> subclass instead of overwriting it, which affects all edit windows of
> the current session and can cause hard-to-catch UI bugs [1].
>
> To avoid such bugs in the future, initialize `extraRequestParams` to
> `undefined` instead, which forces subclasses to initialize their own
> objects.
>
> Note that bugs of the same kind can still happen if a subclass
> initializes `extraRequestParams` to an empty shared object and
> inadvertently modifies it, but at least they will be limited to that
> particular subclass.
>
> [1] https://lists.proxmox.com/pipermail/pve-devel/2024-March/062179.html
>
> Signed-off-by: Friedrich Weber 
> ---
>
> Notes:
> With patch 2/3 applied, I think all occurrences of
> `extraRequestParams` in PVE/PBS create their own object (PMG does not
> seem to use `extraRequestParams`), so this patch should not break
> anything, and if it does, it should be quite noticeable.
>
> new in v2
>
>  src/window/Edit.js | 8 +---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/src/window/Edit.js b/src/window/Edit.js
> index d4a2b551..27cd8d01 100644
> --- a/src/window/Edit.js
> +++ b/src/window/Edit.js
> @@ -9,7 +9,7 @@ Ext.define('Proxmox.window.Edit', {
>
>  // to submit extra params on load and submit, useful, e.g., if not all ID
>  // parameters are included in the URL
> -extraRequestParams: {},
> +extraRequestParams: undefined,
>
>  resizable: false,
>
> @@ -80,7 +80,9 @@ Ext.define('Proxmox.window.Edit', {
>   let me = this;
>
>   let values = {};
> - Ext.apply(values, me.extraRequestParams);
> + if (me.extraRequestParams) {
> + Ext.apply(values, me.extraRequestParams);
> + }
>
>   let form = me.formPanel.getForm();
>
> @@ -209,7 +211,7 @@ Ext.define('Proxmox.window.Edit', {
>   waitMsgTarget: me,
>   }, options);
>
> - if (Object.keys(me.extraRequestParams).length > 0) {
> + if (me.extraRequestParams && Object.keys(me.extraRequestParams).length 
> > 0) {
>   let params = newopts.params || {};
>   Ext.applyIf(params, me.extraRequestParams);
>   newopts.params = params;

i did a quick an dirty test and using a constructor like this seems to
rule out this class of bug completelly:

```js
constructor: function(conf) {
let me = this;
me.extraRequestParams = {};
me.initConfig(conf);
me.callParent();
},
```

basically it configures the edit window as usual, but overwrites the
`extraRequestParams` object for each instance with a new empty object.
so there are no more shared objects :) could you check whether that also
fixes the other instances?

[1]: 
https://docs-devel.sencha.com/extjs/7.0.0/classic/Ext.window.Window.html#method-constructor



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



Re: [pve-devel] [PATCH widget-toolkit 3/3] window: edit: avoid shared object for extra request params

2024-04-04 Thread Stefan Sterz
-- >8 snip 8< --
> >
> > i did a quick an dirty test and using a constructor like this seems to
> > rule out this class of bug completelly:
> >
> > ```js
> > constructor: function(conf) {
> > let me = this;
> > me.extraRequestParams = {};
> > me.initConfig(conf);
> > me.callParent();
> > },
> > ```
> >
> > basically it configures the edit window as usual, but overwrites the
> > `extraRequestParams` object for each instance with a new empty object.
> > so there are no more shared objects :) could you check whether that also
> > fixes the other instances?
> >
> > [1]: 
> > https://docs-devel.sencha.com/extjs/7.0.0/classic/Ext.window.Window.html#method-constructor
>
> Nifty, didn't think about a constructor solution. Such a general
> solution would be way more elegant, thanks for suggesting it!
>
> However, this particular constructor seems to break the pattern of
> defining `extraRequestParams` in the subclass properties, as done by
> `PVE.Pool.AddVM` [1]. With the constructor above, the API request done
> by `AddVM` seems to be missing the `allow-move` parameter.
>
> Looks like once `PVE.Pool.AddVM` is instantiated and the constructor is
> called, `extraRequestParams` with `allow-move` is only defined in
> `me.__proto__`, so `me.extraRequestParams = {}` essentially shadows it
> with an empty object, losing the `allow-move`.
>

not sure what you mean by that, if an `PVE.Pool.AddVM` is instantiated,
the `extraRequestParams` is already set, so it isn't just in `__proto__`
for me. but yeah, the problem is correct as `me.extraRequestParams = {}`
overwrites the field.

> Do you have an idea how to fix this? Maybe making a copy of
> `extraRequestParams` would work (I suppose the overhead of creating a
> new object for all edit window (subclass) instances is negligible).
>
> [1]
> https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/grid/PoolMembers.js;h=75f20cab;hb=4b06efb5#l9

this worked for me, can you confirm that this also does what it should
for you?

```js
extraRequestParams: undefined,

constructor: function(conf) {
let me = this;
if (!me.extraRequestParams) {
me.extraRequestParams = {};
}
me.initConfig(conf);
me.callParent();
},
```


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



Re: [pve-devel] [PATCH widget-toolkit 3/3] window: edit: avoid shared object for extra request params

2024-04-04 Thread Stefan Sterz
On Thu Apr 4, 2024 at 12:10 PM CEST, Friedrich Weber wrote:
> On 04/04/2024 11:23, Stefan Sterz wrote:
> > -- >8 snip 8< --
> >>>
> >>> i did a quick an dirty test and using a constructor like this seems to
> >>> rule out this class of bug completelly:
> >>>
> >>> ```js
> >>> constructor: function(conf) {
> >>> let me = this;
> >>> me.extraRequestParams = {};
> >>> me.initConfig(conf);
> >>> me.callParent();
> >>> },
> >>> ```
> >>>
> >>> basically it configures the edit window as usual, but overwrites the
> >>> `extraRequestParams` object for each instance with a new empty object.
> >>> so there are no more shared objects :) could you check whether that also
> >>> fixes the other instances?
> >>>
> >>> [1]: 
> >>> https://docs-devel.sencha.com/extjs/7.0.0/classic/Ext.window.Window.html#method-constructor
> >>
> >> Nifty, didn't think about a constructor solution. Such a general
> >> solution would be way more elegant, thanks for suggesting it!
> >>
> >> However, this particular constructor seems to break the pattern of
> >> defining `extraRequestParams` in the subclass properties, as done by
> >> `PVE.Pool.AddVM` [1]. With the constructor above, the API request done
> >> by `AddVM` seems to be missing the `allow-move` parameter.
> >>
> >> Looks like once `PVE.Pool.AddVM` is instantiated and the constructor is
> >> called, `extraRequestParams` with `allow-move` is only defined in
> >> `me.__proto__`, so `me.extraRequestParams = {}` essentially shadows it
> >> with an empty object, losing the `allow-move`.
> >>
> >
> > not sure what you mean by that, if an `PVE.Pool.AddVM` is instantiated,
> > the `extraRequestParams` is already set, so it isn't just in `__proto__`
> > for me. but yeah, the problem is correct as `me.extraRequestParams = {}`
> > overwrites the field.
>
> I agree it doesn't matter here, but just for completeness, I meant that
> if I set a breakpoint before line 2, so before the overwrite:
>
> ```js
> constructor: function(conf) {
> let me = this;
> =>me.extraRequestParams = {};
> me.initConfig(conf);
> me.callParent();
> },
> ```
>
> ... `extraRequestParams` is not a property of `me`, but inherited from
> its prototype:
>
> ```
> >> me.extraRequestParams
> Object { "allow-move": 1 }
> >> "extraRequestParams" in me
> true
> >> Object.hasOwn(me, "extraRequestParams")
> false
> ```
>
> Doesn't make a difference for the overwrite, though.
>

ah yeah, that makes sense, but yeah, it doesn't really matter here i
suppose.

> >> Do you have an idea how to fix this? Maybe making a copy of
> >> `extraRequestParams` would work (I suppose the overhead of creating a
> >> new object for all edit window (subclass) instances is negligible).
> >>
> >> [1]
> >> https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/grid/PoolMembers.js;h=75f20cab;hb=4b06efb5#l9
> >
> > this worked for me, can you confirm that this also does what it should
> > for you?
> >
> > ```js
> > extraRequestParams: undefined,
> >
> > constructor: function(conf) {
> > let me = this;
> > if (!me.extraRequestParams) {
> > me.extraRequestParams = {};
> > }
> > me.initConfig(conf);
> > me.callParent();
> > },
> > ```
>
> It works in the sense that it fixes the bug mentioned in my patch 1/3,
> and fixes the lost `allow-move` issue from the previous constructor. But
> with this constructor, all instances of `AddVM` share the same
> `extraRequestParams` (the body of the `if` never gets executed for
> `AddVM` instances), which is the condition that my patch 2/3 tries to
> avoid (even though it is currently not buggy).
>
> Maybe we could do:
>
> ```js
> extraRequestParams: {},
>
> constructor: function(conf) {
> let me = this;
>   me.extraRequestParams = Ext.clone(me.extraRequestParams);
> me.initConfig(conf);
> me.callParent();
> },
> ```
>
> ... which, if I'm not missing anything, *should* cover everything (with
> the cost of allocating unnecessary empty objects)?

yeah looks good to me. cloning shouldn't cost too much here. if we are
really worried we could check whether the object is empty, clone
it in that case and assign an empty object otherwise.



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



Re: [pve-devel] [PATCH widget-toolkit 3/3] window: edit: avoid shared object for extra request params

2024-04-04 Thread Stefan Sterz
On Thu Apr 4, 2024 at 12:54 PM CEST, Stefan Sterz wrote:
> On Thu Apr 4, 2024 at 12:10 PM CEST, Friedrich Weber wrote:
> > On 04/04/2024 11:23, Stefan Sterz wrote:
> > > -- >8 snip 8< --
> > >>>
> > >>> i did a quick an dirty test and using a constructor like this seems to
> > >>> rule out this class of bug completelly:
> > >>>
> > >>> ```js
> > >>> constructor: function(conf) {
> > >>> let me = this;
> > >>> me.extraRequestParams = {};
> > >>> me.initConfig(conf);
> > >>> me.callParent();
> > >>> },
> > >>> ```
> > >>>
> > >>> basically it configures the edit window as usual, but overwrites the
> > >>> `extraRequestParams` object for each instance with a new empty object.
> > >>> so there are no more shared objects :) could you check whether that also
> > >>> fixes the other instances?
> > >>>
> > >>> [1]: 
> > >>> https://docs-devel.sencha.com/extjs/7.0.0/classic/Ext.window.Window.html#method-constructor
> > >>
> > >> Nifty, didn't think about a constructor solution. Such a general
> > >> solution would be way more elegant, thanks for suggesting it!
> > >>
> > >> However, this particular constructor seems to break the pattern of
> > >> defining `extraRequestParams` in the subclass properties, as done by
> > >> `PVE.Pool.AddVM` [1]. With the constructor above, the API request done
> > >> by `AddVM` seems to be missing the `allow-move` parameter.
> > >>
> > >> Looks like once `PVE.Pool.AddVM` is instantiated and the constructor is
> > >> called, `extraRequestParams` with `allow-move` is only defined in
> > >> `me.__proto__`, so `me.extraRequestParams = {}` essentially shadows it
> > >> with an empty object, losing the `allow-move`.
> > >>
> > >
> > > not sure what you mean by that, if an `PVE.Pool.AddVM` is instantiated,
> > > the `extraRequestParams` is already set, so it isn't just in `__proto__`
> > > for me. but yeah, the problem is correct as `me.extraRequestParams = {}`
> > > overwrites the field.
> >
> > I agree it doesn't matter here, but just for completeness, I meant that
> > if I set a breakpoint before line 2, so before the overwrite:
> >
> > ```js
> > constructor: function(conf) {
> > let me = this;
> > =>me.extraRequestParams = {};
> > me.initConfig(conf);
> > me.callParent();
> > },
> > ```
> >
> > ... `extraRequestParams` is not a property of `me`, but inherited from
> > its prototype:
> >
> > ```
> > >> me.extraRequestParams
> > Object { "allow-move": 1 }
> > >> "extraRequestParams" in me
> > true
> > >> Object.hasOwn(me, "extraRequestParams")
> > false
> > ```
> >
> > Doesn't make a difference for the overwrite, though.
> >
>
> ah yeah, that makes sense, but yeah, it doesn't really matter here i
> suppose.
>
> > >> Do you have an idea how to fix this? Maybe making a copy of
> > >> `extraRequestParams` would work (I suppose the overhead of creating a
> > >> new object for all edit window (subclass) instances is negligible).
> > >>
> > >> [1]
> > >> https://git.proxmox.com/?p=pve-manager.git;a=blob;f=www/manager6/grid/PoolMembers.js;h=75f20cab;hb=4b06efb5#l9
> > >
> > > this worked for me, can you confirm that this also does what it should
> > > for you?
> > >
> > > ```js
> > > extraRequestParams: undefined,
> > >
> > > constructor: function(conf) {
> > > let me = this;
> > > if (!me.extraRequestParams) {
> > > me.extraRequestParams = {};
> > > }
> > > me.initConfig(conf);
> > > me.callParent();
> > > },
> > > ```
> >
> > It works in the sense that it fixes the bug mentioned in my patch 1/3,
> > and fixes the lost `allow-move` issue from the previous constructor. But
> > with this constructor, all instances of `AddVM` share the same
> > `extraRequestParams` (the body of the `if` never gets executed for
> > `AddVM` instances), which is the condition that my patch 2/3 tries to
> > avoid (even though it is curr

Re: [pve-devel] [PATCH widget-toolkit v3] window: edit: avoid sharing custom config objects between subclasses

2024-04-08 Thread Stefan Sterz
On Mon Apr 8, 2024 at 11:30 AM CEST, Friedrich Weber wrote:
> Currently, `Proxmox.window.Edit` initializes `extraRequestParams` and
> `submitOptions` to two objects that, if not overwritten, are shared
> between all instances of subclasses. This bears the danger of
> modifying the shared object in a subclass instead of overwriting it,
> which affects all edit windows of the current session and can cause
> hard-to-catch GUI bugs.
>
> One such bug is the following: Currently, the `PVE.pool.AddStorage`
> component inadvertently adds `poolid` to an `extraRequestParams`
> object that is shared between all instances of `Proxmox.window.Edit`.
> As a result, after adding a storage to a pool, opening any edit window
> will send a GET request with a superfluous `poolid` parameter and
> cause an error in the GUI:
>
> > Parameter verification failed. (400)
> > poolid: property is not defined in schema and the schema does not
> > allow additional properties
>
> This breaks all edit windows of the current session. A workaround is
> to reload the current browser session.
>
> To avoid this class of bugs in the future, implement a constructor
> that makes copies of `extraRequestParams` and `submitOptions`. This
> ensures that any subclass instance modifies only its own copies, and
> modifications do not leak to other subclass instances.
>
> Suggested-by: Stefan Sterz 
> Suggested-by: Thomas Lamprecht 
> Signed-off-by: Friedrich Weber 
> ---
>
> Notes:
> @Thomas, I've added a Suggested-by, feel free to remove/keep as you
> prefer.
>
> Changes from v1+v2:
> - As suggested by sterzy (thx!), avoid this class of bugs in a more
>   generic fashion by introducing a `Proxmox.window.Edit` constructor
>   that copies custom config objects
> - Added full error message to commit message for better searchability
>
> v2: https://lists.proxmox.com/pipermail/pve-devel/2024-April/062561.html
> v1: https://lists.proxmox.com/pipermail/pve-devel/2024-March/062179.html
>
>  src/window/Edit.js | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/src/window/Edit.js b/src/window/Edit.js
> index d4a2b551..d5163dd7 100644
> --- a/src/window/Edit.js
> +++ b/src/window/Edit.js
> @@ -69,6 +69,16 @@ Ext.define('Proxmox.window.Edit', {
>  // onlineHelp of our first item, if set.
>  onlineHelp: undefined,
>
> +constructor: function(conf) {
> + let me = this;
> + // make copies in order to prevent subclasses from accidentally writing
> + // to objects that are shared with other edit window subclasses
> + me.extraRequestParams = Object.assign({}, me.extraRequestParams);
> + me.submitOptions = Object.assign({}, me.submitOptions);
> + me.initConfig(conf);
> + me.callParent();


so, this seems like a fix bug a) creates bug b) type of situation...
this patch means that editing a pool allows changing the name suddenly,
but since we don't support that in the backend, that just creates a new
pool :/

this is due to the `editable` attribute depending on `isCreate`, which
in turn depends on the configs poolid being set. to fix this, the config
needs to also be passed to `callParent` so it can set the configurations
there too. so this line should be:

me.callParent([conf]);

sorry, could have noticed that earlier in my suggestion. also this needs
to be an arrray as `callParent` expects a list of arguments to pass to
parent's function and not the parameters themselves directly.

> +},
> +
>  isValid: function() {
>   let me = this;
>



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



Re: [pve-devel] [PATCH widget-toolkit v4] window: edit: avoid sharing custom config objects between subclasses

2024-04-09 Thread Stefan Sterz
On Tue Apr 9, 2024 at 10:16 AM CEST, Friedrich Weber wrote:
> Currently, `Proxmox.window.Edit` initializes `extraRequestParams` and
> `submitOptions` to two objects that, if not overwritten, are shared
> between all instances of subclasses. This bears the danger of
> modifying the shared object in a subclass instead of overwriting it,
> which affects all edit windows of the current session and can cause
> hard-to-catch GUI bugs.
>
> One such bug is the following: Currently, the `PVE.pool.AddStorage`
> component inadvertently adds `poolid` to an `extraRequestParams`
> object that is shared between all instances of `Proxmox.window.Edit`.
> As a result, after adding a storage to a pool, opening any edit window
> will send a GET request with a superfluous `poolid` parameter and
> cause an error in the GUI:
>
> > Parameter verification failed. (400)
> > poolid: property is not defined in schema and the schema does not
> > allow additional properties
>
> This breaks all edit windows of the current session. A workaround is
> to reload the current browser session.
>
> To avoid this class of bugs in the future, implement a constructor
> that makes copies of `extraRequestParams` and `submitOptions`. This
> ensures that any subclass instance modifies only its own copies, and
> modifications do not leak to other subclass instances.
>
> Suggested-by: Stefan Sterz 
> Suggested-by: Thomas Lamprecht 
> Signed-off-by: Friedrich Weber 
> ---
>
> Notes:
> @Thomas, I've added a Suggested-by, feel free to remove/keep as you
> prefer.
>
> Changes from v3:
> - Fix broken pool edit window (thx sterzy!) by passing all arguments
>   to `callParent`. The `initConfig` call is obsolete as the constructor
>   of `Ext.Component` [1] calls `initConfig` already.
>
> Changes from v1+v2:
> - As suggested by sterzy (thx!), avoid this class of bugs in a more
>   generic fashion by introducing a `Proxmox.window.Edit` constructor
>   that copies custom config objects
> - Added full error message to commit message for better searchability
>
> v3: https://lists.proxmox.com/pipermail/pve-devel/2024-April/062657.html
> v2: https://lists.proxmox.com/pipermail/pve-devel/2024-April/062561.html
> v1: https://lists.proxmox.com/pipermail/pve-devel/2024-March/062179.html
>
> [1] 
> https://docs.sencha.com/extjs/7.0.0/classic/src/Component.js.html#line2203
>
>  src/window/Edit.js | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/window/Edit.js b/src/window/Edit.js
> index d4a2b551..c55ff793 100644
> --- a/src/window/Edit.js
> +++ b/src/window/Edit.js
> @@ -69,6 +69,15 @@ Ext.define('Proxmox.window.Edit', {
>  // onlineHelp of our first item, if set.
>  onlineHelp: undefined,
>
> +constructor: function(conf) {
> + let me = this;
> + // make copies in order to prevent subclasses from accidentally writing
> + // to objects that are shared with other edit window subclasses
> + me.extraRequestParams = Object.assign({}, me.extraRequestParams);
> + me.submitOptions = Object.assign({}, me.submitOptions);
> + me.callParent(arguments);
> +},
> +
>  isValid: function() {
>   let me = this;
>

this looks good to me, i've also tested this here, so consider this:

Tested-by: Stefan Sterz 


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



[pve-devel] [PATCH pve-storage] esxi: add mapping for windows server 2016/2019

2024-04-09 Thread Stefan Sterz
previously these were mapped to the linux 2.6 default

Signed-off-by: Stefan Sterz 
---
 src/PVE/Storage/ESXiPlugin.pm | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/PVE/Storage/ESXiPlugin.pm b/src/PVE/Storage/ESXiPlugin.pm
index 4212c36..e5082ea 100644
--- a/src/PVE/Storage/ESXiPlugin.pm
+++ b/src/PVE/Storage/ESXiPlugin.pm
@@ -878,6 +878,8 @@ my %guest_types_windows = (
 winNetBusiness  => 'w2k3',
 windows9=> 'win10',
 'windows9-64'   => 'win10',
+windows9srv => 'win10',
+'windows9srv-64'=> 'win10',
 'windows11-64'  => 'win11',
 'windows12-64'  => 'win11', # FIXME / win12?
 win2000AdvServ  => 'w2k',
-- 
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 widget-toolkit] dark-mode: set intentionally black icons to `$icon-color`

2024-04-10 Thread Stefan Sterz
On Mon Oct 16, 2023 at 6:28 PM CEST, Stefan Sterz wrote:
> some icons intentionally use black as their color in the light theme.
> this includes the little pencil and check mark icon in the acme
> overview. change their color to the regular dark-mode icon-color. for
> this to work the filter inversion needed for some other icons needs to
> be remove too.
>
> Signed-off-by: Stefan Sterz 
> ---
>  src/proxmox-dark/scss/other/_icons.scss | 9 +
>  1 file changed, 9 insertions(+)
>
> diff --git a/src/proxmox-dark/scss/other/_icons.scss 
> b/src/proxmox-dark/scss/other/_icons.scss
> index d4dc316..c045cf4 100644
> --- a/src/proxmox-dark/scss/other/_icons.scss
> +++ b/src/proxmox-dark/scss/other/_icons.scss
> @@ -104,6 +104,9 @@
>  }
>
>  // pbs show task log in longest task list column
> +.fa.black,
> +.fa.black::after,
> +.fa.black::before,
>  .x-action-col-icon.fa-chevron-right::before {
>filter: none;
>  }
> @@ -222,6 +225,12 @@
>}
>  }
>
> +// set icon color of intentional black icons (e.g.: pencil icon for
> +// quickly changing the ACME account)
> +.fa.black {
> +  color: $icon-color;
> +}
> +
>  // The usage icons dynamically displaying how full a storage is
>  .usage-wrapper {
>border: 1px solid $icon-color;
> --
> 2.39.2

ping, this still applies for me :)


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



Re: [pve-devel] [PATCH manager] pve7to8: reword and fix typos in description

2024-04-18 Thread Stefan Sterz
On Thu Apr 18, 2024 at 9:44 AM CEST, Alexander Zeidler wrote:
> Signed-off-by: Alexander Zeidler 
> ---
>  bin/Makefile | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/bin/Makefile b/bin/Makefile
> index 180a91b5..aa149c06 100644
> --- a/bin/Makefile
> +++ b/bin/Makefile
> @@ -66,10 +66,10 @@ pve6to7.1:
>
>  pve7to8.1:
>   printf ".TH PVE7TO8 1\n.SH NAME\npve7to8 \- Proxmox VE upgrade checker 
> script for 7.4+ to current 8.x\n" > $@.tmp
> - printf ".SH DESCRIPTION\nThis tool will help you to detect common 
> pitfalls and misconfguration\
> -  before, and during the upgrade of a Proxmox VE system\n" >> $@.tmp
> - printf "Any failure must be addressed before the upgrade, and any 
> waring must be addressed, \
> -  or at least carefully evaluated, if a false-positive is suspected\n" 
> >> $@.tmp
> + printf ".SH DESCRIPTION\nThis tool will help you to detect common 
> pitfalls and misconfiguration\

nit: the "to" in "to detect" is superfluous, "will help you detect"
flows much nicer

also, and this is a matter of personal style "misconfigurations" sounds
better to me here because you stay in the plural, but that's really
minor.

> +  before, and during the upgrade of a Proxmox VE system.\n" >> $@.tmp

i know this is pre-existing, but since you are touching this anyway: the
comma here is odd, if this was supposed to be an oxford comma (or serial
comma), please be aware that these only apply in lists of three or more
items. here we have two lists of two items, so the oxford comma does not
apply.

> + printf "Any failures or warnings must be addressed prior to the 
> upgrade.\n" >> $@.tmp
> + printf "If you think that a message is a false-positive, check this 
> carefully before proceeding.\n" >> $@.tmp

again a matter of personal taste, but "check this carefully" sounds a
bit clumsy to me. maybe "double-check that the tool is incorrect before
proceeding".

>   printf ".SH SYNOPSIS\npve7to8 [--full]\n" >> $@.tmp
>   mv $@.tmp $@
>



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



Re: [pve-devel] [PATCH manager] pveversion: show upgradable package version in verbose output

2024-04-18 Thread Stefan Sterz
On Thu Apr 18, 2024 at 9:44 AM CEST, Alexander Zeidler wrote:
> when the state is "Installed", including not correctly installed, but
> not for (residual) "ConfigFiles".
>
> The information
> * can be inaccurate for offline nodes or when using POM.
> * is included in pveversion so it can also be used on public channels
>   like the forum. The current System Report includes pveversion -v
>
>  # pveversion -v
>  proxmox-ve: 8.1.0 (running kernel: 6.5.13-5-pve)
>  pve-manager: 8.1.6 (running version: 8.1.6/b7e8e914a1db70cc) [available: 
> 8.1.10]
>  ...
>  vncterm: 1.8.0
>  zfsutils-linux: 2.2.3-pve1 [available: 2.2.3-pve2]
>
> Signed-off-by: Alexander Zeidler 
> ---
>  bin/pveversion | 22 --
>  1 file changed, 16 insertions(+), 6 deletions(-)
>
> diff --git a/bin/pveversion b/bin/pveversion
> index 591f63e7..b98e1096 100755
> --- a/bin/pveversion
> +++ b/bin/pveversion
> @@ -21,19 +21,29 @@ sub print_status {
>   print "$pkg: unknown package - internal error\n";
>   return;
>  }
> +
> +my $installed = $pkginfo->{CurrentState} eq 'Installed';
> +my $upgradable = $pkginfo->{OldVersion} && ($pkginfo->{OldVersion} ne 
> $pkginfo->{Version});
> +
>  my $version = "not correctly installed";
> -if ($pkginfo->{OldVersion} && $pkginfo->{CurrentState} eq 'Installed') {
> +if ($installed && $pkginfo->{OldVersion}) {
>   $version = $pkginfo->{OldVersion};
>  } elsif ($pkginfo->{CurrentState} eq 'ConfigFiles') {
>   $version = 'residual config';
>  }
>
>  if ($pkginfo->{RunningKernel}) {
> - print "$pkg: $version (running kernel: $pkginfo->{RunningKernel})\n";
> + print "$pkg: $version (running kernel: $pkginfo->{RunningKernel})";
>  } elsif ($pkginfo->{ManagerVersion}) {
> - print "$pkg: $version (running version: $pkginfo->{ManagerVersion})\n";
> + print "$pkg: $version (running version: $pkginfo->{ManagerVersion})";
> +} else {
> + print "$pkg: $version";
> +}
> +
> +if ($installed && $upgradable) {
> + print " [available: " . $pkginfo->{Version} . "]\n";

nit: i think we generally prefer string interpolation over
concatenation, as in the code above. so simply:

print " [available: $pkginfo->{Version} ]\n";

should work.

>  } else {
> - print "$pkg: $version\n";
> + print "\n";
>  }
>  }
>

the changes below just remove superfluous whitespace, this might be
better handled separatelly as these changes have nothing to do with the
functionality added above.

> @@ -50,7 +60,7 @@ my $opt_verbose;
>  if (!GetOptions ('verbose' => \$opt_verbose)) {
>  print_usage ();
>  exit (-1);
> -}
> +}
>
>  if (scalar (@ARGV) != 0) {
>  print_usage ();
> @@ -76,7 +86,7 @@ __END__
>
>  =head1 NAME
>
> -pveversion - Proxmox  VE version info
> +pveversion - Proxmox VE version info
>
>  =head1 SYNOPSIS
>



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



Re: [pve-devel] [PATCH manager] pve7to8: reword and fix typos in description

2024-04-18 Thread Stefan Sterz
On Thu Apr 18, 2024 at 10:13 AM CEST, Thomas Lamprecht wrote:
> Am 18/04/2024 um 10:03 schrieb Stefan Sterz:
> >> +   before, and during the upgrade of a Proxmox VE system.\n" >> $@.tmp
> >
> > i know this is pre-existing, but since you are touching this anyway: the
> > comma here is odd, if this was supposed to be an oxford comma (or serial
> > comma), please be aware that these only apply in lists of three or more
> > items. here we have two lists of two items, so the oxford comma does not
> > apply.
>
> yeah, that can be dropped – I often tend to go for the comma if I'm in
> doubt, in a hurry, or the like... ^^
>
> >
> >> +  printf "Any failures or warnings must be addressed prior to the 
> >> upgrade.\n" >> $@.tmp
> >> +  printf "If you think that a message is a false-positive, check this 
> >> carefully before proceeding.\n" >> $@.tmp
> >
> > again a matter of personal taste, but "check this carefully" sounds a
> > bit clumsy to me. maybe "double-check that the tool is incorrect before
> > proceeding".
>
> I'd not suggest the tool being incorrect, rather that one should ensure that
> the warning does not apply to one's setup.

alright, then just that:

double-check that it does not apply to your setup.

:)


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


[pve-devel] [PATCH container 3/4] parse pct config: remove "\s*" from multi-line comment regex

2022-02-24 Thread Stefan Sterz
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz 
---
 src/PVE/LXC/Config.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/PVE/LXC/Config.pm b/src/PVE/LXC/Config.pm
index 0ed7bd2..548f07c 100644
--- a/src/PVE/LXC/Config.pm
+++ b/src/PVE/LXC/Config.pm
@@ -943,7 +943,7 @@ sub parse_pct_config {
next;
}
 
-   if ($line =~ m/^\#(.*)\s*$/) {
+   if ($line =~ m/^\#(.*)$/) {
$descr .= PVE::Tools::decode_text($1) . "\n";
next;
}
-- 
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 manager 2/4] parse node config: remove "\s*" from comment regex

2022-02-24 Thread Stefan Sterz
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz 
---
 PVE/NodeConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/NodeConfig.pm b/PVE/NodeConfig.pm
index df44410f..4c2fc570 100644
--- a/PVE/NodeConfig.pm
+++ b/PVE/NodeConfig.pm
@@ -205,7 +205,7 @@ sub parse_node_config {
 
 my @lines = split(/\n/, $content);
 foreach my $line (@lines) {
-   if ($line =~ /^\#(.*)\s*$/ || $line =~ /^description:\s*(.*\S)\s*$/) {
+   if ($line =~ /^\#(.*)$/ || $line =~ /^description:\s*(.*\S)\s*$/) {
$descr .= PVE::Tools::decode_text($1) . "\n";
next;
}
-- 
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 cluster 1/4] parse datacenter config: remove "\s*" from comment regex

2022-02-24 Thread Stefan Sterz
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz 
---
 data/PVE/DataCenterConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 6c0fa5b..8e51ba3 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -236,7 +236,7 @@ sub parse_datacenter_config {
 # description may be comment or key-value pair (or both)
 my $comment = '';
 for my $line (split(/\n/, $raw)) {
-   if ($line =~ /^\#(.*)\s*$/) {
+   if ($line =~ /^\#(.*)$/) {
$comment .= PVE::Tools::decode_text($1) . "\n";
}
 }
-- 
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 qemu-server 4/4] parse vm config: remove "\s*" from multi-line comment regex

2022-02-24 Thread Stefan Sterz
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz 
---
 PVE/QemuServer.pm | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 243c2e5..79900e8 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1,4 +1,4 @@
-package PVE::QemuServer;
+rpackage PVE::QemuServer;
 
 use strict;
 use warnings;
@@ -2366,7 +2366,7 @@ sub parse_vm_config {
next;
}
 
-   if ($line =~ m/^\#(.*)\s*$/) {
+   if ($line =~ m/^\#(.*)$/) {
$descr = '' if !defined($descr);
$descr .= PVE::Tools::decode_text($1) . "\n";
next;
-- 
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 qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex

2022-02-24 Thread Stefan Sterz
To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz 
---

There was a typo in the previous version of this patch, thanks to 
@oguz for spotting it.

 PVE/QemuServer.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 243c2e5..2347183 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2366,7 +2366,7 @@ sub parse_vm_config {
next;
}
 
-   if ($line =~ m/^\#(.*)\s*$/) {
+   if ($line =~ m/^\#(.*)$/) {
$descr = '' if !defined($descr);
$descr .= PVE::Tools::decode_text($1) . "\n";
next;
-- 
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 qemu-server v2 4/4] parse vm config: remove "\s*" from multi-line comment regex

2022-02-25 Thread Stefan Sterz
On 24.02.22 17:28, Dietmar Maurer wrote:
> 
>> On 02/24/2022 3:49 PM Stefan Sterz  wrote:
>>
>>  
>> To be consistent with PBS's implementation of multi-line comments
>> remove "\s*" here too. Since the regex isn't lazy .* matches
>> everything \s* would anyway.
> 
> But the old regex trimm spaces from the end, so this is quite different!

It would if the ".*" was evaluated lazily (as in ".*?"), but from my
testing it isn't. So since ".*" matches spaces greedily, they are
actually not trimmed. The only character that is matched by "\s" and
not by "." are line breaks, but those occur after the "$".
Hence, "\s" should never match anything here. I've also discussed this
with Wolfgang Bumiller off list.


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



[pve-devel] [PATCH SERIES v3 0/6] fix #3607: add notes to functionality in webui

2022-03-04 Thread Stefan Sterz
adds support for markdown-based notes to pbs. It also refactors the
pve `NotesView` panel and `NotesEdit` window so that we can move it
to the widget toolkit and maintain a single version of the two.
hence, the last commit for proxmox-backup and pve-manager need to be
applied and bumped with or after the toolkit.

changes v3 (thanks @ Dominik Csapak):

* refactored NotesView and NotesEdit
* removed notes from dashboard
* several javascrpt improvements

changes v2 (thanks @ Wolfgang Bumiller):

* performance improvements when parsing/writing a node configuration
* adjusted multi-line regex to remove superfluous "\s*"
* better formatting of rust code

proxmox-backup:
Stefan Sterz (4):
  fix #3067: api: add support for multi-line comments in node.cfg
  fix #3607: docs: add markdown primer from pve to pbs
  fix #3607: ui: add a separate notes view for longer markdown notes
  fix #3607: ui: refactor notes by moving the panel/window to widget kit

 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 pbs-api-types/src/lib.rs |   9 ++
 src/api2/node/config.rs  |   4 +
 src/config/node.rs   |  14 ++-
 src/tools/config.rs  |  56 +++-
 www/Makefile |   1 +
 www/NavigationTree.js|   6 ++
 www/NodeNotes.js |  22 +
 9 files changed, 288 insertions(+), 3 deletions(-)
 create mode 100644 docs/markdown-primer.rst
 create mode 100644 www/NodeNotes.js

widget-toolkit:
Stefan Sterz (1):
  toolkit: add markdown based NotesView and NotesEdit

 src/Makefile|   2 +
 src/panel/NotesView.js  | 155 
 src/window/NotesEdit.js |  38 ++
 3 files changed, 195 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

pve-manager:
Stefan Sterz (1):
  ui: move NotesView panel and NotesEdit window to widget kit

 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.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 proxmox-backup v3 1/6] fix #3067: api: add support for multi-line comments in node.cfg

2022-03-04 Thread Stefan Sterz
add support for multi-line comments to node.cfg and the api, similar to
how pve handles multi-line comments

Signed-off-by: Stefan Sterz 
---
 pbs-api-types/src/lib.rs |  9 +++
 src/api2/node/config.rs  |  4 +++
 src/config/node.rs   | 14 +-
 src/tools/config.rs  | 56 ++--
 4 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/pbs-api-types/src/lib.rs b/pbs-api-types/src/lib.rs
index 754e7b22..3b1fad2c 100644
--- a/pbs-api-types/src/lib.rs
+++ b/pbs-api-types/src/lib.rs
@@ -137,6 +137,8 @@ const_regex! {
 
 pub SINGLE_LINE_COMMENT_REGEX = r"^[[:^cntrl:]]*$";
 
+pub MULTI_LINE_COMMENT_REGEX = r"(?m)^([[:^cntrl:]]*)$";
+
 pub BACKUP_REPO_URL_REGEX = concat!(
 r"^^(?:(?:(",
 USER_ID_REGEX_STR!(), "|", APITOKEN_ID_REGEX_STR!(),
@@ -273,6 +275,13 @@ pub const SINGLE_LINE_COMMENT_SCHEMA: Schema = 
StringSchema::new("Comment (singl
 .format(&SINGLE_LINE_COMMENT_FORMAT)
 .schema();
 
+pub const MULTI_LINE_COMMENT_FORMAT: ApiStringFormat =
+ApiStringFormat::Pattern(&MULTI_LINE_COMMENT_REGEX);
+
+pub const MULTI_LINE_COMMENT_SCHEMA: Schema = StringSchema::new("Comment 
(multiple lines).")
+.format(&MULTI_LINE_COMMENT_FORMAT)
+.schema();
+
 pub const SUBSCRIPTION_KEY_SCHEMA: Schema = StringSchema::new("Proxmox Backup 
Server subscription key.")
 .format(&SUBSCRIPTION_KEY_FORMAT)
 .min_length(15)
diff --git a/src/api2/node/config.rs b/src/api2/node/config.rs
index 0a119354..3b267adc 100644
--- a/src/api2/node/config.rs
+++ b/src/api2/node/config.rs
@@ -64,6 +64,8 @@ pub enum DeletableProperty {
 ciphers_tls_1_2,
 /// Delete the default-lang property.
 default_lang,
+/// Delete any description
+description,
 }
 
 #[api(
@@ -124,6 +126,7 @@ pub fn update_node_config(
 DeletableProperty::ciphers_tls_1_3 => { config.ciphers_tls_1_3 
= None; },
 DeletableProperty::ciphers_tls_1_2 => { config.ciphers_tls_1_2 
= None; },
 DeletableProperty::default_lang => { config.default_lang = 
None; },
+DeletableProperty::description => { config.description = None; 
},
 }
 }
 }
@@ -139,6 +142,7 @@ pub fn update_node_config(
 if update.ciphers_tls_1_3.is_some() { config.ciphers_tls_1_3 = 
update.ciphers_tls_1_3; }
 if update.ciphers_tls_1_2.is_some() { config.ciphers_tls_1_2 = 
update.ciphers_tls_1_2; }
 if update.default_lang.is_some() { config.default_lang = 
update.default_lang; }
+if update.description.is_some() { config.description = update.description; 
}
 
 crate::config::node::save_config(&config)?;
 
diff --git a/src/config/node.rs b/src/config/node.rs
index 0ba87450..ac6774e3 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -8,7 +8,11 @@ use proxmox_schema::{api, ApiStringFormat, ApiType, Updater};
 
 use proxmox_http::ProxyConfig;
 
-use pbs_api_types::{EMAIL_SCHEMA, OPENSSL_CIPHERS_TLS_1_2_SCHEMA, 
OPENSSL_CIPHERS_TLS_1_3_SCHEMA};
+use pbs_api_types::{
+EMAIL_SCHEMA, MULTI_LINE_COMMENT_SCHEMA, OPENSSL_CIPHERS_TLS_1_2_SCHEMA,
+OPENSSL_CIPHERS_TLS_1_3_SCHEMA,
+};
+
 use pbs_buildcfg::configdir;
 use pbs_config::{open_backup_lockfile, BackupLockGuard};
 
@@ -167,6 +171,10 @@ pub enum Translation {
 "default-lang" : {
 schema: Translation::API_SCHEMA,
 optional: true,
+},
+"description" : {
+optional: true,
+schema: MULTI_LINE_COMMENT_SCHEMA,
 }
 },
 )]
@@ -210,6 +218,10 @@ pub struct NodeConfig {
 /// Default language used in the GUI
 #[serde(skip_serializing_if = "Option::is_none")]
 pub default_lang: Option,
+
+/// Node description
+#[serde(skip_serializing_if = "Option::is_none")]
+pub description: Option,
 }
 
 impl NodeConfig {
diff --git a/src/tools/config.rs b/src/tools/config.rs
index f666a8ab..cc722094 100644
--- a/src/tools/config.rs
+++ b/src/tools/config.rs
@@ -31,8 +31,19 @@ pub fn value_from_str(input: &str, schema: &'static Schema) 
-> Result Result,
 
 /// Note: the object must have already been verified at this point.
 fn object_to_writer(output: &mut dyn Write, object: &Object) -> Result<(), 
Error> {
+// special key `description` for multi-line notes, must be written before 
everything else
+if let Some(Value::String(description)) = object.get("description") {
+for lines in description.lines() {
+writeln!(output, "#{}", lines)?;
+}
+}
+
 for (key, value) in object.iter() {
 match value {
-Value::Null => continue, // delete this entry
+_ if key == "description" => continue, // skip description as we 
handle it above
+Value::Null => continue,  

[pve-devel] [PATCH proxmox-backup v3 5/6] fix #3607: ui: refactor notes by moving the panel/window to widget kit

2022-03-04 Thread Stefan Sterz
for better re-use between pbs and pve move the markdown notes panel
and editor window to the widget kit and unify them there.

Signed-off-by: Stefan Sterz 
---
 www/Makefile   |   1 -
 www/NodeNotes.js   |   2 +-
 www/panel/MarkdownNotes.js | 130 -
 3 files changed, 1 insertion(+), 132 deletions(-)
 delete mode 100644 www/panel/MarkdownNotes.js

diff --git a/www/Makefile b/www/Makefile
index aff0c901..922d8de9 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -81,7 +81,6 @@ JSSRC=
\
panel/StorageAndDisks.js\
panel/UsageChart.js \
panel/NodeInfo.js   \
-   panel/MarkdownNotes.js  \
ZFSList.js  \
DirectoryList.js\
LoginView.js\
diff --git a/www/NodeNotes.js b/www/NodeNotes.js
index 7fa3f2e6..f237f556 100644
--- a/www/NodeNotes.js
+++ b/www/NodeNotes.js
@@ -11,7 +11,7 @@ Ext.define('PBS.NodeNotes', {
xtype: 'container',
layout: 'fit',
items: [{
-   xtype: 'pbsMarkdownNotes',
+   xtype: 'pmxNotesView',
tools: false,
border: false,
node: 'localhost',
diff --git a/www/panel/MarkdownNotes.js b/www/panel/MarkdownNotes.js
deleted file mode 100644
index 6d601401..
--- a/www/panel/MarkdownNotes.js
+++ /dev/null
@@ -1,130 +0,0 @@
-Ext.define('PBS.panel.MarkdownNotes', {
-extend: 'Ext.panel.Panel',
-xtype: 'pbsMarkdownNotes',
-mixins: ['Proxmox.Mixin.CBind'],
-
-title: gettext("Notes"),
-bodyPadding: 10,
-scrollable: true,
-animCollapse: false,
-maxLength: 64*1022,
-
-cbindData: function(initalConfig) {
-   let me = this;
-
-   if (!me.node) {
-   throw 'no node provided, cannot construct url';
-   }
-
-   me.url = `/api2/extjs/nodes/${me.node}/config`;
-   return {};
-},
-
-run_editor: function() {
-   let me = this;
-   Ext.create('Proxmox.window.Edit', {
-   title: gettext('Notes'),
-   onlineHelp: 'markdown_basics',
-   width: 800,
-   height: 600,
-   resizable: true,
-   layout: 'fit',
-   defaultButton: undefined,
-   items: {
-   xtype: 'textarea',
-   maxLength: me.maxLength,
-   name: 'description',
-   height: '100%',
-   value: '',
-   hideLabel: true,
-   emptyText: gettext('You can use Markdown for rich text 
formatting.'),
-   fieldStyle: {
-   'white-space': 'pre-wrap',
-   'font-family': 'monospace',
-   },
-   },
-   url: me.url,
-   listeners: {
-   destroy: function() {
-   me.load();
-   },
-   },
-   autoShow: true,
-   autoLoad: true,
-   });
-},
-
-setNotes: function(value) {
-   let me = this;
-   var data = value || '';
-
-   let mdHtml = Proxmox.Markdown.parse(data);
-   me.update(mdHtml);
-
-   if (me.collapsible && me.collapseMode === 'auto') {
-   me.setCollapsed(data === '');
-   }
-},
-
-load: function() {
-   var me = this;
-
-   Proxmox.Utils.API2Request({
-   url: me.url,
-   waitMsgTarget: me,
-   failure: function(response, opts) {
-   Ext.Msg.alert(gettext('Error'), response.htmlStatus);
-   me.setCollapsed(false);
-   },
-   success: function(response, opts) {
-   me.setNotes(response.result.data.description);
-   },
-   });
-},
-
-listeners: {
-   render: function(c) {
-   var me = this;
-   me.getEl().on('dblclick', me.run_editor, me);
-   },
-   afterlayout: function() {
-   let me = this;
-   if (me.collapsible && !me.getCollapsed() && me.collapseMode === 
'always') {
-   me.setCollapsed(true);
-   me.collapseMode = ''; // only once, on initial load!
-   }
-   },
-},
-
-tools: [{
-   type: 'gear',
-   handler: function() {
-   this.up('panel').run_editor();
-   },
-}],
-
-tbar: {
-   itemId: 'tbar',
-   hidden: true,
-   items: [
-   {
-   text: gettext(&#x

[pve-devel] [PATCH proxmox-backup v3 3/6] fix #3607: ui: add a separate notes view for longer markdown notes

2022-03-04 Thread Stefan Sterz
since markdown notes might be rather long, this commit adds a tab
similar to pve's datacenter or node notes.

Signed-off-by: Stefan Sterz 
---
 www/Makefile   |   2 +
 www/NavigationTree.js  |   6 ++
 www/NodeNotes.js   |  22 +++
 www/panel/MarkdownNotes.js | 130 +
 4 files changed, 160 insertions(+)
 create mode 100644 www/NodeNotes.js
 create mode 100644 www/panel/MarkdownNotes.js

diff --git a/www/Makefile b/www/Makefile
index 455fbeec..aff0c901 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -81,6 +81,7 @@ JSSRC=
\
panel/StorageAndDisks.js\
panel/UsageChart.js \
panel/NodeInfo.js   \
+   panel/MarkdownNotes.js  \
ZFSList.js  \
DirectoryList.js\
LoginView.js\
@@ -98,6 +99,7 @@ JSSRC=
\
datastore/DataStoreList.js  \
ServerStatus.js \
ServerAdministration.js \
+   NodeNotes.js\
Dashboard.js\
${TAPE_UI_FILES}\
NavigationTree.js   \
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 576d05ab..916582ef 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -32,6 +32,12 @@ Ext.define('PBS.store.NavigationStore', {
path: 'pbsDashboard',
leaf: true,
},
+   {
+   text: gettext('Notes'),
+   iconCls: 'fa fa-sticky-note-o',
+   path: 'pbsNodeNotes',
+   leaf: true,
+   },
{
text: gettext('Configuration'),
iconCls: 'fa fa-gears',
diff --git a/www/NodeNotes.js b/www/NodeNotes.js
new file mode 100644
index ..7fa3f2e6
--- /dev/null
+++ b/www/NodeNotes.js
@@ -0,0 +1,22 @@
+// Needs to be its own xtype for `path` to work in `NavigationTree`
+Ext.define('PBS.NodeNotes', {
+extend: 'Ext.panel.Panel',
+xtype: 'pbsNodeNotes',
+
+scrollable: true,
+layout: 'fit',
+
+items: [
+   {
+   xtype: 'container',
+   layout: 'fit',
+   items: [{
+   xtype: 'pbsMarkdownNotes',
+   tools: false,
+   border: false,
+   node: 'localhost',
+   enableTbar: true,
+   }],
+   },
+],
+});
diff --git a/www/panel/MarkdownNotes.js b/www/panel/MarkdownNotes.js
new file mode 100644
index ..6d601401
--- /dev/null
+++ b/www/panel/MarkdownNotes.js
@@ -0,0 +1,130 @@
+Ext.define('PBS.panel.MarkdownNotes', {
+extend: 'Ext.panel.Panel',
+xtype: 'pbsMarkdownNotes',
+mixins: ['Proxmox.Mixin.CBind'],
+
+title: gettext("Notes"),
+bodyPadding: 10,
+scrollable: true,
+animCollapse: false,
+maxLength: 64*1022,
+
+cbindData: function(initalConfig) {
+   let me = this;
+
+   if (!me.node) {
+   throw 'no node provided, cannot construct url';
+   }
+
+   me.url = `/api2/extjs/nodes/${me.node}/config`;
+   return {};
+},
+
+run_editor: function() {
+   let me = this;
+   Ext.create('Proxmox.window.Edit', {
+   title: gettext('Notes'),
+   onlineHelp: 'markdown_basics',
+   width: 800,
+   height: 600,
+   resizable: true,
+   layout: 'fit',
+   defaultButton: undefined,
+   items: {
+   xtype: 'textarea',
+   maxLength: me.maxLength,
+   name: 'description',
+   height: '100%',
+   value: '',
+   hideLabel: true,
+   emptyText: gettext('You can use Markdown for rich text 
formatting.'),
+   fieldStyle: {
+   'white-space': 'pre-wrap',
+   'font-family': 'monospace',
+   },
+   },
+   url: me.url,
+   listeners: {
+   destroy: function() {
+   me.load();
+   },
+   },
+   autoShow: true,
+   autoLoad: true,
+   });
+},
+
+setNotes: function(value) {
+   let me = this;
+   var data = value || '';
+
+   let mdHtml = Proxmox.Mar

[pve-devel] [PATCH widget-toolkit v3 4/6] toolkit: add markdown based NotesView and NotesEdit

2022-03-04 Thread Stefan Sterz
move these from pve to the widget toolkit to be ablte to use them in
pbs

Signed-off-by: Stefan Sterz 
---
 src/Makefile|   2 +
 src/panel/NotesView.js  | 155 
 src/window/NotesEdit.js |  38 ++
 3 files changed, 195 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

diff --git a/src/Makefile b/src/Makefile
index de34531..ae20947 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -65,6 +65,7 @@ JSSRC=\
panel/ACMEDomains.js\
panel/StatusView.js \
panel/TfaView.js\
+   panel/NotesView.js  \
window/Edit.js  \
window/PasswordEdit.js  \
window/SafeDestroy.js   \
@@ -86,6 +87,7 @@ JSSRC=\
window/AddWebauthn.js   \
window/AddYubico.js \
window/TfaEdit.js   \
+   window/NotesEdit.js \
node/APT.js \
node/APTRepositories.js \
node/NetworkEdit.js \
diff --git a/src/panel/NotesView.js b/src/panel/NotesView.js
new file mode 100644
index 000..df5e688
--- /dev/null
+++ b/src/panel/NotesView.js
@@ -0,0 +1,155 @@
+Ext.define('Proxmox.panel.NotesView', {
+extend: 'Ext.panel.Panel',
+xtype: 'pmxNotesView',
+mixins: ['Proxmox.Mixin.CBind'],
+
+title: gettext("Notes"),
+bodyPadding: 10,
+scrollable: true,
+animCollapse: false,
+maxLength: 64 * 1024,
+
+cbindData: function(initalConfig) {
+   let me = this;
+
+   if (me.node) {
+   me.url = `/api2/extjs/nodes/${me.node}/config`;
+   me.maxLength = 64 * 1022;
+   }
+
+   return {};
+},
+
+
+run_editor: function() {
+   let me = this;
+   Ext.create('Proxmox.window.NotesEdit', {
+   url: me.url,
+   listeners: {
+   destroy: () => me.load(),
+   },
+   autoShow: true,
+   }).setMaxLength(me.maxLength);
+},
+
+setNotes: function(value) {
+   let me = this;
+   var data = value || '';
+
+   let mdHtml = Proxmox.Markdown.parse(data);
+   me.update(mdHtml);
+
+   if (me.collapsible && me.collapseMode === 'auto') {
+   me.setCollapsed(data === '');
+   }
+},
+
+load: function() {
+   var me = this;
+
+   Proxmox.Utils.API2Request({
+   url: me.url,
+   waitMsgTarget: me,
+   failure: function(response, opts) {
+   me.update(gettext('Error') + " " + response.htmlStatus);
+   me.setCollapsed(false);
+   },
+   success: function(response, opts) {
+   let text = response.result.data.description;
+   me.setNotes(text);
+   },
+   });
+},
+
+listeners: {
+   render: function(c) {
+   var me = this;
+   me.getEl().on('dblclick', me.run_editor, me);
+   },
+   afterlayout: function() {
+   let me = this;
+   if (me.collapsible && !me.getCollapsed() && me.collapseMode === 
'always') {
+   me.setCollapsed(true);
+   me.collapseMode = ''; // only once, on initial load!
+   }
+   },
+},
+
+tools: [{
+   type: 'gear',
+   handler: function() {
+   this.up('panel').run_editor();
+   },
+}],
+
+tbar: {
+   itemId: 'tbar',
+   hidden: true,
+   items: [
+   {
+   text: gettext('Edit'),
+   handler: function() {
+   this.up('panel').run_editor();
+   },
+   },
+   ],
+},
+
+initComponent: function() {
+   const me = this;
+   let type = '';
+
+   if (!me.node) {
+   if (me.pveSelNode.data.id === 'root') {
+   me.url = '/api2/extjs/cluster/options';
+   type = me.pveSelNode.data.type;
+   } else {
+   const nodename = me.pveSelNode.data.node;
+   type = me.pveSelNode.data.type;
+
+   if (!nodename) {
+   throw "no node name specified";
+   }
+
+   if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+   throw 'invalid type specified';
+   }
+
+   const vmid = me.pveSelNode.data.vmid;
+
+   if (!vmid && type !== 'node') {
+   throw "no VM ID specified";
+   }
+
+   me.url = `/ap

[pve-devel] [PATCH manager v3 6/6] ui: move NotesView panel and NotesEdit window to widget kit

2022-03-04 Thread Stefan Sterz
this removes the NotesView panel and NotesEdit and replaces them with
with the version from the widget kit.

Signed-off-by: Stefan Sterz 
---
 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e6e01bd1..af026413 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -84,7 +84,6 @@ JSSRC=
\
panel/BackupJobPrune.js \
panel/HealthWidget.js   \
panel/IPSet.js  \
-   panel/NotesView.js  \
panel/RunningChart.js   \
panel/StatusPanel.js\
panel/GuestStatusView.js\
@@ -102,7 +101,6 @@ JSSRC=  
\
window/FirewallLograteEdit.js   \
window/LoginWindow.js   \
window/Migrate.js   \
-   window/NotesEdit.js \
window/Prune.js \
window/Restore.js   \
window/SafeDestroyGuest.js  \
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 9c54b19d..13ded12e 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -28,7 +28,7 @@ Ext.define('PVE.dc.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 68f80391..52357df8 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -129,7 +129,7 @@ Ext.define('PVE.node.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/panel/GuestSummary.js 
b/www/manager6/panel/GuestSummary.js
index 82cc7a7f..35721419 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.Summary', {
rstore: rstore,
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
flex: 1,
padding: template ? '5' : '0 0 0 5',
itemId: 'notesview',
diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
deleted file mode 100644
index 7c8299d0..
--- a/www/manager6/panel/NotesView.js
+++ /dev/null
@@ -1,129 +0,0 @@
-Ext.define('PVE.panel.NotesView', {
-extend: 'Ext.panel.Panel',
-xtype: 'pveNotesView',
-
-title: gettext("Notes"),
-bodyPadding: 10,
-scrollable: true,
-animCollapse: false,
-maxLength: 64 * 1024,
-
-tbar: {
-   itemId: 'tbar',
-   hidden: true,
-   items: [
-   {
-   text: gettext('Edit'),
-   handler: function() {
-   let view = this.up('panel');
-   view.run_editor();
-   },
-   },
-   ],
-},
-
-run_editor: function() {
-   let me = this;
-   Ext.create('PVE.window.NotesEdit', {
-   pveSelNode: me.pveSelNode,
-   url: me.url,
-   listeners: {
-   destroy: () => me.load(),
-   },
-   autoShow: true,
-   }).setMaxLength(me.maxLength);
-},
-
-load: function() {
-   var me = this;
-
-   Proxmox.Utils.API2Request({
-   url: me.url,
-   waitMsgTarget: me,
-   failure: function(response, opts) {
-   me.update(gettext('Error') + " " + response.htmlStatus);
-   me.setCollapsed(false);
-   },
-   succes

[pve-devel] [PATCH proxmox-backup v3 2/6] fix #3607: docs: add markdown primer from pve to pbs

2022-03-04 Thread Stefan Sterz
this copies the markdown primer from the pve docs to allow access to
it via the help buttons in the gui

Signed-off-by: Stefan Sterz 
---
 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 2 files changed, 179 insertions(+)
 create mode 100644 docs/markdown-primer.rst

diff --git a/docs/index.rst b/docs/index.rst
index daa61249..713b09d8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -50,6 +50,7 @@ in the section entitled "GNU Free Documentation License".
file-formats.rst
backup-protocol.rst
calendarevents.rst
+   markdown-primer.rst
glossary.rst
GFDL.rst
 
diff --git a/docs/markdown-primer.rst b/docs/markdown-primer.rst
new file mode 100644
index ..01ce1d6d
--- /dev/null
+++ b/docs/markdown-primer.rst
@@ -0,0 +1,178 @@
+.. _markdown-primer:
+
+Markdown Primer
+===
+
+  "Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
+  you to write using an easy-to-read, easy-to-write plain text format, then
+  convertit to structurally valid XHTML (or HTML)."
+
+  --  John Gruber, https://daringfireball.net/projects/markdown/
+
+
+The Proxmox Backup Server (PBS) web-interface has support for using Markdown to
+rendering rich text formatting in node and virtual guest notes.
+
+PBS supports CommonMark with most extensions of GFM (GitHub Flavoured 
Markdown),
+like tables or task-lists.
+
+.. _markdown_basics:
+
+Markdown Basics
+---
+
+Note that we only describe the basics here, please search the web for more
+extensive resources, for example on https://www.markdownguide.org/
+
+Headings
+
+
+.. code-block:: md
+
+  # This is a Heading h1
+  ## This is a Heading h2
+  # This is a Heading h5
+
+
+Emphasis
+
+
+Use ``*text*`` or ``_text_`` for emphasis.
+
+Use ``**text**`` or ``__text__`` for bold, heavy-weight text.
+
+Combinations are also possible, for example:
+
+.. code-block:: md
+
+  _You **can** combine them_
+
+
+Links
+~
+
+You can use automatic detection of links, for example,
+``https://forum.proxmox.com/`` would transform it into a clickable link.
+
+You can also control the link text, for example:
+
+.. code-block:: md
+
+  Now, [the part in brackets will be the link 
text](https://forum.proxmox.com/).
+
+Lists
+~
+
+Unordered Lists
+^^^
+
+Use ``*`` or ``-`` for unordered lists, for example:
+
+.. code-block:: md
+
+  * Item 1
+  * Item 2
+  * Item 2a
+  * Item 2b
+
+
+Adding an indentation can be used to created nested lists.
+
+Ordered Lists
+^
+
+.. code-block:: md
+
+  1. Item 1
+  1. Item 2
+  1. Item 3
+1. Item 3a
+1. Item 3b
+
+NOTE: The integer of ordered lists does not need to be correct, they will be 
numbered automatically.
+
+Task Lists
+^^
+
+Task list use a empty box ``[ ]`` for unfinished tasks and a box with an `X` 
for finished tasks.
+
+For example:
+
+
+.. code-block:: md
+
+  - [X] First task already done!
+  - [X] Second one too
+  - [ ] This one is still to-do
+  - [ ] So is this one
+
+Tables
+~~
+
+Tables use the pipe symbol ``|`` to separate columns, and ``-`` to separate the
+table header from the table body, in that separation one can also set the text
+alignment, making one column left-, center-, or right-aligned.
+
+
+.. code-block:: md
+
+  | Left columns  | Right columns |  Some  | More | Cols.| Centering Works Too
+  | - |--:||--|--|:--:|
+  | left foo  | right foo | First  | Row  | Here | >center<   |
+  | left bar  | right bar | Second | Row  | Here | 12345  |
+  | left baz  | right baz | Third  | Row  | Here | Test   |
+  | left zab  | right zab | Fourth | Row  | Here | ☁️☁️☁️  
|
+  | left rab  | right rab | And| Last | Here | The End|
+
+Note that you do not need to align the columns nicely with white space, but 
that makes
+editing tables easier.
+
+Block Quotes
+
+
+You can enter block quotes by prefixing a line with ``>``, similar as in 
plain-text emails.
+
+.. code-block:: md
+
+  > Markdown is a lightweight markup language with plain-text-formatting 
syntax,
+  > created in 2004 by John Gruber with Aaron Swartz.
+  >
+  >> Markdown is often used to format readme files, for writing messages in 
online discussion forums,
+  >> and to create rich text using a plain text editor.
+
+Code and Snippets
+~
+
+You can use backticks to avoid processing for a few word or paragraphs. That 
is useful for
+avoiding that a code or configuration hunk gets mistakenly interpreted as 
markdown.
+
+Inline code
+^^^
+
+Surrounding part of a line with single backticks allows to write code inline,
+for examples:
+
+.. code-block:: md
+
+  This hosts IP address is `10.0.0.1`.
+
+Whole blocks of code
+
+
+For code blocks s

[pve-devel] [PATCH SERIES v4 0/4] add notes to functionality to pbs webui

2022-04-01 Thread Stefan Sterz
adds support for markdown-based notes to pbs. It also refactors the
pve `NotesView` panel and `NotesEdit` window so that we can move it
to the widget toolkit and maintain a single version of the two.
hence, the last commits for proxmox-backup and pve-manager need to be
applied and bumped with or after the toolkit.

changes v4 (thanks @ Thomas Lamprecht):

* several improvements to NotesView
* makes onlineHelp of the NotesEdit window used by NotesView
  configurable

changes v3 (thanks @ Dominik Csapak):

* refactored NotesView and NotesEdit
* removed notes from dashboard
* several javascrpt improvements

changes v2 (thanks @ Wolfgang Bumiller):

* performance improvements when parsing/writing a node configuration
* adjusted multi-line regex to remove superfluous "\s*"
* better formatting of rust code

proxmox-backup:
Stefan Sterz (2):
  fix #3067: docs: add markdown primer from pve to pbs
  fix #3067: ui: add a separate notes view for longer markdown notes

 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 www/Makefile |   1 +
 www/NavigationTree.js|   6 ++
 www/NodeNotes.js |  23 +
 5 files changed, 209 insertions(+)
 create mode 100644 docs/markdown-primer.rst
 create mode 100644 www/NodeNotes.js

widget-toolkit:
Stefan Sterz (1):
  toolkit: add markdown based NotesView and NotesEdit

 src/Makefile|   2 +
 src/panel/NotesView.js  | 149 
 src/window/NotesEdit.js |  38 ++
 3 files changed, 189 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

pve-manager:
Stefan Sterz (1):
  ui: move NotesView panel and NotesEdit window to widget kit

 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.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 v4 2/4] toolkit: add markdown based NotesView and NotesEdit

2022-04-01 Thread Stefan Sterz
adds a universal version of NotesView and NotesEdit to the widget
toolkit that is compatible with pve and pbs. this avoids maintaining
duplicate code in pve and pbs, but since the original versions were
very tightly integrated with pve-manager, changes are required to
make them compatible with pbs. changes include: making the tbar
configurable, setting the url differently in a pbs context, and
allowing the caller to set the onlineHelp field.

Signed-off-by: Stefan Sterz 
---
 src/Makefile|   2 +
 src/panel/NotesView.js  | 149 
 src/window/NotesEdit.js |  38 ++
 3 files changed, 189 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

diff --git a/src/Makefile b/src/Makefile
index abafc2c..dd7729e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -66,6 +66,7 @@ JSSRC=\
panel/ACMEDomains.js\
panel/StatusView.js \
panel/TfaView.js\
+   panel/NotesView.js  \
window/Edit.js  \
window/PasswordEdit.js  \
window/SafeDestroy.js   \
@@ -87,6 +88,7 @@ JSSRC=\
window/AddWebauthn.js   \
window/AddYubico.js \
window/TfaEdit.js   \
+   window/NotesEdit.js \
node/APT.js \
node/APTRepositories.js \
node/NetworkEdit.js \
diff --git a/src/panel/NotesView.js b/src/panel/NotesView.js
new file mode 100644
index 000..d1c902f
--- /dev/null
+++ b/src/panel/NotesView.js
@@ -0,0 +1,149 @@
+Ext.define('Proxmox.panel.NotesView', {
+extend: 'Ext.panel.Panel',
+xtype: 'pmxNotesView',
+mixins: ['Proxmox.Mixin.CBind'],
+
+title: gettext("Notes"),
+bodyPadding: 10,
+scrollable: true,
+animCollapse: false,
+maxLength: 64 * 1024,
+enableTBar: false,
+onlineHelp: 'markdown_basics',
+
+tbar: {
+   itemId: 'tbar',
+   hidden: true,
+   items: [
+   {
+   text: gettext('Edit'),
+   handler: function() {
+   let view = this.up('panel');
+   view.run_editor();
+   },
+   },
+   ],
+},
+
+   cbindData: function(initalConfig) {
+   let me = this;
+   let type = '';
+
+   if (me.node) {
+   me.url = `/api2/extjs/nodes/${me.node}/config`;
+   } else if (me.pveSelNode?.data?.id === 'root') {
+   me.url = '/api2/extjs/cluster/options';
+   type = me.pveSelNode?.data?.type;
+   } else {
+   const nodename = me.pveSelNode?.data?.node;
+   type = me.pveSelNode?.data?.type;
+
+   if (!nodename) {
+   throw "no node name specified";
+   }
+
+   if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+   throw 'invalid type specified';
+   }
+
+   const vmid = me.pveSelNode?.data?.vmid;
+
+   if (!vmid && type !== 'node') {
+   throw "no VM ID specified";
+   }
+
+   me.url = `/api2/extjs/nodes/${nodename}/`;
+
+   // add the type specific path if qemu/lxc and set the backend's 
maxLen
+   if (type === 'qemu' || type === 'lxc') {
+   me.url += `${type}/${vmid}/`;
+   me.maxLength = 8 * 1024;
+   }
+
+   me.url += 'config';
+   }
+
+   me.pveType = type;
+   return {};
+},
+
+run_editor: function() {
+   let me = this;
+   Ext.create('Proxmox.window.NotesEdit', {
+   url: me.url,
+   onlineHelp: me.onlineHelp,
+   listeners: {
+   destroy: () => me.load(),
+   },
+   autoShow: true,
+   }).setMaxLength(me.maxLength);
+},
+
+setNotes: function(value) {
+   let me = this;
+
+   let mdHtml = Proxmox.Markdown.parse(value || '');
+   me.update(mdHtml);
+
+   if (me.collapsible && me.collapseMode === 'auto') {
+   me.setCollapsed(!value);
+   }
+},
+
+load: function() {
+   var me = this;
+
+   Proxmox.Utils.API2Request({
+   url: me.url,
+   waitMsgTarget: me,
+   failure: function(response, opts) {
+   me.update(gettext('Error') + " " + response.htmlStatus);
+   me.setCollapsed(false);
+   },
+   success: ({ result }) => me.setNotes(result.data.description),
+   });
+},
+
+listeners: {
+   render: function(c) {
+   var me = this;
+ 

[pve-devel] [PATCH proxmox-backup v4 3/4] fix #3067: ui: add a separate notes view for longer markdown notes

2022-04-01 Thread Stefan Sterz
since markdown notes might be rather long, this commit adds a tab
similar to pve's datacenter or node notes. requires a bump of the
widget toolkit in order to use the `pmxNotesView`.

Signed-off-by: Stefan Sterz 
---
the maxLength of a note in pbs is chosen to be 1022*64 because the
server allows at most 1024*64 bytes of form data per request, which
are distributed as follows:

equal signs: 2
the word "digest":   7
digest:  64
the word "description":  12
description: 65451

so by setting the limit to 1024*64 some users might encounter an
error telling them that the message body was too large even though the
front-end said the description was fine. i wanted to approximate
the 1024*64 limit here as close as possible so i chose:
65451 / 64 ~ 1022.

note that afaict due to the way maxLength is implemented the limit
will still sometimes not be correct. this is due to character
encodings and how javascript's string length property works.

 www/Makefile  |  1 +
 www/NavigationTree.js |  6 ++
 www/NodeNotes.js  | 23 +++
 3 files changed, 30 insertions(+)
 create mode 100644 www/NodeNotes.js

diff --git a/www/Makefile b/www/Makefile
index 455fbeec..922d8de9 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -98,6 +98,7 @@ JSSRC=
\
datastore/DataStoreList.js  \
ServerStatus.js \
ServerAdministration.js \
+   NodeNotes.js\
Dashboard.js\
${TAPE_UI_FILES}\
NavigationTree.js   \
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 576d05ab..916582ef 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -32,6 +32,12 @@ Ext.define('PBS.store.NavigationStore', {
path: 'pbsDashboard',
leaf: true,
},
+   {
+   text: gettext('Notes'),
+   iconCls: 'fa fa-sticky-note-o',
+   path: 'pbsNodeNotes',
+   leaf: true,
+   },
{
text: gettext('Configuration'),
iconCls: 'fa fa-gears',
diff --git a/www/NodeNotes.js b/www/NodeNotes.js
new file mode 100644
index ..f8b253c4
--- /dev/null
+++ b/www/NodeNotes.js
@@ -0,0 +1,23 @@
+// Needs to be its own xtype for `path` to work in `NavigationTree`
+Ext.define('PBS.NodeNotes', {
+extend: 'Ext.panel.Panel',
+xtype: 'pbsNodeNotes',
+
+scrollable: true,
+layout: 'fit',
+
+items: [
+   {
+   xtype: 'container',
+   layout: 'fit',
+   items: [{
+   xtype: 'pmxNotesView',
+   tools: false,
+   border: false,
+   node: 'localhost',
+   enableTBar: true,
+   maxLength: 1022*64,
+   }],
+   },
+],
+});
-- 
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 proxmox-backup v4 1/4] fix #3067: docs: add markdown primer from pve to pbs

2022-04-01 Thread Stefan Sterz
this copies the markdown primer from the pve docs to allow access to
it via the help buttons in the gui

Signed-off-by: Stefan Sterz 
---
 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 2 files changed, 179 insertions(+)
 create mode 100644 docs/markdown-primer.rst

diff --git a/docs/index.rst b/docs/index.rst
index daa61249..713b09d8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -50,6 +50,7 @@ in the section entitled "GNU Free Documentation License".
file-formats.rst
backup-protocol.rst
calendarevents.rst
+   markdown-primer.rst
glossary.rst
GFDL.rst
 
diff --git a/docs/markdown-primer.rst b/docs/markdown-primer.rst
new file mode 100644
index ..01ce1d6d
--- /dev/null
+++ b/docs/markdown-primer.rst
@@ -0,0 +1,178 @@
+.. _markdown-primer:
+
+Markdown Primer
+===
+
+  "Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
+  you to write using an easy-to-read, easy-to-write plain text format, then
+  convertit to structurally valid XHTML (or HTML)."
+
+  --  John Gruber, https://daringfireball.net/projects/markdown/
+
+
+The Proxmox Backup Server (PBS) web-interface has support for using Markdown to
+rendering rich text formatting in node and virtual guest notes.
+
+PBS supports CommonMark with most extensions of GFM (GitHub Flavoured 
Markdown),
+like tables or task-lists.
+
+.. _markdown_basics:
+
+Markdown Basics
+---
+
+Note that we only describe the basics here, please search the web for more
+extensive resources, for example on https://www.markdownguide.org/
+
+Headings
+
+
+.. code-block:: md
+
+  # This is a Heading h1
+  ## This is a Heading h2
+  # This is a Heading h5
+
+
+Emphasis
+
+
+Use ``*text*`` or ``_text_`` for emphasis.
+
+Use ``**text**`` or ``__text__`` for bold, heavy-weight text.
+
+Combinations are also possible, for example:
+
+.. code-block:: md
+
+  _You **can** combine them_
+
+
+Links
+~
+
+You can use automatic detection of links, for example,
+``https://forum.proxmox.com/`` would transform it into a clickable link.
+
+You can also control the link text, for example:
+
+.. code-block:: md
+
+  Now, [the part in brackets will be the link 
text](https://forum.proxmox.com/).
+
+Lists
+~
+
+Unordered Lists
+^^^
+
+Use ``*`` or ``-`` for unordered lists, for example:
+
+.. code-block:: md
+
+  * Item 1
+  * Item 2
+  * Item 2a
+  * Item 2b
+
+
+Adding an indentation can be used to created nested lists.
+
+Ordered Lists
+^
+
+.. code-block:: md
+
+  1. Item 1
+  1. Item 2
+  1. Item 3
+1. Item 3a
+1. Item 3b
+
+NOTE: The integer of ordered lists does not need to be correct, they will be 
numbered automatically.
+
+Task Lists
+^^
+
+Task list use a empty box ``[ ]`` for unfinished tasks and a box with an `X` 
for finished tasks.
+
+For example:
+
+
+.. code-block:: md
+
+  - [X] First task already done!
+  - [X] Second one too
+  - [ ] This one is still to-do
+  - [ ] So is this one
+
+Tables
+~~
+
+Tables use the pipe symbol ``|`` to separate columns, and ``-`` to separate the
+table header from the table body, in that separation one can also set the text
+alignment, making one column left-, center-, or right-aligned.
+
+
+.. code-block:: md
+
+  | Left columns  | Right columns |  Some  | More | Cols.| Centering Works Too
+  | - |--:||--|--|:--:|
+  | left foo  | right foo | First  | Row  | Here | >center<   |
+  | left bar  | right bar | Second | Row  | Here | 12345  |
+  | left baz  | right baz | Third  | Row  | Here | Test   |
+  | left zab  | right zab | Fourth | Row  | Here | ☁️☁️☁️  
|
+  | left rab  | right rab | And| Last | Here | The End|
+
+Note that you do not need to align the columns nicely with white space, but 
that makes
+editing tables easier.
+
+Block Quotes
+
+
+You can enter block quotes by prefixing a line with ``>``, similar as in 
plain-text emails.
+
+.. code-block:: md
+
+  > Markdown is a lightweight markup language with plain-text-formatting 
syntax,
+  > created in 2004 by John Gruber with Aaron Swartz.
+  >
+  >> Markdown is often used to format readme files, for writing messages in 
online discussion forums,
+  >> and to create rich text using a plain text editor.
+
+Code and Snippets
+~
+
+You can use backticks to avoid processing for a few word or paragraphs. That 
is useful for
+avoiding that a code or configuration hunk gets mistakenly interpreted as 
markdown.
+
+Inline code
+^^^
+
+Surrounding part of a line with single backticks allows to write code inline,
+for examples:
+
+.. code-block:: md
+
+  This hosts IP address is `10.0.0.1`.
+
+Whole blocks of code
+
+
+For code blocks s

[pve-devel] [PATCH manager v4 4/4] ui: move NotesView panel and NotesEdit window to widget kit

2022-04-01 Thread Stefan Sterz
this removes the NotesView panel and NotesEdit and replaces them with
with the version from the widget kit.

Signed-off-by: Stefan Sterz 
---
 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index e6e01bd1..af026413 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -84,7 +84,6 @@ JSSRC=
\
panel/BackupJobPrune.js \
panel/HealthWidget.js   \
panel/IPSet.js  \
-   panel/NotesView.js  \
panel/RunningChart.js   \
panel/StatusPanel.js\
panel/GuestStatusView.js\
@@ -102,7 +101,6 @@ JSSRC=  
\
window/FirewallLograteEdit.js   \
window/LoginWindow.js   \
window/Migrate.js   \
-   window/NotesEdit.js \
window/Prune.js \
window/Restore.js   \
window/SafeDestroyGuest.js  \
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 9c54b19d..13ded12e 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -28,7 +28,7 @@ Ext.define('PVE.dc.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 68f80391..52357df8 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -129,7 +129,7 @@ Ext.define('PVE.node.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/panel/GuestSummary.js 
b/www/manager6/panel/GuestSummary.js
index 82cc7a7f..35721419 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.Summary', {
rstore: rstore,
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
flex: 1,
padding: template ? '5' : '0 0 0 5',
itemId: 'notesview',
diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
deleted file mode 100644
index 7c8299d0..
--- a/www/manager6/panel/NotesView.js
+++ /dev/null
@@ -1,129 +0,0 @@
-Ext.define('PVE.panel.NotesView', {
-extend: 'Ext.panel.Panel',
-xtype: 'pveNotesView',
-
-title: gettext("Notes"),
-bodyPadding: 10,
-scrollable: true,
-animCollapse: false,
-maxLength: 64 * 1024,
-
-tbar: {
-   itemId: 'tbar',
-   hidden: true,
-   items: [
-   {
-   text: gettext('Edit'),
-   handler: function() {
-   let view = this.up('panel');
-   view.run_editor();
-   },
-   },
-   ],
-},
-
-run_editor: function() {
-   let me = this;
-   Ext.create('PVE.window.NotesEdit', {
-   pveSelNode: me.pveSelNode,
-   url: me.url,
-   listeners: {
-   destroy: () => me.load(),
-   },
-   autoShow: true,
-   }).setMaxLength(me.maxLength);
-},
-
-load: function() {
-   var me = this;
-
-   Proxmox.Utils.API2Request({
-   url: me.url,
-   waitMsgTarget: me,
-   failure: function(response, opts) {
-   me.update(gettext('Error') + " " + response.htmlStatus);
-   me.setCollapsed(false);
-   },
-   succes

Re: [pve-devel] [PATCH widget-toolkit v4 2/4] toolkit: add markdown based NotesView and NotesEdit

2022-04-06 Thread Stefan Sterz
I realized that there are some more improvements to be made here, I'll
send an updated version in a bit. Sorry for the inconvenience.

On 01.04.22 12:19, Stefan Sterz wrote:
> adds a universal version of NotesView and NotesEdit to the widget
> toolkit that is compatible with pve and pbs. this avoids maintaining
> duplicate code in pve and pbs, but since the original versions were
> very tightly integrated with pve-manager, changes are required to
> make them compatible with pbs. changes include: making the tbar
> configurable, setting the url differently in a pbs context, and
> allowing the caller to set the onlineHelp field.
> 
> Signed-off-by: Stefan Sterz 
> ---
>  src/Makefile|   2 +
>  src/panel/NotesView.js  | 149 
>  src/window/NotesEdit.js |  38 ++
>  3 files changed, 189 insertions(+)
>  create mode 100644 src/panel/NotesView.js
>  create mode 100644 src/window/NotesEdit.js
> 
> diff --git a/src/Makefile b/src/Makefile
> index abafc2c..dd7729e 100644
> --- a/src/Makefile
> +++ b/src/Makefile
> @@ -66,6 +66,7 @@ JSSRC=  \
>   panel/ACMEDomains.js\
>   panel/StatusView.js \
>   panel/TfaView.js\
> + panel/NotesView.js  \
>   window/Edit.js  \
>   window/PasswordEdit.js  \
>   window/SafeDestroy.js   \
> @@ -87,6 +88,7 @@ JSSRC=  \
>   window/AddWebauthn.js   \
>   window/AddYubico.js \
>   window/TfaEdit.js   \
> + window/NotesEdit.js \
>   node/APT.js \
>   node/APTRepositories.js \
>   node/NetworkEdit.js \
> diff --git a/src/panel/NotesView.js b/src/panel/NotesView.js
> new file mode 100644
> index 000..d1c902f
> --- /dev/null
> +++ b/src/panel/NotesView.js
> @@ -0,0 +1,149 @@
> +Ext.define('Proxmox.panel.NotesView', {
> +extend: 'Ext.panel.Panel',
> +xtype: 'pmxNotesView',
> +mixins: ['Proxmox.Mixin.CBind'],
> +
> +title: gettext("Notes"),
> +bodyPadding: 10,
> +scrollable: true,
> +animCollapse: false,
> +maxLength: 64 * 1024,
> +enableTBar: false,
> +onlineHelp: 'markdown_basics',
> +
> +tbar: {
> + itemId: 'tbar',
> + hidden: true,
> + items: [
> + {
> + text: gettext('Edit'),
> + handler: function() {
> + let view = this.up('panel');
> + view.run_editor();
> + },
> + },
> + ],
> +},
> +
> +   cbindData: function(initalConfig) {
> + let me = this;
> + let type = '';
> +
> + if (me.node) {
> + me.url = `/api2/extjs/nodes/${me.node}/config`;
> + } else if (me.pveSelNode?.data?.id === 'root') {
> + me.url = '/api2/extjs/cluster/options';
> + type = me.pveSelNode?.data?.type;
> + } else {
> + const nodename = me.pveSelNode?.data?.node;
> + type = me.pveSelNode?.data?.type;
> +
> + if (!nodename) {
> + throw "no node name specified";
> + }
> +
> + if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
> + throw 'invalid type specified';
> + }
> +
> + const vmid = me.pveSelNode?.data?.vmid;
> +
> + if (!vmid && type !== 'node') {
> + throw "no VM ID specified";
> + }
> +
> + me.url = `/api2/extjs/nodes/${nodename}/`;
> +
> + // add the type specific path if qemu/lxc and set the backend's 
> maxLen
> + if (type === 'qemu' || type === 'lxc') {
> + me.url += `${type}/${vmid}/`;
> + me.maxLength = 8 * 1024;
> + }
> +
> + me.url += 'config';
> + }
> +
> + me.pveType = type;
> + return {};
> +},
> +
> +run_editor: function() {
> + let me = this;
> + Ext.create('Proxmox.window.NotesEdit', {
> + url: me.url,
> + onlineHelp: me.onlineHelp,
> + listeners: {
> + destroy: () => me.load(),
> + },
> + autoShow: true,
> + }).setMaxLength(me.maxLength);
> +},
> +
> +setNotes: function(value) {
> + let me = this;
> +
> + let mdHtml = Proxmox.Markdown.parse(value || '&#x

[pve-devel] [PATCH proxmox-backup v5 5/5] fix #3067: ui: add a separate notes view for longer markdown notes

2022-04-12 Thread Stefan Sterz
since markdown notes might be rather long, this commit adds a tab
similar to pve's datacenter or node notes. requires a bump of the
widget toolkit in order to use the `pmxNotesView`.

Signed-off-by: Stefan Sterz 
---
i chose the maxLength of a note in pbs to be 1022*64 because the
server allows at most 1024*64 bytes of form data per request, which
are distributed as follows:

equal signs: 2
the word "digest":   7
digest:  64
the word "description":  12
description: 65451

so by setting the limit to 1024*64 some users might encounter an
error telling them that the message body was too large even though the
front-end said the description was fine. i wanted to approximate
the 1024*64 limit here as close as possible so i chose:
65451 / 64 ~ 1022.

note that afaict due to the way maxLength is implemented the frontend
might not report an error when it should. this is due to character
encodings and how javascript's string length property works.

 www/Makefile  |  1 +
 www/NavigationTree.js |  6 ++
 www/NodeNotes.js  | 23 +++
 3 files changed, 30 insertions(+)
 create mode 100644 www/NodeNotes.js

diff --git a/www/Makefile b/www/Makefile
index 455fbeec..922d8de9 100644
--- a/www/Makefile
+++ b/www/Makefile
@@ -98,6 +98,7 @@ JSSRC=
\
datastore/DataStoreList.js  \
ServerStatus.js \
ServerAdministration.js \
+   NodeNotes.js\
Dashboard.js\
${TAPE_UI_FILES}\
NavigationTree.js   \
diff --git a/www/NavigationTree.js b/www/NavigationTree.js
index 576d05ab..916582ef 100644
--- a/www/NavigationTree.js
+++ b/www/NavigationTree.js
@@ -32,6 +32,12 @@ Ext.define('PBS.store.NavigationStore', {
path: 'pbsDashboard',
leaf: true,
},
+   {
+   text: gettext('Notes'),
+   iconCls: 'fa fa-sticky-note-o',
+   path: 'pbsNodeNotes',
+   leaf: true,
+   },
{
text: gettext('Configuration'),
iconCls: 'fa fa-gears',
diff --git a/www/NodeNotes.js b/www/NodeNotes.js
new file mode 100644
index ..f8b253c4
--- /dev/null
+++ b/www/NodeNotes.js
@@ -0,0 +1,23 @@
+// Needs to be its own xtype for `path` to work in `NavigationTree`
+Ext.define('PBS.NodeNotes', {
+extend: 'Ext.panel.Panel',
+xtype: 'pbsNodeNotes',
+
+scrollable: true,
+layout: 'fit',
+
+items: [
+   {
+   xtype: 'container',
+   layout: 'fit',
+   items: [{
+   xtype: 'pmxNotesView',
+   tools: false,
+   border: false,
+   node: 'localhost',
+   enableTBar: true,
+   maxLength: 1022*64,
+   }],
+   },
+],
+});
-- 
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 proxmox-backup v5 0/5] fix 3067: add notes functionality in webui

2022-04-12 Thread Stefan Sterz
adds support for markdown-based notes to pbs. It also refactors the
pve `NotesView` panel and `NotesEdit` window so that we can move it
to the widget toolkit and maintain a single version of the two.
hence, the last commits for proxmox-backup and pve-manager need to be
applied and bumped with or after the toolkit.

changes v5:

* split commit adding NotesEdit and NotesView to widget kit into two
  commits
* several minort improvements to NotesEdit and NotesView

changes v4 (thanks @ Thomas Lamprecht):

* several improvements to NotesView
* makes onlineHelp of the NotesEdit window used by NotesView
  configurable

changes v3 (thanks @ Dominik Csapak):

* refactored NotesView and NotesEdit
* removed notes from dashboard
* several javascrpt improvements

changes v2 (thanks @ Wolfgang Bumiller):

* performance improvements when parsing/writing a node configuration
* adjusted multi-line regex to remove superfluous "\s*"
* better formatting of rust code

Stefan Sterz (2):
  fix #3067: docs: add markdown primer from pve to pbs
  fix #3067: ui: add a separate notes view for longer markdown notes

 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 www/Makefile |   1 +
 www/NavigationTree.js|   6 ++
 www/NodeNotes.js |  23 +
 5 files changed, 209 insertions(+)
 create mode 100644 docs/markdown-primer.rst
 create mode 100644 www/NodeNotes.js

Stefan Sterz (2):
  toolkit: add NotesView panel and NotesEdit window
  toolkit: refactor markdown based NotesView and NotesEdit

 src/Makefile|   2 +
 src/panel/NotesView.js  | 152 
 src/window/NotesEdit.js |  38 ++
 3 files changed, 192 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

Stefan Sterz (1):
  ui: move NotesView panel and NotesEdit window to widget kit

 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.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 v5 3/5] toolkit: refactor markdown based NotesView and NotesEdit

2022-04-12 Thread Stefan Sterz
refactor them to make them more flexible and, thus, usable in pbs.
adds parameters for enabling the TBar, setting the help section in the
editing dialog and cleans up the code in some places

Signed-off-by: Stefan Sterz 
---
 src/panel/NotesView.js  | 135 +++-
 src/window/NotesEdit.js |   4 +-
 2 files changed, 81 insertions(+), 58 deletions(-)

diff --git a/src/panel/NotesView.js b/src/panel/NotesView.js
index 7c8299d..21dbdeb 100644
--- a/src/panel/NotesView.js
+++ b/src/panel/NotesView.js
@@ -1,12 +1,15 @@
-Ext.define('PVE.panel.NotesView', {
+Ext.define('Proxmox.panel.NotesView', {
 extend: 'Ext.panel.Panel',
-xtype: 'pveNotesView',
+xtype: 'pmxNotesView',
+mixins: ['Proxmox.Mixin.CBind'],
 
 title: gettext("Notes"),
 bodyPadding: 10,
 scrollable: true,
 animCollapse: false,
 maxLength: 64 * 1024,
+enableTBar: false,
+onlineHelp: 'markdown_basics',
 
 tbar: {
itemId: 'tbar',
@@ -22,11 +25,55 @@ Ext.define('PVE.panel.NotesView', {
],
 },
 
+cbindData: function(initalConfig) {
+   let me = this;
+   let type = '';
+
+   if (me.node) {
+   me.url = `/api2/extjs/nodes/${me.node}/config`;
+   } else if (me.pveSelNode?.data?.id === 'root') {
+   me.url = '/api2/extjs/cluster/options';
+   type = me.pveSelNode?.data?.type;
+   } else {
+   const nodename = me.pveSelNode?.data?.node;
+   type = me.pveSelNode?.data?.type;
+
+   if (!nodename) {
+   throw "no node name specified";
+   }
+
+   if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+   throw 'invalid type specified';
+   }
+
+   const vmid = me.pveSelNode?.data?.vmid;
+
+   if (!vmid && type !== 'node') {
+   throw "no VM ID specified";
+   }
+
+   me.url = `/api2/extjs/nodes/${nodename}/`;
+
+   // add the type specific path if qemu/lxc and set the backend's 
maxLen
+   if (type === 'qemu' || type === 'lxc') {
+   me.url += `${type}/${vmid}/`;
+   me.maxLength = 8 * 1024;
+   }
+
+   me.url += 'config';
+   }
+
+   me.pveType = type;
+
+   me.load();
+   return {};
+},
+
 run_editor: function() {
let me = this;
-   Ext.create('PVE.window.NotesEdit', {
-   pveSelNode: me.pveSelNode,
+   Ext.create('Proxmox.window.NotesEdit', {
url: me.url,
+   onlineHelp: me.onlineHelp,
listeners: {
destroy: () => me.load(),
},
@@ -34,32 +81,34 @@ Ext.define('PVE.panel.NotesView', {
}).setMaxLength(me.maxLength);
 },
 
+setNotes: function(value = '') {
+   let me = this;
+
+   let mdHtml = Proxmox.Markdown.parse(value);
+   me.update(mdHtml);
+
+   if (me.collapsible && me.collapseMode === 'auto') {
+   me.setCollapsed(!value);
+   }
+},
+
 load: function() {
-   var me = this;
+   let me = this;
 
Proxmox.Utils.API2Request({
url: me.url,
waitMsgTarget: me,
-   failure: function(response, opts) {
+   failure: (response, opts) => {
me.update(gettext('Error') + " " + response.htmlStatus);
me.setCollapsed(false);
},
-   success: function(response, opts) {
-   var data = response.result.data.description || '';
-
-   let mdHTML = Proxmox.Markdown.parse(data);
-   me.update(mdHTML);
-
-   if (me.collapsible && me.collapseMode === 'auto') {
-   me.setCollapsed(data === '');
-   }
-   },
+   success: ({ result }) => me.setNotes(result.data.description),
});
 },
 
 listeners: {
render: function(c) {
-   var me = this;
+   let me = this;
me.getEl().on('dblclick', me.run_editor, me);
},
afterlayout: function() {
@@ -71,49 +120,24 @@ Ext.define('PVE.panel.NotesView', {
},
 },
 
-tools: [{
-   type: 'gear',
-   handler: function() {
-   let view = this.up('panel');
-   view.run_editor();
+tools: [
+   {
+   type: 'gear',
+   handler: function() {
+   let view = this.up('panel');
+   view.run_editor();
+   },
},
-}],
+],
 
 initComponent: function() {
-   const me = this;

[pve-devel] [PATCH manager v5 4/5] ui: move NotesView panel and NotesEdit window to widget kit

2022-04-12 Thread Stefan Sterz
this removes the NotesView panel and NotesEdit and replaces them with
with the version from the widget kit. requires a bump of the widget
toolkit.

Signed-off-by: Stefan Sterz 
---
 www/manager6/Makefile  |   2 -
 www/manager6/dc/Config.js  |   2 +-
 www/manager6/node/Config.js|   2 +-
 www/manager6/panel/GuestSummary.js |   2 +-
 www/manager6/panel/NotesView.js| 129 -
 www/manager6/window/NotesEdit.js   |  38 -
 6 files changed, 3 insertions(+), 172 deletions(-)
 delete mode 100644 www/manager6/panel/NotesView.js
 delete mode 100644 www/manager6/window/NotesEdit.js

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index d488c3a8..2c7b1e70 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -84,7 +84,6 @@ JSSRC=
\
panel/BackupJobPrune.js \
panel/HealthWidget.js   \
panel/IPSet.js  \
-   panel/NotesView.js  \
panel/RunningChart.js   \
panel/StatusPanel.js\
panel/GuestStatusView.js\
@@ -102,7 +101,6 @@ JSSRC=  
\
window/FirewallLograteEdit.js   \
window/LoginWindow.js   \
window/Migrate.js   \
-   window/NotesEdit.js \
window/Prune.js \
window/Restore.js   \
window/SafeDestroyGuest.js  \
diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 9c54b19d..13ded12e 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -28,7 +28,7 @@ Ext.define('PVE.dc.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 68f80391..52357df8 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -129,7 +129,7 @@ Ext.define('PVE.node.Config', {
itemId: 'summary',
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
diff --git a/www/manager6/panel/GuestSummary.js 
b/www/manager6/panel/GuestSummary.js
index 82cc7a7f..35721419 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -40,7 +40,7 @@ Ext.define('PVE.qemu.Summary', {
rstore: rstore,
},
{
-   xtype: 'pveNotesView',
+   xtype: 'pmxNotesView',
flex: 1,
padding: template ? '5' : '0 0 0 5',
itemId: 'notesview',
diff --git a/www/manager6/panel/NotesView.js b/www/manager6/panel/NotesView.js
deleted file mode 100644
index 7c8299d0..
--- a/www/manager6/panel/NotesView.js
+++ /dev/null
@@ -1,129 +0,0 @@
-Ext.define('PVE.panel.NotesView', {
-extend: 'Ext.panel.Panel',
-xtype: 'pveNotesView',
-
-title: gettext("Notes"),
-bodyPadding: 10,
-scrollable: true,
-animCollapse: false,
-maxLength: 64 * 1024,
-
-tbar: {
-   itemId: 'tbar',
-   hidden: true,
-   items: [
-   {
-   text: gettext('Edit'),
-   handler: function() {
-   let view = this.up('panel');
-   view.run_editor();
-   },
-   },
-   ],
-},
-
-run_editor: function() {
-   let me = this;
-   Ext.create('PVE.window.NotesEdit', {
-   pveSelNode: me.pveSelNode,
-   url: me.url,
-   listeners: {
-   destroy: () => me.load(),
-   },
-   autoShow: true,
-   }).setMaxLength(me.maxLength);
-},
-
-load: function() {
-   var me = this;
-
-   Proxmox.Utils.API2Request({
-   url: me.url,
-   waitMsgTarget: me,
-   failure: function(response, opts) {
-   me.update(gettext('Error') + " " + response.htmlStatus);
-   me.setCollapsed(false);
-   },
-   succes

[pve-devel] [PATCH widget-toolkit v5 2/5] toolkit: add NotesView panel and NotesEdit window

2022-04-12 Thread Stefan Sterz
move them here from pve so we can maintain them across several
products

Signed-off-by: Stefan Sterz 
---
 src/Makefile|   2 +
 src/panel/NotesView.js  | 129 
 src/window/NotesEdit.js |  38 
 3 files changed, 169 insertions(+)
 create mode 100644 src/panel/NotesView.js
 create mode 100644 src/window/NotesEdit.js

diff --git a/src/Makefile b/src/Makefile
index abafc2c..dd7729e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -66,6 +66,7 @@ JSSRC=\
panel/ACMEDomains.js\
panel/StatusView.js \
panel/TfaView.js\
+   panel/NotesView.js  \
window/Edit.js  \
window/PasswordEdit.js  \
window/SafeDestroy.js   \
@@ -87,6 +88,7 @@ JSSRC=\
window/AddWebauthn.js   \
window/AddYubico.js \
window/TfaEdit.js   \
+   window/NotesEdit.js \
node/APT.js \
node/APTRepositories.js \
node/NetworkEdit.js \
diff --git a/src/panel/NotesView.js b/src/panel/NotesView.js
new file mode 100644
index 000..7c8299d
--- /dev/null
+++ b/src/panel/NotesView.js
@@ -0,0 +1,129 @@
+Ext.define('PVE.panel.NotesView', {
+extend: 'Ext.panel.Panel',
+xtype: 'pveNotesView',
+
+title: gettext("Notes"),
+bodyPadding: 10,
+scrollable: true,
+animCollapse: false,
+maxLength: 64 * 1024,
+
+tbar: {
+   itemId: 'tbar',
+   hidden: true,
+   items: [
+   {
+   text: gettext('Edit'),
+   handler: function() {
+   let view = this.up('panel');
+   view.run_editor();
+   },
+   },
+   ],
+},
+
+run_editor: function() {
+   let me = this;
+   Ext.create('PVE.window.NotesEdit', {
+   pveSelNode: me.pveSelNode,
+   url: me.url,
+   listeners: {
+   destroy: () => me.load(),
+   },
+   autoShow: true,
+   }).setMaxLength(me.maxLength);
+},
+
+load: function() {
+   var me = this;
+
+   Proxmox.Utils.API2Request({
+   url: me.url,
+   waitMsgTarget: me,
+   failure: function(response, opts) {
+   me.update(gettext('Error') + " " + response.htmlStatus);
+   me.setCollapsed(false);
+   },
+   success: function(response, opts) {
+   var data = response.result.data.description || '';
+
+   let mdHTML = Proxmox.Markdown.parse(data);
+   me.update(mdHTML);
+
+   if (me.collapsible && me.collapseMode === 'auto') {
+   me.setCollapsed(data === '');
+   }
+   },
+   });
+},
+
+listeners: {
+   render: function(c) {
+   var me = this;
+   me.getEl().on('dblclick', me.run_editor, me);
+   },
+   afterlayout: function() {
+   let me = this;
+   if (me.collapsible && !me.getCollapsed() && me.collapseMode === 
'always') {
+   me.setCollapsed(true);
+   me.collapseMode = ''; // only once, on initial load!
+   }
+   },
+},
+
+tools: [{
+   type: 'gear',
+   handler: function() {
+   let view = this.up('panel');
+   view.run_editor();
+   },
+}],
+
+initComponent: function() {
+   const me = this;
+   const type = me.pveSelNode.data.type;
+
+   if (me.pveSelNode.data.id === 'root') {
+   me.url = '/api2/extjs/cluster/options';
+   } else {
+   const nodename = me.pveSelNode.data.node;
+   if (!nodename) {
+   throw "no node name specified";
+   }
+
+   if (!Ext.Array.contains(['node', 'qemu', 'lxc'], type)) {
+   throw 'invalid type specified';
+   }
+
+   const vmid = me.pveSelNode.data.vmid;
+   if (!vmid && type !== 'node') {
+   throw "no VM ID specified";
+   }
+
+   me.url = `/api2/extjs/nodes/${nodename}/`;
+
+   // add the type specific path if qemu/lxc and set the backend's 
maxLen
+   if (type === 'qemu' || type === 'lxc') {
+   me.url += `${type}/${vmid}/`;
+   me.maxLength = 8 * 1024;
+   }
+   me.url += 'config';
+   }
+
+   me.callParent();
+   if (type === 'node' || type === '') { // '' is

[pve-devel] [PATCH proxmox-backup v5 1/5] fix #3067: docs: add markdown primer from pve to pbs

2022-04-12 Thread Stefan Sterz
this copies the markdown primer from the pve docs to allow access to
it via the help buttons in the gui

Signed-off-by: Stefan Sterz 
---
 docs/index.rst   |   1 +
 docs/markdown-primer.rst | 178 +++
 2 files changed, 179 insertions(+)
 create mode 100644 docs/markdown-primer.rst

diff --git a/docs/index.rst b/docs/index.rst
index daa61249..713b09d8 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -50,6 +50,7 @@ in the section entitled "GNU Free Documentation License".
file-formats.rst
backup-protocol.rst
calendarevents.rst
+   markdown-primer.rst
glossary.rst
GFDL.rst
 
diff --git a/docs/markdown-primer.rst b/docs/markdown-primer.rst
new file mode 100644
index ..01ce1d6d
--- /dev/null
+++ b/docs/markdown-primer.rst
@@ -0,0 +1,178 @@
+.. _markdown-primer:
+
+Markdown Primer
+===
+
+  "Markdown is a text-to-HTML conversion tool for web writers. Markdown allows
+  you to write using an easy-to-read, easy-to-write plain text format, then
+  convertit to structurally valid XHTML (or HTML)."
+
+  --  John Gruber, https://daringfireball.net/projects/markdown/
+
+
+The Proxmox Backup Server (PBS) web-interface has support for using Markdown to
+rendering rich text formatting in node and virtual guest notes.
+
+PBS supports CommonMark with most extensions of GFM (GitHub Flavoured 
Markdown),
+like tables or task-lists.
+
+.. _markdown_basics:
+
+Markdown Basics
+---
+
+Note that we only describe the basics here, please search the web for more
+extensive resources, for example on https://www.markdownguide.org/
+
+Headings
+
+
+.. code-block:: md
+
+  # This is a Heading h1
+  ## This is a Heading h2
+  # This is a Heading h5
+
+
+Emphasis
+
+
+Use ``*text*`` or ``_text_`` for emphasis.
+
+Use ``**text**`` or ``__text__`` for bold, heavy-weight text.
+
+Combinations are also possible, for example:
+
+.. code-block:: md
+
+  _You **can** combine them_
+
+
+Links
+~
+
+You can use automatic detection of links, for example,
+``https://forum.proxmox.com/`` would transform it into a clickable link.
+
+You can also control the link text, for example:
+
+.. code-block:: md
+
+  Now, [the part in brackets will be the link 
text](https://forum.proxmox.com/).
+
+Lists
+~
+
+Unordered Lists
+^^^
+
+Use ``*`` or ``-`` for unordered lists, for example:
+
+.. code-block:: md
+
+  * Item 1
+  * Item 2
+  * Item 2a
+  * Item 2b
+
+
+Adding an indentation can be used to created nested lists.
+
+Ordered Lists
+^
+
+.. code-block:: md
+
+  1. Item 1
+  1. Item 2
+  1. Item 3
+1. Item 3a
+1. Item 3b
+
+NOTE: The integer of ordered lists does not need to be correct, they will be 
numbered automatically.
+
+Task Lists
+^^
+
+Task list use a empty box ``[ ]`` for unfinished tasks and a box with an `X` 
for finished tasks.
+
+For example:
+
+
+.. code-block:: md
+
+  - [X] First task already done!
+  - [X] Second one too
+  - [ ] This one is still to-do
+  - [ ] So is this one
+
+Tables
+~~
+
+Tables use the pipe symbol ``|`` to separate columns, and ``-`` to separate the
+table header from the table body, in that separation one can also set the text
+alignment, making one column left-, center-, or right-aligned.
+
+
+.. code-block:: md
+
+  | Left columns  | Right columns |  Some  | More | Cols.| Centering Works Too
+  | - |--:||--|--|:--:|
+  | left foo  | right foo | First  | Row  | Here | >center<   |
+  | left bar  | right bar | Second | Row  | Here | 12345  |
+  | left baz  | right baz | Third  | Row  | Here | Test   |
+  | left zab  | right zab | Fourth | Row  | Here | ☁️☁️☁️  
|
+  | left rab  | right rab | And| Last | Here | The End|
+
+Note that you do not need to align the columns nicely with white space, but 
that makes
+editing tables easier.
+
+Block Quotes
+
+
+You can enter block quotes by prefixing a line with ``>``, similar as in 
plain-text emails.
+
+.. code-block:: md
+
+  > Markdown is a lightweight markup language with plain-text-formatting 
syntax,
+  > created in 2004 by John Gruber with Aaron Swartz.
+  >
+  >> Markdown is often used to format readme files, for writing messages in 
online discussion forums,
+  >> and to create rich text using a plain text editor.
+
+Code and Snippets
+~
+
+You can use backticks to avoid processing for a few word or paragraphs. That 
is useful for
+avoiding that a code or configuration hunk gets mistakenly interpreted as 
markdown.
+
+Inline code
+^^^
+
+Surrounding part of a line with single backticks allows to write code inline,
+for examples:
+
+.. code-block:: md
+
+  This hosts IP address is `10.0.0.1`.
+
+Whole blocks of code
+
+
+For code blocks s

[pve-devel] [PATCH pve-cluster] cluster config: mark qdevice end point as protected

2022-05-11 Thread Stefan Sterz
this allows the end point to retrieve data from the qdevice properly
by leveraging pve-daemon. fixes an issue where the api would return an
empty object.

Signed-off-by: Stefan Sterz 
---
 data/PVE/API2/ClusterConfig.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/data/PVE/API2/ClusterConfig.pm b/data/PVE/API2/ClusterConfig.pm
index 5a6a1ac..e7efe37 100644
--- a/data/PVE/API2/ClusterConfig.pm
+++ b/data/PVE/API2/ClusterConfig.pm
@@ -661,6 +661,7 @@ __PACKAGE__->register_method ({
 name => 'status',
 path => 'qdevice',
 method => 'GET',
+protected => 1,
 description => 'Get QDevice status',
 permissions => {
check => ['perm', '/', [ 'Sys.Audit' ]],
-- 
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] limit zfs arc: add '-k all' to 'update-initramfs' command

2022-06-23 Thread Stefan Sterz
add '-k all' to avoid confusion when older kernels are pinned or
users switch between installed kernel versions

Signed-off-by: Stefan Sterz 
---
 local-zfs.adoc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/local-zfs.adoc b/local-zfs.adoc
index ab0f6ad..2dc25fd 100644
--- a/local-zfs.adoc
+++ b/local-zfs.adoc
@@ -496,7 +496,7 @@ If your root file system is ZFS, you must update your 
initramfs every
 time this value changes:
 
 
-# update-initramfs -u
+# update-initramfs -u -k all
 
 
 You *must reboot* to activate these changes.
-- 
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 manager] fix: make 'ceph-volume' conditional on quincy install

2022-07-04 Thread Stefan Sterz
when installing non-quincy versions, 'ceph-volume' is not contained in
the respective repositories and, thus, the install process would fail.

Signed-off-by: Stefan Sterz 
---
tested this by installing ceph pacific and quincy, but my setup wasn't
really clean so i ran into some unrelated issues.

 PVE/CLI/pveceph.pm | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
index a85df130..8e6c8667 100755
--- a/PVE/CLI/pveceph.pm
+++ b/PVE/CLI/pveceph.pm
@@ -176,13 +176,16 @@ __PACKAGE__->register_method ({
my @ceph_packages = qw(
ceph
ceph-common
-   ceph-volume
ceph-mds
ceph-fuse
gdisk
nvme-cli
);
 
+   if ($cephver eq 'quincy') {
+   push @ceph_packages, 'ceph-volume';
+   }
+
print "start installation\n";
 
# this flag helps to determine when apt is actually done installing 
(vs. partial extracing)
-- 
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 manager] fix: make 'ceph-volume' conditional on quincy install

2022-07-04 Thread Stefan Sterz
On 7/4/22 17:25, Aaron Lauterer wrote:
> With pve-manager 7.2-6, installing pacific will fail very qickly, as
> the package 'ceph-volume' cannot be found.
> 
> Tested this patch by installing pacific and quincy.
> 
> One comment inline
> 
> Tested-By: Aaron Lauterer 
> 
> On 7/4/22 17:05, Stefan Sterz wrote:
>> when installing non-quincy versions, 'ceph-volume' is not contained in
>> the respective repositories and, thus, the install process would fail.
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>> tested this by installing ceph pacific and quincy, but my setup wasn't
>> really clean so i ran into some unrelated issues.
>>
>>   PVE/CLI/pveceph.pm | 5 -
>>   1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
>> index a85df130..8e6c8667 100755
>> --- a/PVE/CLI/pveceph.pm
>> +++ b/PVE/CLI/pveceph.pm
>> @@ -176,13 +176,16 @@ __PACKAGE__->register_method ({
>>   my @ceph_packages = qw(
>>   ceph
>>   ceph-common
>> -    ceph-volume
>>   ceph-mds
>>   ceph-fuse
>>   gdisk
>>   nvme-cli
>>   );
>>   +    if ($cephver eq 'quincy') {
> Wouldn't it be better to check if we are not installing octopus &
> pacific? Then it will work for any newer Ceph version as well. Once we
> do not support octopus and pacific anymore, we can add 'ceph-volume'
> unconditionally to the list of packages to install.
> 

yeah that sounds sensible, give me a minute :)

>> +    push @ceph_packages, 'ceph-volume';
>> +    }
>> +
>>   print "start installation\n";
>>     # this flag helps to determine when apt is actually done
>> installing (vs. partial extracing)



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


[pve-devel] [PATCH manager v2] fix: make 'ceph-volume' conditional on quincy install

2022-07-04 Thread Stefan Sterz
when installing non-quincy versions, 'ceph-volume' is not contained in
the respective repositories and, thus, the install process would fail.

Signed-off-by: Stefan Sterz 
---
tested this by installing octopus, pacific and quincy. same issues as
before.

 PVE/CLI/pveceph.pm | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/PVE/CLI/pveceph.pm b/PVE/CLI/pveceph.pm
index a85df130..5c21bf7e 100755
--- a/PVE/CLI/pveceph.pm
+++ b/PVE/CLI/pveceph.pm
@@ -176,13 +176,17 @@ __PACKAGE__->register_method ({
my @ceph_packages = qw(
ceph
ceph-common
-   ceph-volume
ceph-mds
ceph-fuse
gdisk
nvme-cli
);
 
+   # when installing versions older than quincy, 'ceph-volume' does not 
exists. don't include it
+   if ($cephver ne 'octopus' and $cephver ne 'pacific') {
+   push @ceph_packages, 'ceph-volume';
+   }
+
print "start installation\n";
 
# this flag helps to determine when apt is actually done installing 
(vs. partial extracing)
-- 
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 manager 1/2] fix: api2: add return type to nodes/{node}/execute endpoint

2022-07-27 Thread Stefan Sterz
since this was missing a proper return type definition the api viewer
couldn't display the endpoint (`retinfs.items` was undefined). also
the `pvesh` command would complain that it cannot properly format the
return type because the variable `$item_type` in `CLIFormatter.pm` was
not defined.

Signed-off-by: Stefan Sterz 
---
 PVE/API2/Nodes.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index 655493a3..ef946301 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -438,8 +438,9 @@ __PACKAGE__->register_method({
 },
 returns => {
type => 'array',
-   properties => {
-
+   items => {
+   type => "object",
+   properties => {},
},
 },
 code => sub {
-- 
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 manager 2/2] api2: use JSONSchema to validate commands for "nodes/{node}/execute"

2022-07-27 Thread Stefan Sterz
this also makes it more explicit what the different values should be

Signed-off-by: Stefan Sterz 
---
not sure how sensible this is because most of the information here
won't show up in the api viewer. i couldn't figure out how to make it
show up and not make breaking changes to the endpoint or change how
the api definition hash is handled.

fabian gruenbichler and i also discussed off list that this is kind of
redudant functionality as you can likely just call multiple api
endpoints from whatever script/program/client you are using anyway
instead of using this limited and flawed endpoint. perhaps the was a
reason for this before tokens existed?

so maybe we should either drop it in pve 8 or let it accept proper
json not just "a string that when parsed as json needs to be of this
format". i.e. accept an array of objects here instead of a string.

it has also confused users in the past already, e.g. see:
https://forum.proxmox.com/threads/execute-command-in-node-with-api.112290/

 PVE/API2/Nodes.pm | 51 +--
 1 file changed, 45 insertions(+), 6 deletions(-)

diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
index ef946301..5cc9111d 100644
--- a/PVE/API2/Nodes.pm
+++ b/PVE/API2/Nodes.pm
@@ -66,6 +66,49 @@ eval {
 
 use base qw(PVE::RESTHandler);
 
+PVE::JSONSchema::register_format('pve-command-batch', \&verify_command_batch);
+sub verify_command_batch {
+my ($value, $noerr) = @_;
+my $commands = eval { decode_json($value); };
+
+return undef if $noerr && $@;
+die "commands param did not contain valid JSON: $@" if $@;
+
+eval {
+   PVE::JSONSchema::validate($commands, {
+   description => "An array of objects describing endpoints, methods 
and arguments.",
+   type => "array",
+   items => {
+   type => "object",
+   properties => {
+   path => {
+   description => "A relative path to an API endpoint on 
this node.",
+   type => "string",
+   optional => 0,
+   },
+   method => {
+   description => "A method related to the API endpoint 
(GET, POST etc.).",
+   type => "string",
+   pattern => "(GET|POST|PUT|DELETE)",
+   optional => 0,
+   },
+   args => {
+   description => "A set of parameter names and their 
values.",
+   type => "object",
+   optional => 1,
+   },
+   },
+   }
+   });
+   };
+
+   return $commands if !$@;
+
+   return undef if $noerr;
+
+   die "commands is not a valid array of commands: $@";
+}
+
 __PACKAGE__->register_method ({
 subclass => "PVE::API2::Qemu",
 path => 'qemu',
@@ -433,6 +476,7 @@ __PACKAGE__->register_method({
commands => {
description => "JSON encoded array of commands.",
type => "string",
+   format => "pve-command-batch",
}
},
 },
@@ -449,16 +493,11 @@ __PACKAGE__->register_method({
 
my $rpcenv = PVE::RPCEnvironment::get();
my $user = $rpcenv->get_user();
-
+   # just parse the json again, it should already be validated
my $commands = eval { decode_json($param->{commands}); };
 
-   die "commands param did not contain valid JSON: $@" if $@;
-   die "commands is not an array" if ref($commands) ne "ARRAY";
-
 foreach my $cmd (@$commands) {
eval {
-   die "$cmd is not a valid command" if (ref($cmd) ne "HASH" || 
!$cmd->{path} || !$cmd->{method});
-
$cmd->{args} //= {};
 
my $path = "nodes/$param->{node}/$cmd->{path}";
-- 
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] fix: toolkit: make email regex pattern match pve-common

2022-09-07 Thread Stefan Sterz
`proxmoxMail` used its own regex pattern to validate emails. that
meant certain email addresses were rejected by the front-end that
were accepted by the backend that uses the functionality from
`pve-common`. examples include the following:

- "u...@host.test-tld"
- "user-@host.testtld"
- "user@host"

reported on the forum: 
https://forum.proxmox.com/threads/gui-bugulance-using-the-user-add-gui-interface.114743/

Signed-off-by: Stefan Sterz 
---
note that there are many many regex patterns that could be used
(e.g.: [1]). im partial to w3c's approach [2], mainly because it's
likely to be widely used, while being fairly simple and compatible
with perl and javascript.

[1]: https://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
[2]: https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address

 src/Toolkit.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Toolkit.js b/src/Toolkit.js
index ad64f89..c730374 100644
--- a/src/Toolkit.js
+++ b/src/Toolkit.js
@@ -131,9 +131,9 @@ Ext.apply(Ext.form.field.VTypes, {
 },
 DnsNameOrWildcardText: gettext('This is not a valid DNS name'),
 
-// workaround for https://www.sencha.com/forum/showthread.php?302150
+// email regex used by pve-common
 proxmoxMail: function(v) {
-return 
(/^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,63}$/).test(v);
+return 
(/^[\w+-~]+(\.[\w+-~]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/).test(v);
 },
 proxmoxMailText: gettext('Example') + ": u...@example.com",
 
-- 
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] [pmg-devel] [PATCH pmg-api v2 5/7] revised task log download function in the PMG backend

2022-09-08 Thread Stefan Sterz
On 9/7/22 10:56, Daniel Tschlatscher wrote:
> With the newly added button in the tasklog the implementation for the
> PMG server needs to be adapted. I saw an opportunity here to clear
> some redundant code for displaying the tasklog and replace it with a
> call to dump_logfile(), akin to how this is handled in pve-manager.
> 
> The tasklog download functionality now streams the file by invoking
> the newly created function in pve-common.
> 
> Signed-off-by: Daniel Tschlatscher 
> ---
>  src/PMG/API2/Tasks.pm | 34 +++---
>  1 file changed, 11 insertions(+), 23 deletions(-)
> 
> diff --git a/src/PMG/API2/Tasks.pm b/src/PMG/API2/Tasks.pm
> index 598fb4d..0fd3780 100644
> --- a/src/PMG/API2/Tasks.pm
> +++ b/src/PMG/API2/Tasks.pm
> @@ -5,6 +5,7 @@ use warnings;
>  use POSIX;
>  use IO::File;
>  use File::ReadBackwards;
> +use File::stat;
>  use PVE::Tools;
>  use PVE::SafeSyslog;
>  use PVE::RESTHandler;
> @@ -272,33 +273,20 @@ __PACKAGE__->register_method({
>  
>   my $restenv = PMG::RESTEnvironment->get();
>  
> - my $fh = IO::File->new($filename, "r");
> - raise_param_exc({ upid => "no such task - unable to open file - $!" }) 
> if !$fh;
> + my $start = $param->{start} // 0;
> + my $limit = $param->{limit} // 50;
>  
> - my $start = $param->{start} || 0;
> - my $limit = $param->{limit} || 50;
> - my $count = 0;
> - my $line;
> - while (defined ($line = <$fh>)) {
> - next if $count++ < $start;
> - next if $limit <= 0;
> - chomp $line;
> - push @$lines, { n => $count, t => $line};
> - $limit--;
> - }
> + if ($limit == 0) {
> + # TCP Max Transfer Unit size is 1500, compression for lower numbers 
> has no effect
> + my $use_compression = stat($filename)->size > 1500;
> + return PVE::Tools::stream_logfile($filename, $param->{upid}, 
> $use_compression);

I am pretty sure that should be `stream_file` and not `stream_logfile`.
We've already discussed this off list, but I wanted to document it here too.

> + } else {
> + my ($count, $lines) = PVE::Tools::dump_logfile($filename, $start, 
> $limit);
>  
> - close($fh);
> + $restenv->set_result_attrib('total', $count);
>  
> - # HACK: ExtJS store.guaranteeRange() does not like empty array
> - # so we add a line
> - if (!$count) {
> - $count++;
> - push @$lines, { n => $count, t => "no content"};
> + return $lines;
>   }
> -
> - $restenv->set_result_attrib('total', $count);
> -
> - return $lines;
>  }});
>  
>  



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



Re: [pve-devel] [pmg-devel] [PATCH http/common/manager/wt/backup/pmg v2] fix: #3971 Tasklog download button

2022-09-08 Thread Stefan Sterz
On 9/7/22 10:56, Daniel Tschlatscher wrote:
> This patch series' aim is to add a download button in the tasklog-
> viewer GUI so that users may access all parts of the tasklog more
> easily (The tasklog-viewer only displays 50 lines at a time).
> 
> For this change in the GUI (proxmox-widget-toolkit) there were revised
> implementations for all backends (PVE, PMG and PBS) needed.
> Now, when the parameter 'limit' for the /log API call is set to '0',
> the backends will stream the file rather than returning a JSON array
> with the corresponding lines. (Beforehand, it would return 0 lines)
> 
> I initially included a number of patches aimed at refactoring
> redundant implementations of downloading a file via a button click.
> However, after talking with Sterzy, Dominik and Aaron a bit about
> it, I decided to only send the "core" task log download patch series
> now, because the refactoring depends on the changes made in widget-
> toolkit, but is done in the same repositories as the backend patches.
> This would make both reviewing and applying them more confusing, and
> the refactoring patches are "a step removed" anyway from this patch
> series. Therefore, I am going to send a separate patch series for them
> later instead.
> 
> 
> During the implementation of the file stream download I found a bug
> concerning chromium browsers because of which downloads "randomly"
> fail.
> The problem was, when implementing the download through an html a tag
> and setting its property "download" to anything, (even undefined)
> with a not imported self-signed certificate, the download will fail
> once the SSL connection is reset.
> In my testing this was the case after about 5 seconds. This problem is
> especially pronounced in the PMG as there are less background calls in
> contrast to the PVE. The PBS, however, does not seem to suffer this
> error at all, because the SSL handshake timeout seems to not run out.
>  
> Without the 'download' attribute you can't set the filename though.
> The file will only have a proper name if the server adds the correct
> 'content-disposition' header. A few calls to the 'downloadAsFile'
> function set the filename anyway, because in most cases the browser
> frontend is making enough polling calls so that the SSL handshake
> does not have to be executed for the download. (That is also why it
> probably did not come up before)
> This problem does not apply in Firefox as far as I could tell.
> 
> See https://bugs.chromium.org/p/chromium/issues/detail?id=993362 for
> more information on this.
> 
> -- Changes from v1 --
> * Rewrote commit messages and cover letter
> * Got rid of some refactoring which were initially included
>   (going to send as own patch series later)
> * Rebased to current repository versions
> 
> 
> Daniel Tschlatscher (1):
>   make tasklog downloadable in the backup server backend
> 
>  src/api2/node/tasks.rs | 159 ++---
>  4 files changed, 107 insertions(+), 79 deletions(-)
> 
> Daniel Tschlatscher (1):
>   stream file method for PMG and PVE
> 
>  src/PVE/Tools.pm | 28 
>  1 file changed, 28 insertions(+)
>  
> Daniel Tschlatscher (1):
>   acknowledge content-disposition header
> 
>  src/PVE/APIServer/AnyEvent.pm | 3 +++
>  1 file changed, 3 insertions(+)
>  
> Daniel Tschlatscher (1):
>   Revised task log API call when parameter 'limit' is 0
> 
>  PVE/API2/Tasks.pm | 13 ++---
>  3 files changed, 15 insertions(+), 24 deletions(-)
>  
> Daniel Tschlatscher (1):
>   revised task log download function in the PMG backend
> 
>  src/PMG/API2/Tasks.pm | 34 +++---
>  1 file changed, 11 insertions(+), 23 deletions(-)
> 
> Daniel Tschlatscher (3):
>   Source file download call in central function
>   add task log download button in TaskViewer
> 
>  src/Utils.js  | 13 +
>  src/window/TaskViewer.js  | 17 +++--
>  src/window/FileBrowser.js | 11 +--
>  3 files changed, 38 insertions(+), 8 deletions(-)
> 

Other than one bug in `pmg-api` (see my other email) this series seems
to work as intended. The bug in `pmg-api` is fixed fairly easily by just
calling the right function and I tested that locally already. So unless
there are other considerations:

Tested-by: Stefan Sterz 


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



[pve-devel] [PATCH manager] ui: remove ceph-mgr pools from rbd pool selection

2022-10-12 Thread Stefan Sterz
when using a hyper-converged cluster it was previously possible to add
the pool used by the ceph-mgr modules (".mgr" since quincy or
"device_health_metrics" previously) as an RBD storage. this would lead
to all kinds of errors when that storage was used (e.g.: VMs missing
their disks after a migration). hence, filter these pools from the
list of available pools.

Signed-off-by: Stefan Sterz 
---
 www/manager6/form/CephPoolSelector.js | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/CephPoolSelector.js 
b/www/manager6/form/CephPoolSelector.js
index 5b96398d..eabb04ef 100644
--- a/www/manager6/form/CephPoolSelector.js
+++ b/www/manager6/form/CephPoolSelector.js
@@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
throw "no nodename given";
}
 
+   let filterCephMgrPools = (item) => {
+   let name = item.data.pool_name;
+   return name !== ".mgr" && name !== "device_health_metrics";
+   };
+
var store = Ext.create('Ext.data.Store', {
fields: ['name'],
sorters: 'name',
+   filters: [
+   filterCephMgrPools,
+   ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
@@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
 
store.load({
callback: function(rec, op, success) {
-   if (success && rec.length > 0) {
-   me.select(rec[0]);
+   let filteredRec = rec.filter(filterCephMgrPools);
+
+   if (success && filteredRec.length > 0) {
+   me.select(filteredRec[0]);
}
},
});
-- 
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 manager] ui: remove ceph-mgr pools from rbd pool selection

2022-10-14 Thread Stefan Sterz
On 10/13/22 16:11, Alwin Antreich wrote:
> On October 12, 2022 3:22:18 PM GMT+02:00, Stefan Sterz  
> wrote:
>> when using a hyper-converged cluster it was previously possible to add
>> the pool used by the ceph-mgr modules (".mgr" since quincy or
>> "device_health_metrics" previously) as an RBD storage. this would lead
>> to all kinds of errors when that storage was used (e.g.: VMs missing
>> their disks after a migration). hence, filter these pools from the
>> list of available pools.
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>> www/manager6/form/CephPoolSelector.js | 14 --
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/www/manager6/form/CephPoolSelector.js 
>> b/www/manager6/form/CephPoolSelector.js
>> index 5b96398d..eabb04ef 100644
>> --- a/www/manager6/form/CephPoolSelector.js
>> +++ b/www/manager6/form/CephPoolSelector.js
>> @@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
>>  throw "no nodename given";
>>  }
>>
>> +let filterCephMgrPools = (item) => {
>> +let name = item.data.pool_name;
>> +return name !== ".mgr" && name !== "device_health_metrics";
>> +};
>> +
>>  var store = Ext.create('Ext.data.Store', {
>>  fields: ['name'],
>>  sorters: 'name',
>> +filters: [
>> +filterCephMgrPools,
>> +],
>>  proxy: {
>>  type: 'proxmox',
>>  url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
>> @@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
>>
>>  store.load({
>>  callback: function(rec, op, success) {
>> -if (success && rec.length > 0) {
>> -me.select(rec[0]);
>> +let filteredRec = rec.filter(filterCephMgrPools);
>> +
>> +if (success && filteredRec.length > 0) {
>> +me.select(filteredRec[0]);
>>  }
>>  },
>>  });
> A thought, each ceph pool has an application associated (eg. rbd/cephfs). You 
> could use these to create an inclusion filter. You can see them with `ceph 
> osd pool application get`.

Ah thanks! :) I was looking for something like that. Sadly the API
endpoint used here does not return this information. I'll check how much
work it is to extend it and start working on a v2 of this patch!

> From the voice from the off. :⁠-⁠)
> 
> Cheers,
> Alwin
> Hi,
> 



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


[pve-devel] [PATCH manager v2 2/2] ui: remove ceph-mgr pools from rbd pool selection

2022-10-19 Thread Stefan Sterz
when using a hyper-converged cluster it was previously possible to add
the pool used by the ceph-mgr modules (".mgr" since quincy or
"device_health_metrics" previously) as an RBD storage. this would lead
to all kinds of errors when that storage was used (e.g.: VMs missing
their disks after a migration). hence, filter these pools from the
list of available pools.

Signed-off-by: Stefan Sterz 
---
similar to the previous api change this tries to fail gracefully if no
applications are defined for a pool.

 www/manager6/form/CephPoolSelector.js | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/CephPoolSelector.js 
b/www/manager6/form/CephPoolSelector.js
index 5b96398d..4dd77269 100644
--- a/www/manager6/form/CephPoolSelector.js
+++ b/www/manager6/form/CephPoolSelector.js
@@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
throw "no nodename given";
}
 
+   let filterCephMgrPools = (item) => {
+   let apps = item.data?.applications;
+   return apps === undefined || apps?.rbd !== undefined;
+   };
+
var store = Ext.create('Ext.data.Store', {
fields: ['name'],
sorters: 'name',
+   filters: [
+   filterCephMgrPools,
+   ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
@@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
 
store.load({
callback: function(rec, op, success) {
-   if (success && rec.length > 0) {
-   me.select(rec[0]);
+   let filteredRec = rec.filter(filterCephMgrPools);
+
+   if (success && filteredRec.length > 0) {
+   me.select(filteredRec[0]);
}
},
});
-- 
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 manager v2 1/2] api: ceph: add applications of each pool to the lspool endpoint

2022-10-19 Thread Stefan Sterz
since ceph luminous (ceph 12) pools need to be associated with at
least one applicaton expose this information here too so that clients
of this endpoint can use that information

Signed-off-by: Stefan Sterz 
---
even though an application needs to be defined for a pool since
luminous, i tried to make this code fail gracefully in the case the
rados mon command fails or there is no application for a given pool.

thanks @ alwin antreich for pointing out that pools have applications!

 PVE/API2/Ceph/Pools.pm | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..607b6c17 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -167,6 +167,8 @@ __PACKAGE__->register_method ({
# pg_autoscaler module is not enabled in Nautilus
my $autoscale = eval { $get_autoscale_status->($rados) };
 
+   my $apps = eval { $rados->mon_command({ prefix => 'osd pool application 
get' }) };
+
foreach my $e (@{$res->{pools}}) {
my $d = {};
foreach my $attr (@$attr_list) {
@@ -191,6 +193,10 @@ __PACKAGE__->register_method ({
$d->{percent_used} = $s->{percent_used};
}
 
+   if ($apps) {
+   $d->{applications} = $apps->{$d->{pool_name}} if 
$apps->{$d->{pool_name}};
+   }
+
# Cephs numerical pool types are barely documented. Found the 
following in the Ceph
# codebase: 
https://github.com/ceph/ceph/blob/ff144995a849407c258bcb763daa3e03cfce5059/src/osd/osd_types.h#L1221-L1233
if ($e->{type} == 1) {
-- 
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 manager v2 2/2] ui: remove ceph-mgr pools from rbd pool selection

2022-10-19 Thread Stefan Sterz
On 10/19/22 14:16, Stefan Sterz wrote:
> when using a hyper-converged cluster it was previously possible to add
> the pool used by the ceph-mgr modules (".mgr" since quincy or
> "device_health_metrics" previously) as an RBD storage. this would lead
> to all kinds of errors when that storage was used (e.g.: VMs missing
> their disks after a migration). hence, filter these pools from the
> list of available pools.

just realized that this commit message doesn't really make sense
anymore, sorry for the inconvenience. i'd suggest changing it to the
following (if necessary i can also send the patch again):

ui: only allow rbd pools to be added as rbd storage

previously the ui would allow adding all pools (even the default
ceph-mon pools) as storage. this could lead to issues when users did
use these pools as storage (e.g.: vms missing their disks after a
migration). hence, restrict the pool selector to rbd pools.

fails gracefully be reverting to the previous behavior if a pool has
no application assigned to it.

>> Signed-off-by: Stefan Sterz  ---
> similar to the previous api change this tries to fail gracefully if no
> applications are defined for a pool.
> 
>  www/manager6/form/CephPoolSelector.js | 14 --
>  1 file changed, 12 insertions(+), 2 deletions(-)
> 
> diff --git a/www/manager6/form/CephPoolSelector.js 
> b/www/manager6/form/CephPoolSelector.js
> index 5b96398d..4dd77269 100644
> --- a/www/manager6/form/CephPoolSelector.js
> +++ b/www/manager6/form/CephPoolSelector.js
> @@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
>   throw "no nodename given";
>   }
>  
> + let filterCephMgrPools = (item) => {
> + let apps = item.data?.applications;
> + return apps === undefined || apps?.rbd !== undefined;
> + };
> +
>   var store = Ext.create('Ext.data.Store', {
>   fields: ['name'],
>   sorters: 'name',
> + filters: [
> + filterCephMgrPools,
> + ],
>   proxy: {
>   type: 'proxmox',
>   url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
> @@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
>  
>   store.load({
>   callback: function(rec, op, success) {
> - if (success && rec.length > 0) {
> - me.select(rec[0]);
> + let filteredRec = rec.filter(filterCephMgrPools);
> +
> + if (success && filteredRec.length > 0) {
> + me.select(filteredRec[0]);
>   }
>   },
>   });



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



[pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint

2022-10-20 Thread Stefan Sterz
since ceph luminous (ceph 12) pools need to be associated with at
least one applicaton. expose this information here too so that clients
of this endpoint can use it

Signed-off-by: Stefan Sterz 
---
v3: add an api viewer entry for the applications object

thanks @ alwin antreich for pointing out that pools have applications!

 PVE/API2/Ceph/Pools.pm | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..f5984c2c 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
title => 'Autoscale Status',
optional => 1,
},
+   applications => {
+   type => 'object',
+   title => 'Associated Applications',
+   optional => 1,
+   },
},
},
links => [ { rel => 'child', href => "{pool_name}" } ],
@@ -167,6 +172,8 @@ __PACKAGE__->register_method ({
# pg_autoscaler module is not enabled in Nautilus
my $autoscale = eval { $get_autoscale_status->($rados) };
 
+   my $apps = eval { $rados->mon_command({ prefix => 'osd pool application 
get' }) };
+
foreach my $e (@{$res->{pools}}) {
my $d = {};
foreach my $attr (@$attr_list) {
@@ -191,6 +198,10 @@ __PACKAGE__->register_method ({
$d->{percent_used} = $s->{percent_used};
}
 
+   if ($apps) {
+   $d->{applications} = $apps->{$d->{pool_name}} if 
$apps->{$d->{pool_name}};
+   }
+
# Cephs numerical pool types are barely documented. Found the 
following in the Ceph
# codebase: 
https://github.com/ceph/ceph/blob/ff144995a849407c258bcb763daa3e03cfce5059/src/osd/osd_types.h#L1221-L1233
if ($e->{type} == 1) {
-- 
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 manager v3 2/2] ui: only allow rbd pools to be added as rbd storage

2022-10-20 Thread Stefan Sterz
previously the ui would allow adding all pools (even the default
ceph-mon pools) as storage. this could lead to issues when users did
use these pools as storage (e.g.: vms missing their disks after a
migration). hence, restrict the pool selector to rbd pools.

fails gracefully by reverting to the previous behavior if a pool has
no application assigned to it.

Signed-off-by: Stefan Sterz 
---
v3: changed the name of the filter function based on alwin antreich's
suggestion

 www/manager6/form/CephPoolSelector.js | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/CephPoolSelector.js 
b/www/manager6/form/CephPoolSelector.js
index 5b96398d..b98feb54 100644
--- a/www/manager6/form/CephPoolSelector.js
+++ b/www/manager6/form/CephPoolSelector.js
@@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
throw "no nodename given";
}
 
+   let onlyCephRBDPools = (item) => {
+   let apps = item.data?.applications;
+   return apps === undefined || apps?.rbd !== undefined;
+   };
+
var store = Ext.create('Ext.data.Store', {
fields: ['name'],
sorters: 'name',
+   filters: [
+   onlyCephRBDPools,
+   ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
@@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
 
store.load({
callback: function(rec, op, success) {
-   if (success && rec.length > 0) {
-   me.select(rec[0]);
+   let filteredRec = rec.filter(onlyCephRBDPools);
+
+   if (success && filteredRec.length > 0) {
+   me.select(filteredRec[0]);
}
},
});
-- 
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 manager v2 2/2] ui: remove ceph-mgr pools from rbd pool selection

2022-10-20 Thread Stefan Sterz
On 10/20/22 06:07, Alwin Antreich wrote:
> On October 19, 2022 2:16:44 PM GMT+02:00, Stefan Sterz  
> wrote:
>> when using a hyper-converged cluster it was previously possible to add
>> the pool used by the ceph-mgr modules (".mgr" since quincy or
>> "device_health_metrics" previously) as an RBD storage. this would lead
>> to all kinds of errors when that storage was used (e.g.: VMs missing
>> their disks after a migration). hence, filter these pools from the
>> list of available pools.
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>> similar to the previous api change this tries to fail gracefully if no
>> applications are defined for a pool.
>>
>> www/manager6/form/CephPoolSelector.js | 14 --
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/www/manager6/form/CephPoolSelector.js 
>> b/www/manager6/form/CephPoolSelector.js
>> index 5b96398d..4dd77269 100644
>> --- a/www/manager6/form/CephPoolSelector.js
>> +++ b/www/manager6/form/CephPoolSelector.js
>> @@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
>>  throw "no nodename given";
>>  }
>>
>> +let filterCephMgrPools = (item) => {
>> +let apps = item.data?.applications;
>> +return apps === undefined || apps?.rbd !== undefined;
>> +};
> I think the variable should be called filterCephRBDPools or onlyCephRBDPools. 
> As you only want RBD nothing else.
> 
> Ceph has lots of other pools that shouldn't be used, eg. .rgw.root (or 
> anything else aside from RBD for that matter).
> 
yes that makes sense, thanks! sent a v3 already with this change and i
also added another small improvement that i forgot previously.

>> +
>>  var store = Ext.create('Ext.data.Store', {
>>  fields: ['name'],
>>  sorters: 'name',
>> +filters: [
>> +filterCephMgrPools,
>> +],
>>  proxy: {
>>  type: 'proxmox',
>>  url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
>> @@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
>>
>>  store.load({
>>  callback: function(rec, op, success) {
>> -if (success && rec.length > 0) {
>> -me.select(rec[0]);
>> +let filteredRec = rec.filter(filterCephMgrPools);
>> +
>> +if (success && filteredRec.length > 0) {
>> +me.select(filteredRec[0]);
>>  }
>>  },
>>  });
> 
> Cheers,
> Alwin 
> 
> Hi again :)
> 



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



Re: [pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint

2022-10-20 Thread Stefan Sterz
On 10/20/22 14:55, Thomas Lamprecht wrote:
> Am 20/10/2022 um 09:17 schrieb Stefan Sterz:
>> since ceph luminous (ceph 12) pools need to be associated with at
>> least one applicaton. expose this information here too so that clients
>> of this endpoint can use it
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>> v3: add an api viewer entry for the applications object
>>
>> thanks @ alwin antreich for pointing out that pools have applications!
>>
>>  PVE/API2/Ceph/Pools.pm | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
>> index 6c05250e..f5984c2c 100644
>> --- a/PVE/API2/Ceph/Pools.pm
>> +++ b/PVE/API2/Ceph/Pools.pm
>> @@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
>>  title => 'Autoscale Status',
>>  optional => 1,
>>  },
>> +applications => {
>> +type => 'object',
>> +title => 'Associated Applications',
>> +optional => 1,
>> +},
>>  },
>>  },
>>  links => [ { rel => 'child', href => "{pool_name}" } ],
>> @@ -167,6 +172,8 @@ __PACKAGE__->register_method ({
>>  # pg_autoscaler module is not enabled in Nautilus
>>  my $autoscale = eval { $get_autoscale_status->($rados) };
>>  
>> +my $apps = eval { $rados->mon_command({ prefix => 'osd pool application 
>> get' }) };
> 
> out of interest: how expensive is this, did you check the overhead?
> 

do you want a specific metric? in my (admittedly small) test setup
(three vm cluster with 4 cores and 4Gib RAM) it is barely noticeable.
the api call takes between 18 and 25ms in both cases for me.

>> +
>>  foreach my $e (@{$res->{pools}}) {
>>  my $d = {};
>>  foreach my $attr (@$attr_list) {
>> @@ -191,6 +198,10 @@ __PACKAGE__->register_method ({
>>  $d->{percent_used} = $s->{percent_used};
>>  }
>>  
>> +if ($apps) {
>> +$d->{applications} = $apps->{$d->{pool_name}} if 
>> $apps->{$d->{pool_name}};
> 
> no nested hashes-in-hashes, pull out $d->{pool_name} earlier and then make it 
> an one
> liner:
> 
> $d->{applications} = $apps->{$pool} if defined($apps->{$pool});
> 

noted, ill avoid that in the future.

>> +}
>> +
>>  # Cephs numerical pool types are barely documented. Found the 
>> following in the Ceph
>>  # codebase: 
>> https://github.com/ceph/ceph/blob/ff144995a849407c258bcb763daa3e03cfce5059/src/osd/osd_types.h#L1221-L1233
>>  if ($e->{type} == 1) {
> 



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



Re: [pve-devel] [PATCH manager v3 2/2] ui: only allow rbd pools to be added as rbd storage

2022-10-21 Thread Stefan Sterz
On 10/20/22 15:00, Thomas Lamprecht wrote:
> Am 20/10/2022 um 09:17 schrieb Stefan Sterz:
>> previously the ui would allow adding all pools (even the default
>> ceph-mon pools) as storage. this could lead to issues when users did
>> use these pools as storage (e.g.: vms missing their disks after a
>> migration). hence, restrict the pool selector to rbd pools.
>>
>> fails gracefully by reverting to the previous behavior if a pool has
>> no application assigned to it.
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>> v3: changed the name of the filter function based on alwin antreich's
>> suggestion
>>
>>  www/manager6/form/CephPoolSelector.js | 14 --
>>  1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/www/manager6/form/CephPoolSelector.js 
>> b/www/manager6/form/CephPoolSelector.js
>> index 5b96398d..b98feb54 100644
>> --- a/www/manager6/form/CephPoolSelector.js
>> +++ b/www/manager6/form/CephPoolSelector.js
>> @@ -15,9 +15,17 @@ Ext.define('PVE.form.CephPoolSelector', {
>>  throw "no nodename given";
>>  }
>>  
>> +let onlyCephRBDPools = (item) => {
>> +let apps = item.data?.applications;
>> +return apps === undefined || apps?.rbd !== undefined;
> 
> couldn't this be a one liner? and as nit I'd maybe drop the Ceph from the 
> name,
> suggests a bit that we got non-ceph rbd pools.
> 
> // filter out rgw, metadata, cephfs, ... pools
> onlyRBDPools = ({data}) => !!data?.applications?.rbd;
> 
> 

i see your point on variable naming, but this isn't equivalent afaiu.
the idea here was that the ui reverts back to including a pool if there
is no application defined for it (this should help make the ui change
independent from the api change). this wouldn't do that. you could do:

onlyRBDPools = ({ data }) => !data?.applications ||
!!data?.applications?.rbd

imo still pretty long, but maybe you have another trick up your
sleeve :)

if you don't care about keeping the front-end compatible with the
previous behavior we can also use your one-liner. just wanted to err on
the side of caution.

as a sidenote: personally i also prefer checking for undefined-ness to
relying on its falsy nature. e.g. if application.rbd = null, this would
also return false, even though technically rbd is defined. since ceph
seems to return empty objects for rbd pools by default, this currently
works fine. however, id prefer being more explicit. this is just a
personal preference though, so i'll do whatever you prefer :)

there is also the "in" operator, but if irc another patch of mine once
got rejected for using that.

> more generally, the application could be also shown in our ceph pool list, 
> could
> be useful to see the usage type of each pool, would also reduce confusion for 
> the
> a bit odd metadata pool with its single PG.
> 

sure i suppose that makes sense, i can add that to a v4.

>> +};
>> +
>>  var store = Ext.create('Ext.data.Store', {
>>  fields: ['name'],
>>  sorters: 'name',
>> +filters: [
>> +onlyCephRBDPools,
>> +],
>>  proxy: {
>>  type: 'proxmox',
>>  url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
>> @@ -32,8 +40,10 @@ Ext.define('PVE.form.CephPoolSelector', {
>>  
>>  store.load({
>>  callback: function(rec, op, success) {
>> -if (success && rec.length > 0) {
>> -me.select(rec[0]);
>> +let filteredRec = rec.filter(onlyCephRBDPools);
>> +
>> +if (success && filteredRec.length > 0) {
>> +me.select(filteredRec[0]);
>>  }
>>  },
>>  });
> 



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



Re: [pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint

2022-10-21 Thread Stefan Sterz
On 10/21/22 09:04, Thomas Lamprecht wrote:
> Am 21/10/2022 um 08:57 schrieb Stefan Sterz:
>>> out of interest: how expensive is this, did you check the overhead?
>>>
>> do you want a specific metric? in my (admittedly small) test setup
>> (three vm cluster with 4 cores and 4Gib RAM) it is barely noticeable.
>> the api call takes between 18 and 25ms in both cases for me.
>>
> 
> I mean, with a handful of pools you probably won't (or really should not)
> see any difference >50 ms, that would make it a hard case arguing.
> 
> Just wondered if many pools (e.g., [10, 100, 1000]) actually increase this
> O(n) or if that falls in the noise of the rados monitor query overhead.
> 
> I don't expect that is significant, just wondered if you already checked
> and got some info on that.

ok so from what i can tell this is probably O(n) as it iterates once
over all pools, but that info should be in memory and not too bad imo
(and since this is lspools there are some other calls here that are
likely in O(n)).

however, even if this rados command takes too long, it will time out
after 5 seconds and then no applications will be included in the
response. which is just the previous behavior and imo "safe".

some more detail below:

technically, one may argue this call is in O(n*m*k), with n being the
number of pools, m the number of applications and k the number of
metadata keys for the application. but m and k are very like very small
if not zero (e.g. for a default rbd pool m is one and k would be zero).
so more like O(n).

at least if i am reading this right:
https://github.com/smithfarm/ceph/blob/v17.0.0/src/mon/OSDMonitor.cc#L6876-L6956



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



Re: [pve-devel] [PATCH manager v3 1/2] api: ceph: add applications of each pool to the lspools endpoint

2022-10-21 Thread Stefan Sterz
On 10/21/22 09:59, Stefan Sterz wrote:
> On 10/21/22 09:04, Thomas Lamprecht wrote:
>> Am 21/10/2022 um 08:57 schrieb Stefan Sterz:
>>>> out of interest: how expensive is this, did you check the overhead?
>>>>
>>> do you want a specific metric? in my (admittedly small) test setup
>>> (three vm cluster with 4 cores and 4Gib RAM) it is barely noticeable.
>>> the api call takes between 18 and 25ms in both cases for me.
>>>
>>
>> I mean, with a handful of pools you probably won't (or really should not)
>> see any difference >50 ms, that would make it a hard case arguing.
>>
>> Just wondered if many pools (e.g., [10, 100, 1000]) actually increase this
>> O(n) or if that falls in the noise of the rados monitor query overhead.
>>
>> I don't expect that is significant, just wondered if you already checked
>> and got some info on that.
> 
> ok so from what i can tell this is probably O(n) as it iterates once
> over all pools, but that info should be in memory and not too bad imo
> (and since this is lspools there are some other calls here that are
> likely in O(n)).
> 
> however, even if this rados command takes too long, it will time out
> after 5 seconds and then no applications will be included in the
> response. which is just the previous behavior and imo "safe".
> 
> some more detail below:
> 
> technically, one may argue this call is in O(n*m*k), with n being the
> number of pools, m the number of applications and k the number of
> metadata keys for the application. but m and k are very like very small
> if not zero (e.g. for a default rbd pool m is one and k would be zero).
> so more like O(n).
> 
> at least if i am reading this right:
> https://github.com/smithfarm/ceph/blob/v17.0.0/src/mon/OSDMonitor.cc#L6876-L6956

sorry for the many emails, just figured out that we previously dump all
this information in that api call already so we don't need to issue
another rados mon command at all. ill update this patch series accordingly

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



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



[pve-devel] [PATCH manager v4 2/2] ui: only allow rbd pools to be added as rbd storage

2022-10-25 Thread Stefan Sterz
previously the ui would allow adding all pools (even the default
ceph-mon pools) as storage. this could lead to issues when users did
use these pools as storage (e.g.: vms missing their disks after a
migration). hence, restrict the pool selector to rbd pools.

fails gracefully by reverting to the previous behavior if a pool has
no application assigned to it.

Signed-off-by: Stefan Sterz 
---
v3: changed the name of the filter function based on alwin antreich's
suggestion.
v4: renamed the filter function again a, adapted it to be more concise
and make it work with the slightly adapted api response.

 www/manager6/form/CephPoolSelector.js | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/www/manager6/form/CephPoolSelector.js 
b/www/manager6/form/CephPoolSelector.js
index 5b96398d..e8197077 100644
--- a/www/manager6/form/CephPoolSelector.js
+++ b/www/manager6/form/CephPoolSelector.js
@@ -15,9 +15,15 @@ Ext.define('PVE.form.CephPoolSelector', {
throw "no nodename given";
}
 
+   let onlyRBDPools = ({ data }) =>
+   !data?.application_metadata || !!data?.application_metadata?.rbd;
+
var store = Ext.create('Ext.data.Store', {
fields: ['name'],
sorters: 'name',
+   filters: [
+   onlyRBDPools,
+   ],
proxy: {
type: 'proxmox',
url: '/api2/json/nodes/' + me.nodename + '/ceph/pools',
@@ -32,8 +38,10 @@ Ext.define('PVE.form.CephPoolSelector', {
 
store.load({
callback: function(rec, op, success) {
-   if (success && rec.length > 0) {
-   me.select(rec[0]);
+   let filteredRec = rec.filter(onlyRBDPools);
+
+   if (success && filteredRec.length > 0) {
+   me.select(filteredRec[0]);
}
},
});
-- 
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 manager v4 1/2] api: ceph: add applications of each pool to the lspools endpoint

2022-10-25 Thread Stefan Sterz
since ceph luminous (ceph 12) pools need to be associated with at
least one applicaton. expose this information here too so that clients
of this endpoint can use it.

Signed-off-by: Stefan Sterz 
---
v3: add an api viewer entry for the applications object.
v4: re-use the 'osd dump' command's result instead of issueing another 
command.

thanks @ alwin antreich for pointing out that pools have applications!

 PVE/API2/Ceph/Pools.pm | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/PVE/API2/Ceph/Pools.pm b/PVE/API2/Ceph/Pools.pm
index 6c05250e..fce56787 100644
--- a/PVE/API2/Ceph/Pools.pm
+++ b/PVE/API2/Ceph/Pools.pm
@@ -125,6 +125,11 @@ __PACKAGE__->register_method ({
title => 'Autoscale Status',
optional => 1,
},
+   application_metadata => {
+   type => 'object',
+   title => 'Associated Applications',
+   optional => 1,
+   },
},
},
links => [ { rel => 'child', href => "{pool_name}" } ],
@@ -162,6 +167,7 @@ __PACKAGE__->register_method ({
'pg_num',
'crush_rule',
'pg_autoscale_mode',
+   'application_metadata',
];
 
# pg_autoscaler module is not enabled in Nautilus
-- 
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 manager v1 2/2] ui: add javascript source to `OnlineHelpInfo.js` prerequisites

2022-11-08 Thread Stefan Sterz
by adding the javascript files as prerequisites, the
`OnlineHelpInfo.js` will get re-generated if a new `onlineHelp` key
is used. thus, this avoids an issue were valid keys might not get
mapped correctly because the info in `OnlineHelpInfo.js` wasn't
updated.

Signed-off-by: Stefan Sterz 
---
i stubled accross while fixing the bug mentioned in the previous 
commit. feel free to drop this, though.

 www/manager6/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index d16770b1..5938c7f5 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -304,7 +304,7 @@ pvemanagerlib.js: .lint-incremental OnlineHelpInfo.js 
${JSSRC}
cat OnlineHelpInfo.js ${JSSRC} >$@.tmp
mv $@.tmp $@
 
-OnlineHelpInfo.js: /usr/bin/asciidoc-pve
+OnlineHelpInfo.js: /usr/bin/asciidoc-pve ${JSSRC}
/usr/bin/asciidoc-pve scan-extjs ${JSSRC} >$@.tmp
mv $@.tmp $@
 
-- 
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 manager v1 1/2] fix #4328: make help buttons in the markdown editor window work again

2022-11-08 Thread Stefan Sterz
when the `onlineHelp` of a component is defined in the widget toolkit
`asciidoc-pve` can't pick up on that and `OnlineHelpInfo.js` won't
contain the necessary keys. this patch sets `onlineHelp` in this
package again to avoid that.

note: technically it would be enough to set this for one of the three
usages of `pmxNotesView`, as then `asciidoc-pve` would add it to
`OnlineHelpInfo.js` again. however, for consistency's sake i added it
to all occurrences.

Signed-off-by: Stefan Sterz 
---
so this issue doesn't only affect the markdown notes, there are also
other components affected by this. afict this includes:

* `proxmoxNodeNetworkView`: needs `sysadmin_network_configuration`,
  which works because it is also set in `node/Config.js`, similar to
  this fix.
* several components related to tfa need `user_mgmt` which are all
  currently broken, because that key isn't used at all in
  `pve-manager`.

i think it would be nice to have a solution that allows setting such
keys in the widget toolkit only, but that would require one of two
changes:

1. always add all possible keys to `OnlineHelpInfo.js`. to my
   understanding, this is similar to how pbs currently creates its
   `OnlineHelpInfo.js`
2. include the widget toolkit's javascript files in the input to
   `asciidoc-pve`. however, i am unsure how we could do so elegantly.

 www/manager6/dc/Config.js  | 1 +
 www/manager6/node/Config.js| 1 +
 www/manager6/panel/GuestSummary.js | 1 +
 3 files changed, 3 insertions(+)

diff --git a/www/manager6/dc/Config.js b/www/manager6/dc/Config.js
index 13ded12e..4da47e43 100644
--- a/www/manager6/dc/Config.js
+++ b/www/manager6/dc/Config.js
@@ -32,6 +32,7 @@ Ext.define('PVE.dc.Config', {
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
+   onlineHelp: 'markdown_basics',
},
{
title: gettext('Cluster'),
diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js
index 7e5b1112..9959aea6 100644
--- a/www/manager6/node/Config.js
+++ b/www/manager6/node/Config.js
@@ -133,6 +133,7 @@ Ext.define('PVE.node.Config', {
title: gettext('Notes'),
iconCls: 'fa fa-sticky-note-o',
itemId: 'notes',
+   onlineHelp: 'markdown_basics',
},
);
}
diff --git a/www/manager6/panel/GuestSummary.js 
b/www/manager6/panel/GuestSummary.js
index 1565db3f..6b6c4298 100644
--- a/www/manager6/panel/GuestSummary.js
+++ b/www/manager6/panel/GuestSummary.js
@@ -45,6 +45,7 @@ Ext.define('PVE.guest.Summary', {
padding: template ? '5' : '0 0 0 5',
itemId: 'notesview',
pveSelNode: me.pveSelNode,
+   onlineHelp: 'markdown_basics',
},
];
 
-- 
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 2/2] asciidoc-pve: ignore anchor names in curly braces

2022-11-11 Thread Stefan Sterz
previously the scanner would detect some `onlineHelp` keys that are
set via CBind as anchor names. this would cause it to fail, as they
cannot be present anywhere in the documentation. no valid anchor name
can be wrapped in curly braces, as they need to be valid xml names.
hence it should be safe to just ignore all keys wrapped in curly
braces.

Signed-off-by: Stefan Sterz 
---
 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asciidoc-pve.in b/asciidoc-pve.in
index d638a38..c536371 100644
--- a/asciidoc-pve.in
+++ b/asciidoc-pve.in
@@ -465,7 +465,7 @@ sub scan_extjs_file {
 debug("scan-extjs $filename");
 
 while(defined(my $line = <$fh>)) {
-   if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
+   if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{].*?[^}])[\'\"]/) {
my $blockid = $1;
my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
die "undefined blockid '$blockid' ($filename, line $.)\n"
-- 
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 manager v2 1/1] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js

2022-11-11 Thread Stefan Sterz
previously the widget toolkit was not scanned when creating the
mapping between `onlineHelp` keys and pve-doc anchors. this could
lead to cases where help buttons didn't work because the necessary
mapping wasn't present in `OnlineHelpInfo.js`.

Signed-off-by: Stefan Sterz 
---
i took the liberty here to remove "/usr/bin/asciidoc-pve" as a
prerequisite of the affected make target. imo it isn't prerequisite
any more than "eslint" is for the `lint` target. it should already be
handled by the build dependencies anyway afaiu.

if that's not correct, i'll send a v3.

 debian/control| 1 +
 www/manager6/Makefile | 6 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 35c9eee3..712d65e8 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends: debhelper (>= 12~),
libtemplate-perl,
libtest-mockmodule-perl,
lintian,
+   proxmox-widget-toolkit (>= 3.4-9),
pve-cluster,
pve-container,
pve-doc-generator (>= 7.0-4),
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 5938c7f5..2802cbac 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -288,6 +288,8 @@ JSSRC=  
\
Workspace.js\
 # end of JSSRC list
 
+WIDGETKIT=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
+
 all:
 
 .lint-incremental: ${JSSRC}
@@ -304,8 +306,8 @@ pvemanagerlib.js: .lint-incremental OnlineHelpInfo.js 
${JSSRC}
cat OnlineHelpInfo.js ${JSSRC} >$@.tmp
mv $@.tmp $@
 
-OnlineHelpInfo.js: /usr/bin/asciidoc-pve ${JSSRC}
-   /usr/bin/asciidoc-pve scan-extjs ${JSSRC} >$@.tmp
+OnlineHelpInfo.js: ${JSSRC} ${WIDGETKIT}
+   /usr/bin/asciidoc-pve scan-extjs $^ >$@.tmp
mv $@.tmp $@
 
 .PHONY: install
-- 
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/2] pveum: add the "user_mgmt" reference to the documentation

2022-11-11 Thread Stefan Sterz
since this key was missing from the PVE documentation, the TFA ui's
help buttons didn't work as they relied on it.

Signed-off-by: Stefan Sterz 
---
 pveum.adoc | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/pveum.adoc b/pveum.adoc
index cbd553a..52de14d 100644
--- a/pveum.adoc
+++ b/pveum.adoc
@@ -1,4 +1,7 @@
 [[chapter_user_management]]
+
+[[user_mgmt]]
+
 ifdef::manvolnum[]
 pveum(1)
 
-- 
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 0/2] pve fix help buttons by accounting for keys in widget toolkit

2022-11-11 Thread Stefan Sterz
this patch series fixes an issue where `onlineHelp` keys, that were
only used by components in the widget toolkit, were not properly
mapped to the corresponding anchors in the docs. this lead to
affected help buttons only showing an error message.

this series first fixes `pve-docs` by adding keys that were already
used by the widget toolkit's components. it also makes `asciidoc-pve`
a bit less aggressiv in order to avoid keys that are set by cbind.
then it adds the toolkit as a build dependency to `pve-manager` and
scans the toolkit for keys there when building the front-end.


changes from v1 @ Thomas Lamprecht:

* scan the widget toolkit too and not just components in
  `pve-manager`


Stefan Sterz (2):
  pveum: add the "user_mgmt" reference to the documentation
  asciidoc-pve: ignore anchor names in curly braces

 asciidoc-pve.in | 2 +-
 pveum.adoc  | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

Stefan Sterz (1):
  fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js

 debian/control| 1 +
 www/manager6/Makefile | 6 --
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
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 docs v2 2/2] asciidoc-pve: ignore anchor names in curly braces

2022-11-14 Thread Stefan Sterz
On 11/11/22 19:22, Thomas Lamprecht wrote:
> Am 11/11/2022 um 16:05 schrieb Stefan Sterz:
>> previously the scanner would detect some `onlineHelp` keys that are
>> set via CBind as anchor names. this would cause it to fail, as they
>> cannot be present anywhere in the documentation. no valid anchor name
>> can be wrapped in curly braces, as they need to be valid xml names.
>> hence it should be safe to just ignore all keys wrapped in curly
>> braces.
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>>  asciidoc-pve.in | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/asciidoc-pve.in b/asciidoc-pve.in
>> index d638a38..c536371 100644
>> --- a/asciidoc-pve.in
>> +++ b/asciidoc-pve.in
>> @@ -465,7 +465,7 @@ sub scan_extjs_file {
>>  debug("scan-extjs $filename");
>>  
>>  while(defined(my $line = <$fh>)) {
>> -if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
>> +if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{].*?[^}])[\'\"]/) {
> 
> IIUC this indirectly raised the minimum length of references to two 
> characters,
> not a deal breaker IMO as I don't really expect two characters to be used 
> anytime
> soon (maybe with unicode 🤔🧠💭 x)), but maybe hint it in the commit message.
> 

yes that is correct. just to have made the suggestion: the "[^}]" could
be dropped here. that should get us back down to one character, but will
also filter the necessary keys. and anchors like "{key" are just as
invalid as "{key}" in asciidoc.

>>  my $blockid = $1;
>>  my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
>>  die "undefined blockid '$blockid' ($filename, line $.)\n"
> 


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


Re: [pve-devel] [PATCH docs v2 2/2] asciidoc-pve: ignore anchor names in curly braces

2022-11-14 Thread Stefan Sterz
On 11/14/22 11:07, Thomas Lamprecht wrote:
> Am 14/11/2022 um 09:26 schrieb Stefan Sterz:
>>> IIUC this indirectly raised the minimum length of references to two 
>>> characters,
>>> not a deal breaker IMO as I don't really expect two characters to be used 
>>> anytime
>>> soon (maybe with unicode 🤔🧠💭 x)), but maybe hint it in the commit message.
>>>
>> yes that is correct. just to have made the suggestion: the "[^}]" could
>> be dropped here. that should get us back down to one character, but will
>> also filter the necessary keys. and anchors like "{key" are just as
>> invalid as "{key}" in asciidoc.
>>
> 
> 
> or move it to a single one replacing the whole non-greedy part, something like
> (untested): [^{}\[\]"']+
> 
should work to, yes. i used grep to test this and it worked (i did need
to do some escaping for the quotes, but the idea seems solid). i'll send
a v3 with this if you approve :)



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


[pve-devel] [PATCH manager v3 0/2] pve fix help buttons by accounting for keys in widget toolkit

2022-11-14 Thread Stefan Sterz
this patch series fixes an issue where `onlineHelp` keys, that were
only used by components in the widget toolkit, were not properly
mapped to the corresponding anchors in the docs. this lead to
affected help buttons only showing an error message.

this series first fixes `pve-docs` by making `asciidoc-pve`
a bit less aggressiv in order to avoid keys that are set by cbind.
then it adds the toolkit as a build dependency to `pve-manager` and
scans the toolkit for keys there when building the front-end.


changes from v2, thanks @ Thomas Lamprecht:

* rebase to current master
* move to greedy regex

changes from v1, thanks @ Thomas Lamprecht:

* scan the widget toolkit too and not just components in
  `pve-manager`

Stefan Sterz (1):
  asciidoc-pve: disallow certain characters in onlineHelp keys

 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Stefan Sterz (1):
  fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js

 debian/control| 1 +
 www/manager6/Makefile | 6 --
 2 files changed, 5 insertions(+), 2 deletions(-)

-- 
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 manager v3 2/2] fix #4328: ui: add widget toolkit to dependencies of OnlineHelpInfo.js

2022-11-14 Thread Stefan Sterz
previously the widget toolkit was not scanned when creating the
mapping between `onlineHelp` keys and pve-doc anchors. this could
lead to cases where help buttons didn't work because the necessary
mapping wasn't present in `OnlineHelpInfo.js`.

Signed-off-by: Stefan Sterz 
---
 debian/control| 1 +
 www/manager6/Makefile | 6 --
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/control b/debian/control
index 35c9eee3..712d65e8 100644
--- a/debian/control
+++ b/debian/control
@@ -19,6 +19,7 @@ Build-Depends: debhelper (>= 12~),
libtemplate-perl,
libtest-mockmodule-perl,
lintian,
+   proxmox-widget-toolkit (>= 3.4-9),
pve-cluster,
pve-container,
pve-doc-generator (>= 7.0-4),
diff --git a/www/manager6/Makefile b/www/manager6/Makefile
index 5938c7f5..2802cbac 100644
--- a/www/manager6/Makefile
+++ b/www/manager6/Makefile
@@ -288,6 +288,8 @@ JSSRC=  
\
Workspace.js\
 # end of JSSRC list
 
+WIDGETKIT=/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
+
 all:
 
 .lint-incremental: ${JSSRC}
@@ -304,8 +306,8 @@ pvemanagerlib.js: .lint-incremental OnlineHelpInfo.js 
${JSSRC}
cat OnlineHelpInfo.js ${JSSRC} >$@.tmp
mv $@.tmp $@
 
-OnlineHelpInfo.js: /usr/bin/asciidoc-pve ${JSSRC}
-   /usr/bin/asciidoc-pve scan-extjs ${JSSRC} >$@.tmp
+OnlineHelpInfo.js: ${JSSRC} ${WIDGETKIT}
+   /usr/bin/asciidoc-pve scan-extjs $^ >$@.tmp
mv $@.tmp $@
 
 .PHONY: install
-- 
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 v3 1/2] asciidoc-pve: disallow certain characters in onlineHelp keys

2022-11-14 Thread Stefan Sterz
this removes the lazily evaluated part of the regex used to detect
`onlineHelp` keys in order to match them with asciidoc anchors in the
documentation. it uses a pattern that excludes curly braces, brackets
and quotations instead. this allows for greedy matching and also
removes an issue where keys that are set via CBind were included
incorrectly. the script would try to find an anchor name that was
equivalent to the CBind placeholder, which would fail.

since brackets, curly braces and quotation marks aren't allowed in
asciidoc anchors anyway, excluding them like this should be safe.

Signed-off-by: Stefan Sterz 
---
 asciidoc-pve.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/asciidoc-pve.in b/asciidoc-pve.in
index d638a38..49e54bd 100644
--- a/asciidoc-pve.in
+++ b/asciidoc-pve.in
@@ -465,7 +465,7 @@ sub scan_extjs_file {
 debug("scan-extjs $filename");
 
 while(defined(my $line = <$fh>)) {
-   if ($line =~ m/\s+onlineHelp:\s*[\'\"](.*?)[\'\"]/) {
+   if ($line =~ m/\s+onlineHelp:\s*[\'\"]([^{}\[\]\'\"]+)[\'\"]/) {
my $blockid = $1;
my $link = $fileinfo->{blockid_target}->{default}->{$blockid};
die "undefined blockid '$blockid' ($filename, line $.)\n"
-- 
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 pve-cluster] datacenter config: remove typo in "user-tag-access" description

2022-11-18 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 data/PVE/DataCenterConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 5a70722..4186195 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -185,7 +185,7 @@ my $user_tag_privs_format = {
."controls (such as guests). Users with the `Sys.Modify` privilege 
on `/` are always "
." unrestricted. "
."'none' no tags are usable. "
-   ."'list' tasg from 'user-allow'list' are usable. "
+   ."'list' tags from 'user-allow'list' are usable. "
."'existing' like list, but already existing tags of resources are 
also usable."
."'free' no tag restrictions."
 },
-- 
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 pve-cluster v2] datacenter config: remove typos in "user-tag-access" description

2022-11-18 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 data/PVE/DataCenterConfig.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/PVE/DataCenterConfig.pm b/data/PVE/DataCenterConfig.pm
index 5a70722..925670d 100644
--- a/data/PVE/DataCenterConfig.pm
+++ b/data/PVE/DataCenterConfig.pm
@@ -185,7 +185,7 @@ my $user_tag_privs_format = {
."controls (such as guests). Users with the `Sys.Modify` privilege 
on `/` are always "
." unrestricted. "
."'none' no tags are usable. "
-   ."'list' tasg from 'user-allow'list' are usable. "
+   ."'list' tags from 'user-allow-list' are usable. "
."'existing' like list, but already existing tags of resources are 
also usable."
."'free' no tag restrictions."
 },
-- 
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 i18n] update german translation

2022-11-21 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 de.po | 185 +++---
 1 file changed, 72 insertions(+), 113 deletions(-)

diff --git a/de.po b/de.po
index ea6f50b..efd14c3 100644
--- a/de.po
+++ b/de.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Thu Nov 17 19:57:32 2022\n"
-"PO-Revision-Date: 2022-05-17 14:40+0200\n"
+"PO-Revision-Date: 2022-11-21 10:40+0100\n"
 "Last-Translator: Proxmox Support Team \n"
 "Language-Team: German\n"
 "Language: de\n"
@@ -314,9 +314,8 @@ msgid "Add TPM"
 msgstr "TPM hinzufügen"
 
 #: pve-manager/www/manager6/form/TagEdit.js:284
-#, fuzzy
 msgid "Add Tag"
-msgstr "Band hinzufügen"
+msgstr "Tag hinzufügen"
 
 #: proxmox-backup/www/tape/TapeInventory.js:187
 msgid "Add Tape"
@@ -350,11 +349,11 @@ msgstr "Als Storage hinzufügen"
 
 #: pve-manager/www/manager6/ceph/FS.js:53
 msgid "Add the new CephFS to the cluster storage configuration."
-msgstr "CephFS als Storage im Cluster hinzufügen"
+msgstr "CephFS als Storage im Cluster hinzufügen."
 
 #: pve-manager/www/manager6/ceph/Pool.js:72
 msgid "Add the new pool to the cluster storage configuration."
-msgstr "RBD Pool als Storage im Cluster hinzufügen"
+msgstr "Neues RBD Pool als Storage im Cluster hinzufügen."
 
 #: pve-manager/www/manager6/ceph/CephInstallWizard.js:412
 msgid ""
@@ -432,9 +431,8 @@ msgid "All"
 msgstr "Alle"
 
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:202
-#, fuzzy
 msgid "All Cores"
-msgstr "Cores"
+msgstr "Alle Cores"
 
 #: pve-manager/www/manager6/qemu/PCIEdit.js:151
 msgid "All Functions"
@@ -492,7 +490,7 @@ msgstr "Erlaubte Zeichen"
 #: pve-manager/www/manager6/Utils.js:1934
 #: pve-manager/www/manager6/Utils.js:1936
 msgid "Alphabetical"
-msgstr ""
+msgstr "Alphabetisch"
 
 #: pmg-gui/js/PBSRemoteEdit.js:87
 #: pve-manager/www/manager6/dc/BackupJobDetail.js:214
@@ -624,7 +622,7 @@ msgstr ""
 
 #: pve-manager/www/manager6/qemu/HDEdit.js:309
 msgid "Async IO"
-msgstr ""
+msgstr "Asynchrone IO"
 
 #: pmg-gui/js/Utils.js:555
 msgid "Attach orig. Mail"
@@ -635,9 +633,8 @@ msgid "Attachment Quarantine"
 msgstr "Anhangs-Quarantäne"
 
 #: pmg-gui/js/AttachmentGrid.js:8
-#, fuzzy
 msgid "Attachments"
-msgstr "Keine Anhänge"
+msgstr "Anhänge"
 
 #: proxmox-widget-toolkit/src/window/DiskSmart.js:34
 msgid "Attribute"
@@ -753,9 +750,8 @@ msgid "Backend Driver"
 msgstr "Backendtreiber"
 
 #: pve-manager/www/manager6/form/TagColorGrid.js:316
-#, fuzzy
 msgid "Background"
-msgstr "Backup-Anzahl"
+msgstr "Hintergrund"
 
 #: proxmox-backup/www/window/DataStoreEdit.js:59
 msgid "Backing Path"
@@ -1064,9 +1060,8 @@ msgid "CPU"
 msgstr "CPU"
 
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:200
-#, fuzzy
 msgid "CPU Affinity"
-msgstr "CPU Limit"
+msgstr "CPU Affinität"
 
 #: pve-manager/www/manager6/lxc/ResourceEdit.js:79
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:191
@@ -1124,9 +1119,8 @@ msgid "Cache"
 msgstr "Cache"
 
 #: pve-manager/www/manager6/form/TagEdit.js:304
-#, fuzzy
 msgid "Cancel Edit"
-msgstr "Abbruch"
+msgstr "Bearbeitung abbrechen"
 
 #: pve-manager/www/manager6/storage/ImageView.js:52
 msgid "Cannot remove disk image."
@@ -1250,10 +1244,9 @@ msgid "Changers"
 msgstr "Wechsler"
 
 #: pve-manager/www/manager6/dc/OptionView.js:244
-#, fuzzy
 msgid "Changing the ID breaks existing WebAuthn TFA entries."
 msgstr ""
-"Das Ändern der Relying-Party kann bereits existierende WebAuthn-TFA-Einträge "
+"Das Ändern der ID kann bereits existierende WebAuthn-TFA-Einträge "
 "unbrauchbar machen."
 
 #: pmg-gui/js/TFAView.js:82 proxmox-backup/www/config/WebauthnView.js:131
@@ -1299,7 +1292,7 @@ msgstr ""
 
 #: pve-manager/www/manager6/Utils.js:1928
 msgid "Circle"
-msgstr ""
+msgstr "Kreis"
 
 #: pve-manager/www/manager6/Utils.js:1926
 msgid "Cirlce"
@@ -1457,7 +1450,7 @@ msgstr "Alle zusammenklappen"
 
 #: pve-manager/www/manager6/dc/OptionView.js:430
 msgid "Color Overrides"
-msgstr ""
+msgstr "Überschriebene Farben"
 
 #: pve-manager/www/manager6/ha/Fencing.js:31
 msgid "Command"
@@ -2008,7 +2001,6 @@ msgid "DNSBL Threshold"
 msgstr "DNSBL Schwellwert"
 
 #: proxmox-backup/www/config/PruneView.js

[pve-devel] [PATCH manager] ui: fix minor typo in tag style gui

2022-11-21 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 www/manager6/Utils.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/manager6/Utils.js b/www/manager6/Utils.js
index df2f9631..4dd3cb93 100644
--- a/www/manager6/Utils.js
+++ b/www/manager6/Utils.js
@@ -1923,7 +1923,7 @@ Ext.define('PVE.Utils', {
 },
 
 tagTreeStyles: {
-   '__default__': `${Proxmox.Utils.defaultText} (${gettext('Cirlce')})`,
+   '__default__': `${Proxmox.Utils.defaultText} (${gettext('Circle')})`,
'full': gettext('Full'),
'circle': gettext('Circle'),
'dense': gettext('Dense'),
-- 
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 i18n] update german translation

2022-11-21 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
thanks @ Daniel Tschlatscher and Dominik Csapak for the corrections!

 de.po | 28 
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/de.po b/de.po
index c7b21a3..c5ab411 100644
--- a/de.po
+++ b/de.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Mon Nov 21 11:17:22 2022\n"
-"PO-Revision-Date: 2022-11-21 10:40+0100\n"
+"PO-Revision-Date: 2022-11-21 11:54+0100\n"
 "Last-Translator: Proxmox Support Team \n"
 "Language-Team: German\n"
 "Language: de\n"
@@ -432,7 +432,7 @@ msgstr "Alle"
 
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:202
 msgid "All Cores"
-msgstr "Alle Cores"
+msgstr "Alle Kerne"
 
 #: pve-manager/www/manager6/qemu/PCIEdit.js:151
 msgid "All Functions"
@@ -509,7 +509,7 @@ msgstr "Während der Token-Registrierung ist ein Fehler 
aufgetreten."
 
 #: pve-manager/www/manager6/dc/OptionView.js:458
 msgid "Applies to new edits"
-msgstr ""
+msgstr "Wird auf neue Änderungen angewandt"
 
 #: proxmox-widget-toolkit/src/window/LanguageEdit.js:45
 #: pmg-gui/js/SpamDetectorCustom.js:81 pve-manager/www/manager6/ceph/OSD.js:237
@@ -1136,7 +1136,7 @@ msgstr "Kann Image nicht entfernen, ein Gast mit VMID 
'{0}' existiert!"
 
 #: pve-manager/www/manager6/node/ZFS.js:53
 msgid "Cannot use reserved pool name"
-msgstr ""
+msgstr "Reservierter Poolname kann nicht benutzt werden"
 
 #: pve-manager/www/manager6/form/StorageSelector.js:40
 msgid "Capacity"
@@ -1150,7 +1150,7 @@ msgstr "Cartridge-Memory"
 #: pve-manager/www/manager6/dc/OptionView.js:348
 #: pve-manager/www/manager6/dc/OptionView.js:457
 msgid "Case-Sensitive"
-msgstr ""
+msgstr "Groß- und Kleinschreibung beachten"
 
 #: proxmox-backup/www/tape/ChangerStatus.js:797
 #: proxmox-backup/www/tape/DriveStatus.js:247
@@ -1440,9 +1440,8 @@ msgid "Cluster Nodes"
 msgstr "Cluster Knoten"
 
 #: pve-manager/www/manager6/dc/OptionView.js:141
-#, fuzzy
 msgid "Cluster Resource Scheduling"
-msgstr "Cluster Ressourcen (durchschnitt)"
+msgstr "Cluster Ressourcen Planung"
 
 #: pmg-gui/js/Dashboard.js:469
 msgid "Cluster Resources (average)"
@@ -1824,7 +1823,7 @@ msgstr ""
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:130
 #: pve-manager/www/manager6/window/Restore.js:322
 msgid "Cores"
-msgstr "Cores"
+msgstr "Kerne"
 
 #: pve-manager/www/manager6/ceph/CephInstallWizard.js:86
 #: pve-manager/www/manager6/ceph/CephInstallWizard.js:118
@@ -3790,9 +3789,8 @@ msgid "HA Group"
 msgstr "HA Gruppe"
 
 #: pve-manager/www/manager6/dc/OptionView.js:149
-#, fuzzy
 msgid "HA Scheduling"
-msgstr "GC Zeitplan"
+msgstr "HA Planung"
 
 #: pve-manager/www/manager6/dc/OptionView.js:120
 msgid "HA Settings"
@@ -4243,7 +4241,7 @@ msgstr "Ungültiger Wert"
 
 #: pve-manager/www/manager6/node/ZFS.js:56
 msgid "Invalid characters in pool name"
-msgstr ""
+msgstr "Unzulässige Zeichen im Poolname"
 
 #: pve-manager/www/manager6/Utils.js:1492
 msgid "Invalid file size"
@@ -4831,12 +4829,11 @@ msgid "MTU"
 msgstr ""
 
 #: pve-manager/www/manager6/qemu/NetworkEdit.js:122
-#, fuzzy
 msgid ""
 "MTU needs to be >= 576 or 1 to inherit the MTU from the underlying bridge."
 msgstr ""
-"Verwenden Sie den Wert '1' um die MTU Einstellung der zugrundeliegenden "
-"Bridge zu verwenden."
+"Die MTU muss entweder ein Wert >= 576 sein, oder 1, um den Wert der "
+"zugrundeliegenden Bridge zu übernehmen."
 
 #: pve-manager/www/manager6/qemu/HardwareView.js:157
 #: pve-manager/www/manager6/qemu/MachineEdit.js:76
@@ -6700,7 +6697,6 @@ msgid "Pre-Enroll keys"
 msgstr "Pre-Enroll Schlüssel"
 
 #: pve-manager/www/manager6/dc/OptionView.js:488
-#, fuzzy
 msgid "Pre-defiend:"
 msgstr "Vordefiniert:"
 
@@ -9673,7 +9669,7 @@ msgstr "Total NetOut"
 
 #: pve-manager/www/manager6/qemu/ProcessorEdit.js:147
 msgid "Total cores"
-msgstr "Total cores"
+msgstr "Gesamtzahl der Kerne"
 
 #: pmg-gui/js/MailTracker.js:228 pmg-gui/js/NavigationTree.js:140
 msgid "Tracking Center"
-- 
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 i18n 2/2] minor improves to the spanish translation

2022-11-29 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
just fixed some low-hanging fruits. this could use a lot more love,
but i doubt i'll manage everything with my limited spanish skills.


 es.po | 68 +++
 1 file changed, 31 insertions(+), 37 deletions(-)

diff --git a/es.po b/es.po
index ad14271..3fc48f8 100644
--- a/es.po
+++ b/es.po
@@ -8,7 +8,7 @@ msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: Tue Nov 29 12:43:10 2022\n"
-"PO-Revision-Date: 2018-06-07 10:38+0200\n"
+"PO-Revision-Date: 2022-11-29 14:00+0100\n"
 "Last-Translator: Cesar Peschiera \n"
 "Language-Team: Spanish\n"
 "Language: es\n"
@@ -16,7 +16,7 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 "Plural-Forms: nplurals=2; plural=(n != 1);\n"
-"X-Generator: Poedit 2.0.7\n"
+"X-Generator: Poedit 2.4.2\n"
 "X-Poedit-SourceCharset: UTF-8\n"
 
 #: proxmox-backup/www/SystemConfiguration.js:12
@@ -44,7 +44,7 @@ msgstr "/some/path"
 
 #: pmg-gui/js/PBSConfig.js:39
 msgid "5 Minutes"
-msgstr ""
+msgstr "5 Minutos"
 
 #: proxmox-backup/www/window/TrafficControlEdit.js:284
 msgid "A comma-separated list of networks to apply the (shared) limit."
@@ -108,7 +108,7 @@ msgstr ""
 #: proxmox-backup/www/panel/AccessControl.js:30
 #: proxmox-backup/www/window/ACLEdit.js:46
 msgid "API Token"
-msgstr ""
+msgstr "Token de la API"
 
 #: pve-manager/www/manager6/dc/ACLView.js:40
 #: pve-manager/www/manager6/dc/ACLView.js:223
@@ -139,7 +139,7 @@ msgstr ""
 
 #: proxmox-backup/www/window/TokenEdit.js:15
 msgid "API token"
-msgstr ""
+msgstr "Token de la API"
 
 #: proxmox-widget-toolkit/src/node/APTRepositories.js:146
 msgid "APT Repositories"
@@ -157,7 +157,7 @@ msgstr "Aceptar TOS"
 #: proxmox-backup/www/NavigationTree.js:48
 #: proxmox-backup/www/panel/AccessControl.js:6
 msgid "Access Control"
-msgstr ""
+msgstr "Control de Acceso"
 
 #: proxmox-widget-toolkit/src/window/ACMEAccount.js:154
 #: pmg-gui/js/LDAPConfig.js:248 pmg-gui/js/LDAPUserEditor.js:43
@@ -199,7 +199,7 @@ msgstr "Acción '{0}' por '{1}' elementos"
 
 #: pmg-gui/js/Utils.js:760 pmg-gui/js/Utils.js:871
 msgid "Action '{0}' successful"
-msgstr ""
+msgstr "Acción '{0}' exitosa"
 
 #: pmg-gui/js/NavigationTree.js:22 pmg-gui/js/Utils.js:58
 msgid "Action Objects"
@@ -463,7 +463,7 @@ msgstr "Acciónes masivas"
 
 #: proxmox-backup/www/datastore/Content.js:1125
 msgid "All OK"
-msgstr ""
+msgstr "Todo bien"
 
 #: proxmox-backup/www/datastore/Content.js:1121
 msgid "All OK (old)"
@@ -492,7 +492,7 @@ msgstr "Filtro IP"
 
 #: pve-manager/www/manager6/node/ZFS.js:240 proxmox-backup/www/ZFSList.js:77
 msgid "Allocated"
-msgstr ""
+msgstr "Asignado"
 
 #: proxmox-backup/www/tape/PoolConfig.js:116
 #: proxmox-backup/www/tape/form/PoolSelector.js:30
@@ -519,7 +519,7 @@ msgstr "Caracteres permitidos"
 #: pve-manager/www/manager6/Utils.js:1937
 #: pve-manager/www/manager6/Utils.js:1939
 msgid "Alphabetical"
-msgstr ""
+msgstr "Alfabético"
 
 #: pmg-gui/js/PBSRemoteEdit.js:87
 #: pve-manager/www/manager6/dc/BackupJobDetail.js:214
@@ -546,7 +546,7 @@ msgstr ""
 #: pve-manager/www/manager6/node/ACME.js:368
 #: pve-manager/www/manager6/sdn/StatusView.js:42
 msgid "Apply"
-msgstr ""
+msgstr "Aplicar"
 
 #: proxmox-backup/www/window/TrafficControlEdit.js:300
 #, fuzzy
@@ -1206,7 +1206,7 @@ msgstr "Caché"
 
 #: pve-manager/www/manager6/form/TagEdit.js:321
 msgid "Cancel Edit"
-msgstr ""
+msgstr "Cancelar la edición"
 
 #: pve-manager/www/manager6/storage/ImageView.js:52
 #, fuzzy
@@ -1239,7 +1239,7 @@ msgstr ""
 #: proxmox-backup/www/tape/DriveStatus.js:247
 #: proxmox-backup/www/tape/TapeInventory.js:264
 msgid "Catalog"
-msgstr ""
+msgstr "Catálogo"
 
 #: proxmox-backup/www/Utils.js:400
 #, fuzzy
@@ -1406,7 +1406,7 @@ msgstr "Orden de arranque"
 #: pve-manager/www/manager6/Utils.js:1929
 #: pve-manager/www/manager6/Utils.js:1931
 msgid "Circle"
-msgstr ""
+msgstr "Círculo"
 
 #: pmg-gui/js/VirusDetectorConfiguration.js:18
 msgid "ClamAV"
@@ -2155,7 +2155,7 @@ msgstr "Mantenga correos antiguos"
 
 #: proxmox-backup/www/tape/TapeInventory.js:138
 msgid "Damaged"
-msgstr ""
+msgstr "Dañado"
 
 #: pmg-gui/js/Dashboard.

[pve-devel] [PATCH i18n 1/2] update german translation

2022-11-29 Thread Stefan Sterz
Signed-off-by: Stefan Sterz 
---
 de.po | 31 +--
 1 file changed, 13 insertions(+), 18 deletions(-)

diff --git a/de.po b/de.po
index dc08a87..2b39b4b 100644
--- a/de.po
+++ b/de.po
@@ -7,8 +7,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: proxmox translations\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: Tue Nov 29 12:43:10 2022\n"
-"PO-Revision-Date: 2022-11-21 11:54+0100\n"
+"POT-Creation-Date: Tue Nov 29 12:37:08 2022\n"
+"PO-Revision-Date: 2022-11-29 13:07+0100\n"
 "Last-Translator: Proxmox Support Team \n"
 "Language-Team: German\n"
 "Language: de\n"
@@ -452,7 +452,7 @@ msgstr "Alles OK, Sie haben produktionsreife Repositories 
konfiugriert!"
 
 #: proxmox-backup/www/datastore/OptionView.js:16
 msgid "All backup snapshots and their data will be permanently destroyed!"
-msgstr ""
+msgstr "Alle Snapshots und die dazugehörigen Daten werden dauerhaft gelöscht!"
 
 #: proxmox-widget-toolkit/src/panel/DiskList.js:402
 msgid "All data on the device will be lost!"
@@ -1310,9 +1310,8 @@ msgstr ""
 
 #: proxmox-backup/www/Utils.js:731
 #: proxmox-backup/www/datastore/OptionView.js:234
-#, fuzzy
 msgid "Chunk Order"
-msgstr "Reihenfolge"
+msgstr "Chunk Reihenfolge"
 
 #: pve-manager/www/manager6/Utils.js:1929
 #: pve-manager/www/manager6/Utils.js:1931
@@ -2167,9 +2166,8 @@ msgid "Default (Always)"
 msgstr "Default (Immer)"
 
 #: proxmox-backup/www/window/NotifyOptions.js:18
-#, fuzzy
 msgid "Default (Errors)"
-msgstr "Default (Immer)"
+msgstr "Default (Errors)"
 
 #: proxmox-backup/www/tape/window/TapeRestore.js:39
 msgid "Default Datastore"
@@ -2356,7 +2354,7 @@ msgstr "Entferne Namespace '{0}'"
 
 #: proxmox-backup/www/datastore/OptionView.js:43
 msgid "Destroy all data (dangerous!)"
-msgstr ""
+msgstr "Alle Daten löschen (gefährlich!)"
 
 #: pve-manager/www/manager6/Utils.js:2040
 msgid "Destroy image from unknown guest"
@@ -4216,9 +4214,8 @@ msgid "Initialize Disk with GPT"
 msgstr "Initialisiere Disk mit GPT"
 
 #: proxmox-backup/www/Utils.js:714 proxmox-backup/www/Utils.js:716
-#, fuzzy
 msgid "Inode"
-msgstr "Knoten"
+msgstr "Inode"
 
 #: pve-manager/www/manager6/grid/FirewallOptions.js:117
 #: pve-manager/www/manager6/grid/FirewallOptions.js:122
@@ -4269,7 +4266,7 @@ msgstr "Ungültiger Wert"
 
 #: pve-manager/www/manager6/node/ZFS.js:56
 msgid "Invalid characters in pool name"
-msgstr "Unzulässige Zeichen im Poolname"
+msgstr "Unzulässige Zeichen im Poolnamen"
 
 #: pve-manager/www/manager6/Utils.js:1492
 msgid "Invalid file size"
@@ -5515,7 +5512,7 @@ msgstr ""
 
 #: proxmox-backup/www/window/NamespaceEdit.js:44
 msgid "Namespace Name"
-msgstr ""
+msgstr "Namespace-Name"
 
 #: proxmox-backup/www/tape/window/TapeRestore.js:582
 msgid "Need at least one mapping"
@@ -6596,7 +6593,7 @@ msgstr "Bitte einen Kontakt auswählen"
 
 #: pmg-gui/js/ReceiverStatistics.js:11
 msgid "Please select a receiver."
-msgstr "Bitte einen Empfänger auswählen"
+msgstr "Bitte einen Empfänger auswählen."
 
 #: pmg-gui/js/RuleInfo.js:251
 msgid "Please select a rule."
@@ -6605,7 +6602,7 @@ msgstr "Bitte selektieren Sie eine Regel."
 #: pmg-gui/js/ReceiverStatistics.js:31 pmg-gui/js/SenderStatistics.js:11
 #: pmg-gui/js/SenderStatistics.js:31
 msgid "Please select a sender."
-msgstr "Bitte einen Sender auswählen"
+msgstr "Bitte einen Sender auswählen."
 
 #: pmg-gui/js/ObjectGroup.js:14
 msgid "Please select an object."
@@ -9095,9 +9092,8 @@ msgstr "Sync-Jobs"
 
 #: proxmox-backup/www/Utils.js:736
 #: proxmox-backup/www/datastore/OptionView.js:242
-#, fuzzy
 msgid "Sync Level"
-msgstr "Sync. Vorschau"
+msgstr "Sync. Level"
 
 #: proxmox-widget-toolkit/src/window/AuthEditBase.js:57
 #: pve-manager/www/manager6/dc/AuthEditBase.js:119
@@ -9761,9 +9757,8 @@ msgstr "Di."
 
 #: proxmox-backup/www/datastore/OptionView.js:206
 #: proxmox-backup/www/datastore/OptionView.js:210
-#, fuzzy
 msgid "Tuning Options"
-msgstr "Prune-Optionen"
+msgstr "Tuning Optionen"
 
 #: pve-manager/www/manager6/dc/Config.js:106
 msgid "Two Factor"
-- 
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 pve-docs v2] updated tags docs

2022-12-14 Thread Stefan Sterz
On 12/13/22 15:56, Noel Ullreich wrote:
> updated the tags doc with slight rephrasing, corrected grammar,
> and fixed typos.
> 
> Signed-off-by: Noel Ullreich 
> ---
> changes since v1:
> * removed changes in datacenter.cfg.5-opts.adoc since it is an
> autogenerated file (thanks @Dominik;) )
>  pve-gui.adoc | 70 +---
>  1 file changed, 34 insertions(+), 36 deletions(-)
> 
> diff --git a/pve-gui.adoc b/pve-gui.adoc
> index ff95cfb..d6d9426 100644
> --- a/pve-gui.adoc
> +++ b/pve-gui.adoc
> @@ -386,68 +386,66 @@ Tags
>  
>  [thumbnail="screenshot/gui-qemu-summary-tags-edit.png", float="left"]
>  
> -For organizational purposes, it is possible to set `tags` on guests. These 
> have
> -currently only informational value and they are display by default in the gui
> -in two places, the `Resource Tree` and in the status line when a guest is
> -selected.
> +For organizational purposes, it is possible to set `tags` for guests.
> +Currently, these only provide informational value to users.
> +Tags are displayed in two places in the web interface: in the `Resource 
> Tree` and
> +in the status line when a guest ist selected.
>  

typo: ist/is

> -They can be added, edited and removed in that status line of the guest by
> -clicking on the `pencil` icon. After the tags have the desired values, you
> -can click on the `check mark` button to apply the changes, or click the
> -`X` button to cancel you editing.
> +Tags can be added, edited, and removed in the status line of the guest by
> +clicking on the `pencil` icon. You can add multiple tags by pressing the `+`
> +button and remove them by pressing the `-` button and save or cancel the 
> changes
> +with the `checkmark` and `x` button respectively.
>  

imo: it is a bit clumsy to use three "and"s in a row here. it might be
nice to replace the first one with a comma (…`+` button, remove them…)
or split this up into two sentences. consider something like this:

You can add multiple tags by pressing the `+` button and remove them
with the `-` button. To save or cancel the changes, you can use the
`check mark` and `x` button, respectively.

on a pedantic sidenote: "check mark" is correct in us english.
"checkmark" exists in philippine english [1].

[1]: https://en.wikipedia.org/wiki/Check_mark

> -The tags can also be set via the CLI, where multiple tags are semi-colon
> -separated, for example:
> +Tags can also be set via the CLI, where multiple tags are separated by 
> semicolons.
> +For example:
>  
>  
>  # qm set ID --tags myfirsttag;mysecondtag
>  
>  
> -Styling
> -~~~
> +Style Configuration
> +~~~
>  
>  [thumbnail="screenshot/gui-datacenter-tag-style.png"]
>  
> -To adapt to various use cases and preferences, there are some options in the
> -datacenter configuration that helps an admin control the behaviour and style
> -of tags, such as the colors, ordering, and basic permission settings.
> -
> -
> -By default the tag colors are derived from their text in a deterministic way,
> -but can be overridden in the datacenter configuration (The background color 
> as
> -well as the text color) as hexadecimal RGB values. You can also set these
> -overrides via the CLI, for example:
> +By default, the tag colors are derived from their text in a deterministic 
> way.
> +The color, shape in the resource tree, and case-sensitivity, as well as how 
> tags
> +are sorted, can be customized. This can be done via the web interface under
> +__Datacenter -> Options -> Tag Style Override__. Alternatively, this can be 
> done
> +via the CLI. For example:
>  
>  
>  # pvesh set /cluster/options --tag-style color-map=example:00:FF
>  
>  
> -Sets the background color of the tag `example` to black (#00) and the 
> text
> +sets the background color of the tag `example` to black (#00) and the 
> text
>  color to white (#FF).
>  
> -You can also change the style of the tags in the tree and if the tags should
> -be alphabetically sorted (the default) or should retain their order from the
> -guest configuration.
> -
>  Permissions
>  ~~~
>  
>  [thumbnail="screenshot/gui-datacenter-options.png"]
>  
>  By default, users with the privilege `VM.Config.Options` on a guest 
> (`/vms/ID`)
> -can set any tags they want. If you want to restrict this behaviour, it is
> -possible to set various modes via the datacenter configuration:
> +can set any tags they want (see
> +xref:pveum_permission_management[Permission Management]). Under __Datacenter 
> ->
> +Options -> User Tag Access__ permissions for tag access can be set:

imo: this flowed better with the "If" clause there. consider:

By default, users with the privilege `VM.Config.Options` on a guest
(`/vms/ID`) can set any tags they want (see
xref:pveum_permission_management[Permission Management]). If you want to
restrict this behavior, appropriate permissions can be set under
__Datacenter -> Options -> User Tag Access__:

> +
> +* `free`:

Re: [pve-devel] [PATCH manager] report: filter comments in VM/CT configs

2022-12-16 Thread Stefan Sterz
On 12/15/22 17:57, Mira Limbeck wrote:
> Since some users keep their passwords in the VM/CT configs as comments
> and those are most of the time unnecessary when looking through the
> report, filter those.
> 
> In addition to the comments, also filter the `cipassword` option
> since it contains the hash of the password.
> 
> To facilitate the filtering, a new sub 'file2text' is introduced that
> can filter the file contents if required.
> This sub replaces the 'cat ...' commands.
> 
> Signed-off-by: Mira Limbeck 
> ---
> I did not add print to STDERR in file2text for now since it got quite
> chatty.
> If this is wanted, I'll send a v2 adding it. But since file2text is also
> called by dir2text the 'OK' at the end won't always align, especially
> when dir2text is used.
> 
>  PVE/Report.pm | 48 +---
>  1 file changed, 33 insertions(+), 15 deletions(-)
> 
> diff --git a/PVE/Report.pm b/PVE/Report.pm
> index 90b7cb1c..7ebe98f7 100644
> --- a/PVE/Report.pm
> +++ b/PVE/Report.pm
> @@ -5,16 +5,34 @@ use warnings;
>  
>  use PVE::Tools;
>  
> +my sub file2text {
> +my ($file, $filter) = @_;
> +my $text = "\n# cat $file\n";
> +

maybe this should be something like `cat $file | grep -v
"\(\(^\s*#\)\|\(^cipassword\)\)"` or `filtered contents of $file`? just
to make it clearer to someone that just looks at the report that we
don't *just* do a `cat` anymore, but do filter sensitive information.

although, i do think that the amount of users that know what is in the
config files and don't check what is actually in the report is probably
rather small.

> +my $contents = PVE::Tools::file_get_contents($file);
> +if ($filter) {
> + foreach my $line (split('\n', $contents)) {
> + next if $line =~ m/^\s*#/;
> + next if $line =~ m/^cipassword/;
> +
> + $text .= "$line\n";
> + }
> +} else {
> + $text .= $contents;
> +}
> +
> +return $text;
> +}
> +
>  # output the content of all the files of a directory
>  my sub dir2text {
> -my ($target_dir, $regexp) = @_;
> +my ($target_dir, $regexp, $filter) = @_;
>  
>  print STDERR "dir2text '${target_dir}${regexp}'...";
>  my $text = '';
>  PVE::Tools::dir_glob_foreach($target_dir, $regexp, sub {
>   my ($file) = @_;
> - $text .=  "\n# cat $target_dir$file\n";
> - $text .= PVE::Tools::file_get_contents($target_dir.$file)."\n";
> + $text .= file2text($target_dir.$file, $filter)."\n";
>  });
>  return $text;
>  }
> @@ -30,9 +48,9 @@ my $init_report_cmds = sub {
>   cmds => [
>   'hostname',
>   'pveversion --verbose',
> - 'cat /etc/hosts',
> + sub { file2text('/etc/hosts') },
>   'pvesubscription get',
> - 'cat /etc/apt/sources.list',
> + sub { file2text('/etc/apt/sources.list') },
>   sub { dir2text('/etc/apt/sources.list.d/', '.*list') },
>   sub { dir2text('/etc/apt/sources.list.d/', '.*sources') },
>   'lscpu',
> @@ -50,9 +68,9 @@ my $init_report_cmds = sub {
>   storage => {
>   order => 30,
>   cmds => [
> - 'cat /etc/pve/storage.cfg',
> + sub { file2text('/etc/pve/storage.cfg') },
>   'pvesm status',
> - 'cat /etc/fstab',
> + sub { file2text('/etc/fstab') },
>   'findmnt --ascii',
>   'df --human -T',
>   'proxmox-boot-tool status',
> @@ -62,9 +80,9 @@ my $init_report_cmds = sub {
>   order => 40,
>   cmds => [
>   'qm list',
> - sub { dir2text('/etc/pve/qemu-server/', '\d.*conf') },
> + sub { dir2text('/etc/pve/qemu-server/', '\d.*conf', 1) },
>   'pct list',
> - sub { dir2text('/etc/pve/lxc/', '\d.*conf') },
> + sub { dir2text('/etc/pve/lxc/', '\d.*conf', 1) },
>   ],
>   },
>   network => {
> @@ -73,14 +91,14 @@ my $init_report_cmds = sub {
>   'ip -details -statistics address',
>   'ip -details -4 route show',
>   'ip -details -6 route show',
> - 'cat /etc/network/interfaces',
> + sub { file2text('/etc/network/interfaces') },
>   ],
>   },
>   firewall => {
>   order => 50,
>   cmds => [
>   sub { dir2text('/etc/pve/firewall/', '.*fw') },
> - 'cat /etc/pve/local/host.fw',
> + sub { file2text('/etc/pve/local/host.fw') },
>   'iptables-save',
>   ],
>   },
> @@ -89,7 +107,7 @@ my $init_report_cmds = sub {
>   cmds => [
>   'pvecm nodes',
>   'pvecm status',
> - 'cat /etc/pve/corosync.conf 2>/dev/null',
> + sub { file2text('/etc/pve/corosync.conf') },
>   'ha-manager status',
>   ],
>   },
> @@ -135,7 +153,7 @@ my $init_report_cmds = sub {
>   'ceph df',
>

[pve-devel] [PATCH qemu-server] cdrom handling: default to "none" if no physical drive is available

2022-12-16 Thread Stefan Sterz
when a vm is configured to use the physical cd rom drive but there is
no such drive a cryptic "uninitialized value" error is thrown. this
is due to the `$path` not being defined in `sub
print_drive_commandline_full` in this case. warn that no cd rom drive
is available and default back to using "none" as media instead.

note that the error was basically cosmetic as the vm would start just
fine.

forum thread: 
https://forum.proxmox.com/threads/use-of-uninitialized-value-path-in-pattern-match-m-at-usr-share-perl5-pve-qemuserver-pm-line-1622.119592/

Signed-off-by: Stefan Sterz 
---
 PVE/QemuServer.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index dd6ea3e..bc935df 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -1292,6 +1292,9 @@ sub get_cdrom_path {
 return $cdrom_path = "/dev/cdrom" if -l "/dev/cdrom";
 return $cdrom_path = "/dev/cdrom1" if -l "/dev/cdrom1";
 return $cdrom_path = "/dev/cdrom2" if -l "/dev/cdrom2";
+
+warn "there is no physical cdrom drive that can be used. defaulting back 
to 'none'.";
+return '';
 }
 
 sub get_iso_path {
-- 
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 pve-docs v3] updated tags docs

2022-12-19 Thread Stefan Sterz
lgtm. consider this:

Reviewed-by: Stefan Sterz 

On 12/15/22 15:20, Noel Ullreich wrote:
> updated the tags doc with slight rephrasing, corrected grammar,
> and fixed typos.
> 
> Signed-off-by: Noel Ullreich 
> ---
> changes since v1:
> * removed changes in datacenter.cfg.5-opts.adoc since it is an
> autogenerated file (thanks @Dominik;) )
> 
> changes since v2:
> * fixed two typos and rephrased two sentences (thanks @Sterzy)
> 
>  pve-gui.adoc | 71 ++--
>  1 file changed, 35 insertions(+), 36 deletions(-)
> 
> diff --git a/pve-gui.adoc b/pve-gui.adoc
> index ff95cfb..4292ca2 100644
> --- a/pve-gui.adoc
> +++ b/pve-gui.adoc
> @@ -386,68 +386,67 @@ Tags
>  
>  [thumbnail="screenshot/gui-qemu-summary-tags-edit.png", float="left"]
>  
> -For organizational purposes, it is possible to set `tags` on guests. These 
> have
> -currently only informational value and they are display by default in the gui
> -in two places, the `Resource Tree` and in the status line when a guest is
> -selected.
> +For organizational purposes, it is possible to set `tags` for guests.
> +Currently, these only provide informational value to users.
> +Tags are displayed in two places in the web interface: in the `Resource 
> Tree` and
> +in the status line when a guest is selected.
>  
> -They can be added, edited and removed in that status line of the guest by
> -clicking on the `pencil` icon. After the tags have the desired values, you
> -can click on the `check mark` button to apply the changes, or click the
> -`X` button to cancel you editing.
> +Tags can be added, edited, and removed in the status line of the guest by
> +clicking on the `pencil` icon. You can add multiple tags by pressing the `+`
> +button and remove them by pressing the `-` button. To save or cancel the 
> changes,
> +you can use the `✓` and `x` button respectively.
>  
> -The tags can also be set via the CLI, where multiple tags are semi-colon
> -separated, for example:
> +Tags can also be set via the CLI, where multiple tags are separated by 
> semicolons.
> +For example:
>  
>  
>  # qm set ID --tags myfirsttag;mysecondtag
>  
>  
> -Styling
> -~~~
> +Style Configuration
> +~~~
>  
>  [thumbnail="screenshot/gui-datacenter-tag-style.png"]
>  
> -To adapt to various use cases and preferences, there are some options in the
> -datacenter configuration that helps an admin control the behaviour and style
> -of tags, such as the colors, ordering, and basic permission settings.
> -
> -
> -By default the tag colors are derived from their text in a deterministic way,
> -but can be overridden in the datacenter configuration (The background color 
> as
> -well as the text color) as hexadecimal RGB values. You can also set these
> -overrides via the CLI, for example:
> +By default, the tag colors are derived from their text in a deterministic 
> way.
> +The color, shape in the resource tree, and case-sensitivity, as well as how 
> tags
> +are sorted, can be customized. This can be done via the web interface under
> +__Datacenter -> Options -> Tag Style Override__. Alternatively, this can be 
> done
> +via the CLI. For example:
>  
>  
>  # pvesh set /cluster/options --tag-style color-map=example:00:FF
>  
>  
> -Sets the background color of the tag `example` to black (#00) and the 
> text
> +sets the background color of the tag `example` to black (#00) and the 
> text
>  color to white (#FF).
>  
> -You can also change the style of the tags in the tree and if the tags should
> -be alphabetically sorted (the default) or should retain their order from the
> -guest configuration.
> -
>  Permissions
>  ~~~
>  
>  [thumbnail="screenshot/gui-datacenter-options.png"]
>  
>  By default, users with the privilege `VM.Config.Options` on a guest 
> (`/vms/ID`)
> -can set any tags they want. If you want to restrict this behaviour, it is
> -possible to set various modes via the datacenter configuration:
> +can set any tags they want (see
> +xref:pveum_permission_management[Permission Management]). If you want to
> +restrict this behavior, appropriate permissions can be set under
> +__Datacenter -> Options -> User Tag Access__:
> +
> +* `free`: users are not restricted in setting tags (Default)
> +* `list`: users can set tags based on a predefined list of tags
> +* `existing`: like list but users can also use already existing tags
> +* `none`: users are restricted from using tags
> +
> +The same can also be done via the CLI.
>  
> -* a list of allowed tags
> -* existing tags
>

Re: [pve-devel] [PATCH qemu-server] cdrom handling: default to "none" if no physical drive is available

2022-12-19 Thread Stefan Sterz
On 12/19/22 10:23, Fiona Ebner wrote:
> Am 16.12.22 um 16:08 schrieb Stefan Sterz:
>> when a vm is configured to use the physical cd rom drive but there is
>> no such drive a cryptic "uninitialized value" error is thrown. this
>> is due to the `$path` not being defined in `sub
>> print_drive_commandline_full` in this case. warn that no cd rom drive
>> is available and default back to using "none" as media instead.
>>
>> note that the error was basically cosmetic as the vm would start just
>> fine.
>>
>> forum thread: 
>> https://forum.proxmox.com/threads/use-of-uninitialized-value-path-in-pattern-match-m-at-usr-share-perl5-pve-qemuserver-pm-line-1622.119592/
> 
> Note that the thread title is not needed for the link to work:
> https://forum.proxmox.com/threads/119592/
> Would avoid the long line in the commit message :)

oh, thanks for the hint! :)

> 
>>
>> Signed-off-by: Stefan Sterz 
>> ---
>>  PVE/QemuServer.pm | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
>> index dd6ea3e..bc935df 100644
>> --- a/PVE/QemuServer.pm
>> +++ b/PVE/QemuServer.pm
>> @@ -1292,6 +1292,9 @@ sub get_cdrom_path {
>>  return $cdrom_path = "/dev/cdrom" if -l "/dev/cdrom";
>>  return $cdrom_path = "/dev/cdrom1" if -l "/dev/cdrom1";
>>  return $cdrom_path = "/dev/cdrom2" if -l "/dev/cdrom2";
>> +
>> +warn "there is no physical cdrom drive that can be used. defaulting 
>> back to 'none'.";
> 
> Missing newline at the end of the warning message. Perl will auto-attach
> module and line number then, which gets ugly from a user perspective ;)
> 
> Nit: CD-ROM instead of cdrom
> 
> IMHO "defaulting back to 'none'." is a bit misleading. We don't actually
> do that in the code, just also return an empty path. And it might sound
> a bit weird to users with the quoted 'none'. Maybe the first sentence is
> already enough or you can reword the message a bit?
> 
>> +return '';
> 
> Should we cache the fact that there is no drive too? Would potentially
> avoid printing the warning multiple times and testing again.
> 
>>  }
>>  
>>  sub get_iso_path {



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



  1   2   >