Commit Graph

188 Commits

Author SHA1 Message Date
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
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
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
Thomas Lamprecht
dbfcac27d5 api: nodes: code/style rework start/stop list generation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-09-07 09:47:48 +02:00
Thomas Lamprecht
79d6202636 api: nodes: style/perlcritic fixes
no semantic change intended

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-09-07 09:47:48 +02:00
Fabian Grünbichler
9018237e24 nodes: include execute schema in docs
by extracting the JSON-encoded-string schema and dumping it into the
verbose description it at least shows up in the API viewer.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-08-02 14:44:38 +02:00
Stefan Sterz
a1de441096 api2: use JSONSchema to validate commands for "nodes/{node}/execute"
this also makes it more explicit what the different values should be

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2022-08-02 14:14:02 +02:00
Stefan Sterz
72db67a2b6 fix: api2: add return type to nodes/{node}/execute endpoint
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 <s.sterz@proxmox.com>
2022-08-02 14:14:02 +02:00
Oguz Bektas
dfde1eec16 api: query url metadata: change default user-agent to "Proxmox VE"
To avoid being blacklisted because of the default, quite popular,
libwww-perl user-agent like reported in community forum [0].

[0]: https://forum.proxmox.com/threads/104081/

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Tested-by: Matthias Heiserer <m.heiserer@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-02-04 17:49:46 +01:00
Dominik Csapak
68df949690 api: journal: stream the journal data to the client
instead of accumulating the whole output of 'mini-journalreader' in
the api call (this can be quite big), use the download mechanic of the
http-server to stream the output to the client.

we lose some error handling possibilities, but we do not have
to allocate anything here, and since perl does not free memory after
allocating[0] this is our desired behaviour.

to keep api compatiblitiy, we need to give the journalreader the '-j'
flag to let it output json.

also tell the http server that the encoding is gzip and pipe
the output through it.

0: https://perldoc.perl.org/perlfaq3#How-can-I-free-an-array-or-hash-so-my-program-shrinks?

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-11-24 18:19:16 +01:00
Lorenz Stechauner
17711ff849 api: nodes: add query_url_metadata method
metadata is gained using a HEAD request.

Due to the ability of this api endpoint to request files on internal
networks (which would not be visible/accessible from outside) it is
restricted to users with permissions `Sys.Audit` and `Sys.Modify` on
`/`. Users with these permissions are able to alter node (network)
config anyway, so this should not create any further security risk.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
2021-07-03 00:36:20 +02:00
Fabian Ebner
0a7de3377b nodes: startall: correctly handle warning status for delayed task
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-24 08:50:38 +02:00
Thomas Lamprecht
0d213945f1 api: nodes: simplify appliance list code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-18 18:57:30 +02:00
Thomas Lamprecht
aee25c2ed1 api: nodes: simplify appliance download code
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-18 18:57:23 +02:00
Thomas Lamprecht
c3020cf230 api: nodes: fix re-defined rpcenv/user variables regression
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-18 18:40:34 +02:00
Lorenz Stechauner
fac5d57e5b api: nodes: refactor aplinfo to use common download function
a common function to download arbitrary files from urls has been
defined as PVE::Tools::download_file_from_url and is now used.

Signed-off-by: Lorenz Stechauner <l.stechauner@proxmox.com>
2021-06-18 18:36:06 +02:00
Thomas Lamprecht
0e68b116f3 api: nodes: fix typo
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-17 16:27:55 +02:00
Fabian Ebner
05d5446df8 api: move cpu path into qemu/capabilities
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 11:29:34 +02:00
Fabian Ebner
0c8e509eb5 api: nodes: remove deprecated upgrade parameter for vncshell
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 11:29:32 +02:00
Fabian Ebner
b270a6b4ea api: nodes: remove deprecated upgrade parameter for spiceshell
The change not to pass the 'upgrade' parameter in the frontend was made in
953f6e9bb3 (the commit doesn't talk about it, it's
likely an accidental squash of two changes)

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 10:51:53 +02:00
Fabian Ebner
5489ea5278 api: nodes: remove deprecated upgrade parameter for xtermjs
The switch to 'cmd' was made by commit af39a6f09651e15d1c83536e25493a2212efd7d3
in the pve-xtermjs repo and is included in 4.7.0

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 10:51:46 +02:00
Thomas Lamprecht
6110ed0348 api: nodes: whitespace cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-05-04 11:58:55 +02:00
Thomas Lamprecht
c6c4b2788d api: node: add capabilities path and move qemu machines over
avoid further crowding the top-level node API path with such
"what can some part of the node currently do" stuff, rather move it
down.

The QEMU cpu stuff should move also down there.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 21:31:32 +01:00
Thomas Lamprecht
5a378425b8 api: nodes: sort use statements
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 21:31:32 +01:00
Stefan Reiter
32ad9758a2 api: register Qemu::Machine call
as 'machine-types', so it is clear this refers to QEMU machines, not the
local machine (as one might think, this being a 'node' API call).

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 21:31:32 +01:00
Thomas Lamprecht
784d6ee9b4 api: nodes: sort index
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-03-05 21:31:32 +01:00
Thomas Lamprecht
f5b6ccb1d5 api: fixup: commit change to storage module
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 11:45:33 +01:00
Thomas Lamprecht
f24be7e72d api: nodes: allow root to pass arbitrary arguments to commands
If the command itself allows it, which normally means it has good
verification of passed arguments.

We may want to re-evaluate security here if we allow execution for a
group of non-root users.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-11-22 17:59:36 +01:00
Thomas Lamprecht
ecddd2e231 Revert "Close #1623: replace apt-get to apt"
This reverts commit 19137ed620.
2020-07-08 10:55:56 +02:00
Moayad Almalat
19137ed620 Close #1623: replace apt-get to apt
Signed-off-by: Moayad Almalat <m.almalat@proxmox.com>
2020-07-07 18:52:28 +02:00
Thomas Lamprecht
d6e7fa0404 api nodes/netstat: cleanup indentation and refactor slightly
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-03 08:06:44 +02:00
Thomas Lamprecht
677bee7c57 api/nodes: factor out getting VNC connection info
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-07-01 09:02:49 +02:00
Stefan Reiter
01ac98c702 api: register /nodes/X/cpu call for CPU models
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-06-17 15:51:11 +02:00
Fabian Grünbichler
1a664b0f9d api: improve node index with missing/broken cert
since this API endpoint is used for the node selector in the GUI, which
causes quite widespread breakage.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-02 10:28:56 +02:00
Thomas Lamprecht
13411f9938 bulk migration: only pass 'with-local-disks' along if defined
To make it backward compaitble. NBo real harm without this, but lots
of ugly undefiend $val warnings...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-05 13:50:23 +01:00
Thomas Lamprecht
71fd3de92e migration worker: move params to own variable
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-05 13:49:55 +01:00
Thomas Lamprecht
8e4bee65a3 api/bulk migrate: add comment regarding PID re-used
this needs to be fixed, maybe with pidfd's...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:13:36 +01:00
Thomas Lamprecht
49652c466f api/bulk migrate: warn if vmlist was empty, die if no worker got spawned
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:13:36 +01:00
Thomas Lamprecht
6f3d18dd32 api/bulk migrate: split long param list in multiple lines
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:06:40 +01:00
Thomas Lamprecht
0b54f653ca api/bulk migrate: rework pre-condition check outputs
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-30 17:06:37 +01:00
Tim Marx
d8d1727191 api: add migrate precondition checks to bulk migrate api
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-30 15:25:18 +01:00
Tim Marx
fc6b77a1f6 api: add migrate with local disks to bulk migrate api
Signed-off-by: Tim Marx <t.marx@proxmox.com>
2019-11-30 15:25:18 +01:00
Thomas Lamprecht
481816075e followup: add intermediate directory index for sdn/zones
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-26 17:58:01 +01:00
Alexandre Derumier
bb65469946 api2 : nodes : use zones api status
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
2019-11-26 17:08:23 +01:00
Fabian Grünbichler
516a7948cd use PVE::RRD for RRD data
refactored from PVE::Cluster. same code, same semantics, different file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:25:35 +01:00
Fabian Grünbichler
3ac3653e63 use PVE::DataCenterConfig
to make sure that the corresponding cfs_read_file works() works.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:25:35 +01:00