This is due the API call returning a "download" object (as seen above),
which contains (among some other things) a file handle to read the
response from.
With this patch, the response from such endpoints is now correctly read
and displayed. Only handles combinations of `Content-Encoding` == 'gzip'
and either 'text/plain' or 'application/json' for `Content-Type`.
This tries to mimic the behavior of the API server implementation when
encountering `download` objects.
Tested this with all four output formats 'text', 'json', 'json-pretty'
and 'yaml', as well as "cross-node" in a local test cluster.
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
Thomas Lamprecht [Tue, 10 Oct 2023 13:29:21 +0000 (15:29 +0200)]
ui: ceph warnings: lower opacity for no-details text
to make it more clear that this is not the details, but a UI text
placeholder.
Add a `pmx-faded` class that reduced opacity, as there where recent
discussion about adding such a utility class to widget-toolkit anyway.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Thomas Lamprecht [Tue, 10 Oct 2023 06:19:33 +0000 (08:19 +0200)]
ui: ceph warnings: use normal font-weight
The use of the <pre> tag will result in font-family `monospace`, and
monospace fonts are often a bit odd w.r.t. size and weight. E.g.,
without this I get a light-font selected, which is hardly visible.
Set the weight to normal, which should not hurt those that got a
better font selection by there system/browser already.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Thomas Lamprecht [Tue, 10 Oct 2023 06:17:29 +0000 (08:17 +0200)]
ui: ceph warnings: render whitespace as pre-wrap
To avoid potential horizontal scrolling on smaller screens, which can
be a PITA as the scroll bar is at the bottom, so users have to scroll
down to move it left and right..
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Aaron Lauterer [Mon, 2 Oct 2023 09:00:26 +0000 (11:00 +0200)]
ui: ceph: improve discoverability of warning details
by
* replacing the info button with expandable rows that contain the
details of the warning
* adding two action buttons to copy the summary and details
* making the text selectable
The row expander works like the one in the mail gateway tracking center
-> doubleclick only opens it.
The height of the warning grid is limited to not grow too large.
A Diffstore is used to avoid expanded rows being collapsed on an update.
The rowexpander cannot hide the toggle out of the box. Therefore, if
there is no detailed message for a warning, we show a placeholder text.
We could consider extending it in the future to only show the toggle if
a defined condition is met.
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com> Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
We already trim correctly in the API endpoint's code, but that happens
after the parameter verification from the REST server, and as
patterns are anchored between ^$pattern$ there by default, it fails if
someone sends some whitespace before/after the actual key.
Simply allow arbitrary whitespace, but only at the API endpoint
itself, do not adapt the subscription pattern to avoid that an actual
whitespace sneaks in and let some lower level code throw up on it.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
ui: vm selector: gracefully handle empty IDs in setValue function
An empty string is passed by the backup job window when using
selection mode 'all', would be converted to [""] and wrongly add an
entry with VMID 0 because the item "" could not be found in the store.
Reported in the community forum:
https://forum.proxmox.com/threads/130164/
Fixes: 7a5ca76a ("fix #4239: ui: show selected but non-existing vmids in backup edit") Suggested-by: Dominik Csapak <d.csapak@proxmox.com> Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
For Fedora 38 the systemd shared object files used to check the systemd
version are located at /usr/lib64/systemd or /usr/lib/systemd.
Therefore, include /usr/lib64/systemd in the list of directories to
check.
Further, Fedora 38 adds a fc38 postfix to the filename, so expand the
regex to cover that as well.
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Thomas Lamprecht [Tue, 26 Sep 2023 15:55:34 +0000 (17:55 +0200)]
ui: avoid trivial decompression widget, only used once
Currently it was only used once and it had not really any benefit, as
the one thing it did is defining a list of compressors – the
KVComboBox is made such, so that this can be done on definition
directly, no need for inheritance.
Also, if one would think about adopting this more for other similar
selectors: While we have some uses of compressors all over the place,
and most of them are not really coupled to each other, so having a
single widget for them does not make sense.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Philipp Hufnagl [Thu, 21 Sep 2023 13:09:17 +0000 (15:09 +0200)]
fix #4849: ui: allow decompressing ISO files when downloading
The compression algorithm will be automatically detected when querying the
download URL. It can be overriden by the user using the "compression algorithm"
drop down under advanced.
Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
Reworded title and message, updated d/control for libpve-storage-perl version Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com> Reviewed-by: Dominik Csapak <d.csapak@proxmox.com> Tested-by: Dominik Csapak <d.csapak@proxmox.com>
extend the query_url_metadata endpoint with the option to detect and return
used compression algorithms, if supported by PVE. this will be used to support
decompression as part of the download flow for certain file types (ISO files
for now).
api: pool update: rename 'transfer' parameter to 'allow-move'
The 'allow' wording makes it clearer that we just not block something,
but do not really do anything else. And we use the 'move' wording also
for when moving volumes between guests, which is in the same spirit as
this here (remove something from a entity and add it to another).
While this was already bumped, we did not move it outside of pvetest,
so I do not see practical concerns with API breakage.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
fix #4808: ceph: mds create: use snake_case when setting options
As suggested in [1], it is recommended to use `_` in all cases when
dealing with config files. Note that this is for creation only, and we
enforce that there cannot be an existing MDS with the same ID, so we
do not have to bother how ceph would handle the case where both exist.
api: ceph osd: factor out getting PSS stat & improve error handling
Do not crowd the higher level API endpoint handler code directly with
some rather low level procfs parsing code, rather factor that out in a
helper. Make said helper private for now so that anybody wanting to
use cannot do so, and thus increase the chance that said dev will
actually think about if this makes sense as is as a general interface.
Avoid fatal die's for the odd case that the smaps_rollup file cannot
be opened, or the even less likely case where PSS stats cannot be
found in the content.
The former could happen due to the general TOCTOU race here, i.e., the
PID we get from systemctl service status parsing isn't guaranteed to
exist anymore when we read from procfs, and if, it's actually not
guaranteed to still be the OSD - but we cannot easily use pidfd's
here and OSD stops are not something that happens frequently, but in
anyway avoid that such a thing fails the whole API call only because a
single metric is affected.
In the long rung it might be better to add a "errors" array to the
response, so that the user can be informed about such an (odd) thing
happening.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
api: ceph osd: drop unused variable and useless intermediate code
$raw isn't used anywhere here and probably just a left over from copy
pasting, and the "int cast ternary" can be avoided by just directly
casting to int when assigning the variable in the first place.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Stefan Hanreich [Mon, 4 Sep 2023 09:18:07 +0000 (11:18 +0200)]
api: ceph: improve reporting of ceph OSD memory usage
Currently we are using the MemoryCurrent property of the OSD service
to determine the used memory of a Ceph OSD. This includes, among other
things, the memory used by buffers [1]. Since BlueFS uses buffered
I/O, this can lead to extremely high values shown in the UI.
Instead we are now reading the PSS value from the proc filesystem,
which should more accurately reflect the amount of memory currently
used by the Ceph OSD.
Aaron and I decided on PSS over RSS, since this should give a better
idea of used memory - particularly when using a large amount of OSDs
on one host, since the OSDs share some of the pages.
ui: replication: backup: use renderEnabledIcon to render the enabled column
The new helper is available since proxmox-widget-toolkit version 3.6.1
which we can be sure to be available since a while in praxis, but
definitively by d/control constraints, since 51f54177 ("bump
proxmox-widget-toolkit dependency to 4.0.7")
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
[TL: add context since when this function is available ] Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Lukas Wagner [Fri, 25 Aug 2023 09:45:12 +0000 (11:45 +0200)]
vzdump: fix notifications for backing up VMs with 2+ disks to PBS
In some situations, such as backing up VMs with 2 or more disks to
PBS, we get passed the backup archive size as a string instead of
as an integer. This led to errors rendering the notification template
down the line.
This commit explicitly casts the data from the task table to an int.
It would be a good idea to actually hunt down the places that produced
the string instead of an integer, but as a quick fix and as a
safeguard against similar lurking errors this approach is fine, IMO.
Christian Ebner [Fri, 11 Aug 2023 10:46:54 +0000 (12:46 +0200)]
website: update external links to www.proxmox.com
During the redesign of www.proxmox.com the menu structure and therefore
some url changed. Update the external link in order to avoid an
unneccessary redirect
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Filip Schauer [Wed, 16 Aug 2023 09:54:57 +0000 (11:54 +0200)]
fix #4663: Prevent Web UI reload on cert order for other node
While it makes sense to reload the Web UI after ordering a certificate
for the same node, it is unnecessary to reload the Web UI when ordering
a certificate for a different node.
Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
Lukas Wagner [Thu, 3 Aug 2023 12:17:13 +0000 (14:17 +0200)]
api: notification: make the 'mail-to-root' target visible to any user
Since the target does not require Mapping.Use, it should also be
visible and testable by all users.
Short explanation why the 'mail-to-root' is exempt from priv checks:
To ensure backwards compatibility, the 'mail-to-root' target does not
require the `Mapping.Use` privs. This is needed due to the fact that
this target is used as a fallback in case no other target is
configured for an event. For instance, the /node/<name>/apt/update API
call only requires Sys.Modify for the node, but it can also send a
notification. If we were to require Mapping.Use, we could break the
apt/update API compat in the case that a notification shall be sent,
but without any configured notification target (which will then
default to 'mail-to-root').
Lukas Wagner [Thu, 3 Aug 2023 12:17:04 +0000 (14:17 +0200)]
ui: backup: allow to select notification target for jobs
This commit adds a possibility to choose between different options
for notifications for backup jobs:
- Notify via email, in the same manner as before
- Notify via an endpoint/group
If 'notify via mail' is selected, a text field where an email address
can be entered is displayed:
Notify: | Always notify v |
Notify via: | E-Mail v |
Send Mail to: | foo@example.com |
Compression: | ..... v |
If the other option is selected selected, a combo picker for selecting
a channel is displayed:
Notify: | Always notify v |
Notify via: | Endpoint/Group v |
Target: | endpoint-foo v |
Compression: | ..... v |
The code has also been adapted to use the newly introduced
'notification-policy' parameter, which replaces the 'mailnotification'
paramter for backup jobs. Some logic which automatically migrates from
'mailnotification' has been added.
The API call returns all entities that can be used as notification
targets (endpoints, groups). Only targets for which the user has
appropriate permissions are returned.
Lukas Wagner [Thu, 3 Aug 2023 12:17:00 +0000 (14:17 +0200)]
api: notification: add api routes for filters
The Perl part of the API methods primarily defines the API schema,
checks for any needed priviledges and then calls the actual Rust
implementation exposed via perlmod. Any errors returned by the Rust
code are translated into PVE::Exception, so that the API call fails
with the correct HTTP error code.
Lukas Wagner [Thu, 3 Aug 2023 12:16:59 +0000 (14:16 +0200)]
api: notification: add api routes for gotify endpoints
The Perl part of the API methods primarily defines the API schema,
checks for any needed priviledges and then calls the actual Rust
implementation exposed via perlmod. Any errors returned by the Rust
code are translated into PVE::Exception, so that the API call fails
with the correct HTTP error code.
Lukas Wagner [Thu, 3 Aug 2023 12:16:58 +0000 (14:16 +0200)]
api: notification: add api routes for sendmail endpoints
The Perl part of the API methods primarily defines the API schema,
checks for any needed priviledges and then calls the actual Rust
implementation exposed via perlmod. Any errors returned by the Rust
code are translated into PVE::Exception, so that the API call fails
with the correct HTTP error code.
Lukas Wagner [Thu, 3 Aug 2023 12:16:57 +0000 (14:16 +0200)]
api: notification: add api routes for groups
The Perl part of the API methods primarily defines the API schema,
checks for any needed priviledges and then calls the actual Rust
implementation exposed via perlmod. Any errors returned by the Rust
code are translated into PVE::Exception, so that the API call fails
with the correct HTTP error code.
Lukas Wagner [Thu, 3 Aug 2023 12:16:55 +0000 (14:16 +0200)]
api: replication: send notifications via new notification module
If the new 'target-replication' option in datacenter.cfg is set to a
notification target, we send notifications that way. If it is not set,
we continue send a notification to the default target (mail to
root@pam).
There is also a new 'replication' option. It controls whether to send
a notification at all.
Lukas Wagner [Thu, 3 Aug 2023 12:16:54 +0000 (14:16 +0200)]
api: apt: send notification via new notification module
... instead of using sendmail directly
If the new 'target-package-updates' is set, we send a notification to
this target. If not, we continue to send a mail to root@pam (if the
mail address is configured)
Lukas Wagner [Thu, 3 Aug 2023 12:16:52 +0000 (14:16 +0200)]
vzdump: send notifications via new notification module
... instead of using sendmail directly.
If the new 'notification-target' parameter is set,
we send the notification to this endpoint or group.
If 'mailto' is set, we add a temporary endpoint and a
temporary group containg both targets.
This commit also refactors the old 'sendmail' sub heavily:
- Use template-based notification text instead of endless
string concatenations
- Removing the old plaintext/HTML table rendering in favor of
the new template/property-based approach offered by the
`proxmox-notify` crate.
- Rename `sendmail` sub to `send_notification`
- Breaking out some of the code into helper subs, hopefully
reducing the spaghetti factor a bit
Philipp Hufnagl [Thu, 10 Aug 2023 10:09:02 +0000 (12:09 +0200)]
fix #474: ui: allow transfer from container/vms
A user can no see all vms/containers, even the ones that are already a
member of a pool. They can be transfered now after checking the newly
introduced "allow transfer" checkbox.
Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
Philipp Hufnagl [Thu, 10 Aug 2023 10:09:01 +0000 (12:09 +0200)]
fix #474: api: allow transfer from container/vms
When the newly introduced optional parameter "transfer" is set, the user
add a vm/container to a pool even if it is already in one. If so it will
be removed from the old pool
Signed-off-by: Philipp Hufnagl <p.hufnagl@proxmox.com>
Thomas Lamprecht [Tue, 25 Jul 2023 08:12:00 +0000 (10:12 +0200)]
ui: active directory realm: expose case-sensitive option
The case-sensitive option is not really something that should be CLI
only and is quite common for Microsoft AD setups, so add it to the UI
too as requested in the Forum [0], improving discoverability.