Commit Graph

1951 Commits

Author SHA1 Message Date
Aaron Lauterer
e907f822d7 api ceph osd: add OSD index, metadata and lv-info
To get more details for a single OSD, we add two new endpoints:
* nodes/{node}/ceph/osd/{osdid}/metadata
* nodes/{node}/ceph/osd/{osdid}/lv-info

The {osdid} endpoint itself gets a new GET handler to return the index.

The metadata one provides various metadata regarding the OSD.

Such as
* process id
* memory usage
* info about devices used (bdev/block, db, wal)
    * size
    * disks used (sdX)
    ...
* network addresses and ports used
...

Memory usage and PID are retrieved from systemd while the rest can be
retrieved from the metadata provided by Ceph.

The second one (lv-info) returns the following infos for a logical
volume:
* creation time
* lv name
* lv path
* lv size
* lv uuid
* vg name

Possible volumes are:
* block (default value if not provided)
* db
* wal

'ceph-volume' is used to gather the infos, except for the creation time
of the LV which is retrieved via 'lvs'.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-by:  Dominik Csapak <d.csapak@proxmox.com>
2023-03-15 18:24:27 +01:00
Fiona Ebner
6aec456504 api: node: bulk actions: allow when user has permission for each guest
Users with permissions for some guests can already start a task for
each sequentially.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-03-15 18:21:56 +01:00
Stefan Sterz
28a93d3ed1 pveproxy/template: switch to using the "auto" theme per default
the auto theme uses media queries to detect a users preferred theme,
switch to using it per default instead of the light theme.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-03-14 15:11:42 +01:00
Thomas Lamprecht
e07c055df4 revert "fix #4333: redirect API handler output to STDERR"
Redirecting stdout is not a feasible approach, as that also affects
all run_commands and other command executions/forks done by the API
handler, and thus breaks parsing outputs of such command executions
in the API handlers.

We plan to add a `--result-fd` option instead, allowing users to pass
their own file, open FD or named pipe to the pvesh, so that they can
process the output in streaming or in full afterward afterwards.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-14 11:21:29 +01:00
Thomas Lamprecht
5ea98762aa pvesh: don't bloat the code on comments
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-11 18:10:09 +01:00
Fabian Grünbichler
89fba14715 fix #4333: redirect API handler output to STDERR
otherwise, print/warn statements by the API endpoint are included in the
output, which breaks JSON parsing in case of output-format == json*.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-03-11 18:08:00 +01:00
Dominik Csapak
2f4105013b api: return missing 'hardware' entry in node endpoint index
The 'hardware' entry was missing there. While interfacing with it
works, it will not show up during CLI auto completion and in the HTML
debug view (/api2/html/) if not listed here in the API directory
index.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-11 17:57:02 +01:00
Stefan Sterz
5137b16fd2 pveproxy/template: add support for switching themes
load the dark theme only if requested through a cookie, also adds
support for the "auto" theme that uses the dark theme based on a
media query.

this requires a bump of the widget toolkit so the dark-theme css file
is available.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-03-08 17:55:41 +01:00
Aaron Lauterer
c1eef1f4f7 report: add ceph health detail
This gives us more detailed infos about the problems Ceph currently has.
It is the last command because if PGs have issues, the list can be quite
long. Therefore, we want it at the end of the report.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2023-02-21 17:25:38 +01:00
Aaron Lauterer
c4368cf6d6 ceph osd: return PGs per OSD and show in UI
By switching from 'ceph osd tree' to the 'ceph osd df tree' mon API
equivalent , we get the same data structure with more information per
OSD. One of them is the number of PGs stored on that OSD.

The number of PGs per OSD is an important number, for example when
trying to figure out why the performance is not as good as expected.
Therefore, adding it to the OSD overview visible by default should
reduce the number of times, one needs to access the CLI.

Comparing runtime cost on a 3 node ceph cluster with 4 OSDs each doing 50k
iterations gives:

               Rate osd-df-tree    osd-tree
osd-df-tree  9141/s          --        -25%
osd-tree    12136/s         33%          --

So, while definitively a bit slower, but it's still in the µs range,
and as such below HTTP in TLS in TCP connection setup for most users,
so worth the extra useful information.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ TL: slight rewording of subject and add benchmark data ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-15 10:16:50 +01:00
Max Carrara
0fb89b4a6e fix #4335: report: add datacenter.cfg to output
Includes the contents of /etc/pve/datacenter.cfg
in the cluster section.

Signed-off-by: Max Carrara <m.carrara@proxmox.com>
2023-02-14 10:27:02 +01:00
Stefan Sterz
31746f261a fix #4521: api/tasks: replace upid as filename for task log downloads
previously the upid would just be used without a file extension when
downloading a task log. this lead to rather strange filenames that
appeared unfamiliar to users as the upid is not very prevalent in the
gui. set a proper file name based on the node name, worker type and a
time stamp instead. also add the ".log" file extension to indicate
that these files contain logs.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2023-02-09 17:18:52 +01:00
Thomas Lamprecht
a689d3c04c api apt: fix spelling in hash to avoid undef access warnings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-02 08:42:12 +01:00
Thomas Lamprecht
592635817e api apt: support getting changelog of backports packages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-01 12:27:29 +01:00
Thomas Lamprecht
ef2c6453ac api apt: code/style cleanup in changelog endpoint
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-01 12:25:42 +01:00
Thomas Lamprecht
913d893364 api apt: recduce indentation in package status update sub
best viewed with `-w` flag

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-01 12:21:54 +01:00
Thomas Lamprecht
a8cac426df api apt: code/style cleanup getting changelog URL
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-02-01 12:20:28 +01:00
Leo Nunner
2bbfac1f45 fix #4481: fetch changelogs for any Proxmox repository
This patch fixes the issue that when the user supplied any non-standard
repositories, the changelogs often wouldn't load. For example, providing
both pve-no-subscription and pbs-no-subscription broke the changelog
API, since the URL built for pbs-no-subscription was invalid.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
2023-01-31 18:03:26 +01:00
Moayad Almalat
7d8a9a99fc fix #3037: include the split_list to shell_qoute
Based to the suggestion of Wolfgang, in regard to `split_list()`,
 I converted the `split_list()` to `split(/\0/, $param->{$key});`
 this will split the `$param->{$key}` null characters and push each
 element to the `$args` array along with the key value.

 changes since v1:
 * get rid of the `use PVE::Tools qw(split_list);` since not need it anymore.
 * replace the split_list to split(/\0/).

Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
2023-01-25 09:30:13 +01:00
Fiona Ebner
118f9076cf api: apt: versions: add proxmox-mail-forward to package list
Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-01-18 11:06:43 +01:00
Thomas Lamprecht
08d251ef2b api: ceph metadata: rename instance placeholder to id in return schema
It's a bit more commonly used for such identifier

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-16 16:32:16 +01:00
Aaron Lauterer
ee6ec73ba9 api: ceph: metadata: update return schema
This API endpoint returns a big nested schema. This patch adds a mostly
complete description.

For the actual service instance return schema, we include commonly used
and important properties. It will usually return more. What exactly
depends on the Ceph service type.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2023-01-16 14:32:00 +01:00
Aaron Lauterer
b62ba85ad7 api: ceph: update return schemas
to include a more complete description of the returned data.
Sort properties in alphabetical order if the list is longer.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2023-01-16 14:32:00 +01:00
Thomas Lamprecht
853ce1ea65 fixup! api: node stopall: expose setting the task timeout as endpoint parameter 2023-01-14 17:41:04 +01:00
Thomas Lamprecht
1154329312 api: node stopall: expose setting force-stop behavior
So that one can really decide if this is a shutdown or an actual
stop.

partially related to #4194

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-14 17:41:04 +01:00
Thomas Lamprecht
8f063fbc7f api: node stopall: expose setting the task timeout as endpoint parameter
Note that this changes the lower timeout of 60s for CTs also to 180s
like VM always used; besides that there's not much gained making that
distinction there was never a really good argument for this.

partially related to #4194

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-14 17:41:04 +01:00
Thomas Lamprecht
b27ebcadb8 api: nodes: move variable definition closer to use site
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-14 17:41:04 +01:00
Thomas Lamprecht
f77faab20a api: nodes: code style/indentation fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-14 17:41:04 +01:00
Matthias Heiserer
136f5724be API: ceph: fix typo in permissions
With Sys.Audit being spelled wrong, this call always failed

Signed-off-by: Matthias Heiserer <m.heiserer@proxmox.com>
2023-01-13 12:39:40 +01:00
Thomas Lamprecht
709065a63f api: task download: improve code/comment locallity slightly
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-04 14:38:19 +01:00
Thomas Lamprecht
2ebba46720 api: task download: name clashing params explicit
we might add other ones that might be used together with the
`download` one, so rather be explicit on communicating what we check.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-04 14:37:08 +01:00
Thomas Lamprecht
627903257b api: task download: avoid useless intermediate variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-04 14:36:47 +01:00
Daniel Tschlatscher
aa73246bd4 make task log downloadable in the PVE manager backend
The read_tasklog API call now stream the whole log file if the query
parameter 'download' is set to true.
This is done in preparation for the task log download button to be
added in the TaskViewer.

Signed-off-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Tested-by: Stefan Sterz <s.sterz@proxmox.com>
Reviewed-by: Stefan Sterz <s.sterz@proxmox.com>
2023-01-04 14:32:11 +01:00
Aaron Lauterer
56b03211e6 api: ceph: sort and update index sub-directory list
The 'cmd-safety', 'configdb' and 'mgr' items were missing, and while
directly calling the API endpoints worked, the api-viewer and pvesh
where partially broken here.

Sort the whole list alphabetically will make it easier to track in
the future

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ T: note which items where missing and reword slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-12-21 14:55:14 +01:00
Aaron Lauterer
f18b7ddd36 api: ceph: fix grammar/styling in descriptions
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
 [ T: slightly rework commit subject ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-12-21 14:50:11 +01:00
Thomas Lamprecht
c3264e92ca api: apt: code cleanups
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-12-16 13:01:24 +01:00
Fiona Ebner
2b233ecc08 api: vzdump: soften parameter permission checks
Allows sufficiently privileged users to pass-in retention and
performance parameters for manual backup, but keeps tmpdir, dumpdir
and script root-only. Such users could already edit the job
accordingly, so essentially not granting anything new.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-21 14:13:05 +01:00
Thomas Lamprecht
65cbfe79e4 fix #4245: api: node HW: allow to get PCI info with Sys.Audit on /
keep Sys.Modify only for backward compat, as it does not make really
much sense to ask for that on an informative GET call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-20 13:29:58 +01:00
Aaron Lauterer
ccb281a7ae api: ceph: add cmd-safety endpoint
Ceph provides us with several safety checks to verify that an action is
safe to perform. This endpoint provides means to acces them.
The actual mon commands are not exposed directly. Instead the two
actions "stop" and "destroy" are offered.

In case it is not okay to perform an action, Ceph provides a status
message explaining why. This message is part of the returned values.

For now there are the following checks for these services:

MON:
  - ok-to-stop
  - ok-to-rm
OSD:
  - ok-to-stop
  - safe-to-destroy
MDS:
  - ok-to-stop

Even though OSDs have a check if it is okay to destroy them, it is for
now not really usable in our workflow because it needs the OSD to be up
and running to return useful information. Our workflow in the GUI
currently is that the OSD needs to be stopped in order to destroy it.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-11-17 18:27:48 +01:00
Dominik Csapak
1f6d7f7fbf api: open up /cluster/options call over injecting info into /version
To avoid returning unrelated information in the /version api call in
the future use the API endpoint that'd return the relevant
information basically anyway.

It contains most ui relevant options, like the console preference and
tag-style so allow these for users without 'Sys.Audit' on '/', for
others its unchanged, they still get the whole datacenter config.

We also add the list of allowed tags, while not strictly a datacenter
config, it's derived from the current users privileges and the
datacenter config.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 18:16:43 +01:00
Dominik Csapak
d18b69822e api: /cluster/resources: add tags to returned properties
by querying 'lock' and 'tags' with 'get_guest_config_properties'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-17 18:16:24 +01:00
Stefan Sterz
7818083008 api: ceph: add applications of each pool to the lspools endpoint
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 <s.sterz@proxmox.com>
Tested-By:  Aaron Lauterer <a.lauterer@proxmox.com>
2022-11-16 20:24:12 +01:00
Fiona Ebner
573e832067 vzdump: send mail if job-abort hook fails
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-16 11:25:58 +01:00
Fiona Ebner
268c642826 fix #4351: vzdump: send mail if job-end hook fails with mailnotification=failure
Since all tasks succeeded, previously no mail was sent in that case.

Note that the error passed to $self->sendmail() is added to the
subject of the mail if it is a single line or the beginning of the
mail otherwise. Thus changing the mail slightly compared to previously
for the case where the job-start hook fails and the case where the
job-end hook fails with mailnotification=always. But can be considered
an improvement, because the user sees the error right away.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-16 11:25:58 +01:00
Fiona Ebner
7060a39316 cluster resources: add cgroup-mode to node properties
so the frontend has the information readily available.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-15 14:08:55 +01:00
Fiona Ebner
955912c54e pvestatd: broadcast static node information
Planned to be used for static resource scheduling in the HA manager.

It's enough to broadcast the values whenever they are outdated or not
set in the node's local kv store, because pmxcfs will re-broadcast the
local kv store whenever the quorate partition changes. This is already
relied upon for the 'ceph-versions' kv pair.

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-15 14:07:56 +01:00
Thomas Lamprecht
63d389bc51 api: backup info: make "name" property truly optional in response struct
avoid returning a nullish/undef value if not specified

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-15 14:07:39 +01:00
Thomas Lamprecht
fc9991245f api: backup info: code/style cleanup/rework/modernization
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-15 14:07:39 +01:00
Thomas Lamprecht
730d5a0f42 api: backup info: drop querying rrd_dump, not used
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-15 14:07:39 +01:00
Thomas Lamprecht
0d3f86f2a4 api: backup info: rework get_included_vmids code style
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-15 14:07:39 +01:00