PBSClient.pm contains methods for:
* handling (sensitive) config-information (passwords, encryption keys)
* creating/restoring/forgetting/listing backups
code is mostly based on the current PBSPlugin in pve-storage
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
read new /proc/pressure/(cpu,disk,io) introduced in kernel 4.20.
This give more granular informations than loadaverage.
Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
otherwise we get strange errors when formatting data that was originally
JSON, and can thus contain JSON::true/JSON::false.
one example is the QMP query-blockstats command, which gets called (and
the resulting values returned) by /nodes/NODE/qemu/VMID/status/current
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
sync_mountpoint takes a path, gets an open filedescriptor and calls
syncfs(2) on it.
by opening with O_PATH the syncfs call fails with EBADF (see open(2)).
found by running:
```
pkill -f 'pvedaemon worker';
strace -yyttT -s 512 -o /tmp/trace -fp $(pgrep -f pvedaemon$)
```
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This patch enables the sendmail helper sub to send emails with a non-existant
display name in the from address. This is used to replace the direct call to
the sendmail binary in pve-manager/PVE/API2/APT.pm.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
PVE::Tools::sendmail currently always sends a multipart/alternative message
irrespective of the actual content of the mail (e.g. a plain-text only mail
need not be sent as multipart message).
Additionally a few small refactorings based on the discussion
in https://lists.proxmox.com/pipermail/pbs-devel/2020-August/000423.html
and commited in 66004f22c6475ceb0146cf2df1f380f9f0274be4 in the
rust proxmox repository git://git.proxmox.com/git/proxmox.git
were carried over.
tested by creating a backup of a VM and setting an e-mail address, having
ha-manager send a mail after fencing as well as sending a few small mails via
'perl -e'
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
If we run out of passed arguments from the user but still had defined
"arg_params" (those params which went after the command in fixed
order without option -- dashes) we always errored out with "not
enough arguments". But, there are situations where the remaining
arg_params are all marked as optional in the schema, so we do not
need to error out in that case.
A prime (future) use case is "pvesm prune-backups". Currently the
usage is:
> pvesm prune-backups storeid --prune-backups keep-last=1,keep-...
Because the "prune-backups" keep retention property is optional as it
can fallback to the one defined in the storage configuration.
With this patch we can make it an argument and allow the following
two usages:
1. As above, but avoiding the extra ugly --prune-backups
> pvesm prune-backups storeid keep-last=1,keep-...
2. Fallback to storage config:
> pvesm prune-backups storeid
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
to call out/err/logfunc with each line, we search for a newline and call
outfunc/logfunc with everything before that
since we do a select/read (with 4096 size) in a loop, this means
that if we have very long lines, we search for a newline in an
ever growing buffer (for which we know does not contain a newline)
so instead, only search the new data for newlines
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
this is (via file_get_contents and file_copy) used for reading from
pmxcfs, which has a file size limit of 512k. since quite a number of
call sites would need to explicitly override this (and then get updated
if we bump the limit on the pmxcfs side again in the future), making our
default file reader compatible by default seems the better solution.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>