]> git.proxmox.com Git - pve-common.git/log
pve-common.git
3 years agobump version to 6.3-4
Thomas Lamprecht [Fri, 19 Feb 2021 14:50:29 +0000 (15:50 +0100)]
bump version to 6.3-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #3259: always free certificate file after reading it
Stoiko Ivanov [Thu, 11 Feb 2021 18:19:47 +0000 (19:19 +0100)]
fix #3259: always free certificate file after reading it

This commit mirrors e3c4007bc94956962c03da8c6853415d2fdf057c in
pve-cluster. The fix there got lost with a refactoring for reusing the
code here in pve-common in c92b771669e68a8b49906b8a0a68b533750567b0

Tested by repeadetly reading https://$pve-node:8006/nodes on a
virtual testcluster.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoprocfs: whitespace/indendation cleanup
Thomas Lamprecht [Fri, 19 Feb 2021 14:35:06 +0000 (15:35 +0100)]
procfs: whitespace/indendation cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoregister email-or-username format
Fabian Ebner [Mon, 15 Feb 2021 12:24:56 +0000 (13:24 +0100)]
register email-or-username format

To be used for the mailto vzdump parameter.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
3 years agosendmail: use more complete email regex and shellquote
Fabian Ebner [Mon, 15 Feb 2021 12:24:55 +0000 (13:24 +0100)]
sendmail: use more complete email regex and shellquote

Shellquote is needed for '~', and while it doesn't help with '-',
there should be no problem, because options are separated from mailto
since commit 216a3f4f131693dc4bbad5e06e96a61baef5f5e9.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
3 years agobump version to 6.3-3
Thomas Lamprecht [Mon, 8 Feb 2021 15:09:16 +0000 (16:09 +0100)]
bump version to 6.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocgroup: get_pressure_stat: handle v1 controller gracefully
Thomas Lamprecht [Mon, 8 Feb 2021 15:04:18 +0000 (16:04 +0100)]
cgroup: get_pressure_stat: handle v1 controller gracefully

and return the default zeroed $res in case we cannot get any path

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agouse unified parser for pressure stats
Thomas Lamprecht [Mon, 8 Feb 2021 15:03:35 +0000 (16:03 +0100)]
use unified parser for pressure stats

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd get_pressure_stat
Alexandre Derumier [Sun, 7 Feb 2021 13:36:45 +0000 (14:36 +0100)]
add get_pressure_stat

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agoformat: drop unused JSONSchema module use
Thomas Lamprecht [Mon, 8 Feb 2021 14:03:29 +0000 (15:03 +0100)]
format: drop unused JSONSchema module use

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoformat: handle undef, 0, and decimals in render_duration
Stefan Reiter [Mon, 8 Feb 2021 11:15:08 +0000 (12:15 +0100)]
format: handle undef, 0, and decimals in render_duration

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoextract PVE::Format from PVE::CLIFormatter for reuse
Stefan Reiter [Mon, 8 Feb 2021 11:15:07 +0000 (12:15 +0100)]
extract PVE::Format from PVE::CLIFormatter for reuse

and add some tests

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoSectionConfig: parse_config: add errors to result
Fabian Ebner [Mon, 21 Dec 2020 13:48:19 +0000 (14:48 +0100)]
SectionConfig: parse_config: add errors to result

so that callers can know about them. This is useful in places where we'd rather
abort then continue with a faulty configuration. For example, when reading the
storage configuration before executing a backup job.

Originally-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobuildsys: use plain cp instead of rsync
Thomas Lamprecht [Mon, 14 Dec 2020 18:51:37 +0000 (19:51 +0100)]
buildsys: use plain cp instead of rsync

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-2
Thomas Lamprecht [Thu, 3 Dec 2020 15:53:22 +0000 (16:53 +0100)]
bump version to 6.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollowup comment/code cleanups
Thomas Lamprecht [Thu, 3 Dec 2020 15:51:30 +0000 (16:51 +0100)]
followup comment/code cleanups

actually explain why we set to undef and not use `delete`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: add extract_sensitive_params
Dominik Csapak [Wed, 2 Dec 2020 09:21:04 +0000 (10:21 +0100)]
tools: add extract_sensitive_params

moved and generalized from pve-storage, since we'll need it
in more places

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoPBSClient: add get_repository to generate repository urls from configs
Dominik Csapak [Thu, 3 Dec 2020 11:43:38 +0000 (12:43 +0100)]
PBSClient: add get_repository to generate repository urls from configs

we can use this everywhere we need to have a repository url

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobuildsys: clean more
Thomas Lamprecht [Thu, 3 Dec 2020 15:39:10 +0000 (16:39 +0100)]
buildsys: clean more

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.3-1
Thomas Lamprecht [Fri, 27 Nov 2020 14:30:25 +0000 (15:30 +0100)]
bump version to 6.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoInotify: delete vlan-id for "iface.X" vlan iface.
Alexandre Derumier [Thu, 26 Nov 2020 09:18:46 +0000 (10:18 +0100)]
Inotify: delete vlan-id for "iface.X" vlan iface.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agosubscription: use more specific machine repo definition for PVE/PMG
Thomas Lamprecht [Fri, 27 Nov 2020 14:22:34 +0000 (15:22 +0100)]
subscription: use more specific machine repo definition for PVE/PMG

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoinotify: apt auth: sort longest machine entry first and allow deletion
Thomas Lamprecht [Fri, 27 Nov 2020 14:21:37 +0000 (15:21 +0100)]
inotify: apt auth: sort longest machine entry first and allow deletion

plus a few code cleanups.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-6
Thomas Lamprecht [Tue, 17 Nov 2020 15:08:04 +0000 (16:08 +0100)]
bump version to 6.2-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorest: register method: allow minus in path template parameter names
Thomas Lamprecht [Tue, 17 Nov 2020 15:05:20 +0000 (16:05 +0100)]
rest: register method: allow minus in path template parameter names

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorest: register method: non-capturing group for path regex outer group
Thomas Lamprecht [Tue, 17 Nov 2020 15:05:04 +0000 (16:05 +0100)]
rest: register method: non-capturing group for path regex outer group

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-5
Thomas Lamprecht [Tue, 17 Nov 2020 13:29:25 +0000 (14:29 +0100)]
bump version to 6.2-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS client: backup tree: avoid over generic param has
Thomas Lamprecht [Tue, 17 Nov 2020 12:04:53 +0000 (13:04 +0100)]
PBS client: backup tree: avoid over generic param has

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS client: get snapshots: avoid over generic param has
Thomas Lamprecht [Tue, 17 Nov 2020 12:04:43 +0000 (13:04 +0100)]
PBS client: get snapshots: avoid over generic param has

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS client: cannot use normal method call style for private subs
Thomas Lamprecht [Tue, 17 Nov 2020 12:03:42 +0000 (13:03 +0100)]
PBS client: cannot use normal method call style for private subs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: restore pxar: add required parameters explicitly in method signature
Thomas Lamprecht [Tue, 17 Nov 2020 08:39:03 +0000 (09:39 +0100)]
pbs: restore pxar: add required parameters explicitly in method signature

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: code cleanup param array assembly
Thomas Lamprecht [Tue, 17 Nov 2020 08:38:28 +0000 (09:38 +0100)]
pbs: code cleanup param array assembly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: autogen key: adapt recent changes in storage module
Thomas Lamprecht [Tue, 17 Nov 2020 08:12:31 +0000 (09:12 +0100)]
pbs: autogen key: adapt recent changes in storage module

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBS client: use our normal blessed method call style
Thomas Lamprecht [Tue, 17 Nov 2020 08:12:02 +0000 (09:12 +0100)]
PBS client: use our normal blessed method call style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoadd PBSClient module
Stoiko Ivanov [Mon, 16 Nov 2020 11:01:08 +0000 (12:01 +0100)]
add PBSClient module

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>
3 years agosystemd: add CPUWeight encoding
Alexandre Derumier [Fri, 6 Nov 2020 08:24:55 +0000 (09:24 +0100)]
systemd: add CPUWeight encoding

3 years agobugfix: cpushares : default value is 1024 for cgroup v1
Alexandre Derumier [Fri, 6 Nov 2020 08:24:54 +0000 (09:24 +0100)]
bugfix: cpushares : default value is 1024 for cgroup v1

Currently if we delete cpuunit (undef), the default value is 100

3 years agoCgroups: remove specific lxc code
Alexandre Derumier [Fri, 6 Nov 2020 08:24:53 +0000 (09:24 +0100)]
Cgroups: remove specific lxc code

3 years agomove PVE::LXC::CGroup to PVE::CGroup
Alexandre Derumier [Fri, 6 Nov 2020 08:24:52 +0000 (09:24 +0100)]
move PVE::LXC::CGroup to PVE::CGroup

3 years agobump version to 6.2-4
Thomas Lamprecht [Thu, 5 Nov 2020 09:56:03 +0000 (10:56 +0100)]
bump version to 6.2-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix 3108: properly check IPv6 addr
Fabian Grünbichler [Mon, 2 Nov 2020 07:33:51 +0000 (08:33 +0100)]
fix 3108: properly check IPv6 addr

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoSystemd: add helpers for parsing unit files
Stoiko Ivanov [Wed, 28 Oct 2020 18:54:17 +0000 (19:54 +0100)]
Systemd: add helpers for parsing unit files

taken from pve-storage/PVE/API2/Disks/Directory.pm (and made available as
public sub)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoMake configid regex public
Dominic Jäger [Wed, 28 Oct 2020 10:04:53 +0000 (11:04 +0100)]
Make configid regex public

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
3 years agoAdd tests for verify_configid
Dominic Jäger [Wed, 28 Oct 2020 10:04:52 +0000 (11:04 +0100)]
Add tests for verify_configid

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
3 years agosendmail: code cleanup
Thomas Lamprecht [Thu, 29 Oct 2020 14:20:17 +0000 (15:20 +0100)]
sendmail: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonetwork: fix conditional variable declaration
Thomas Lamprecht [Fri, 23 Oct 2020 19:09:23 +0000 (21:09 +0200)]
network: fix conditional variable declaration

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonetwork: cleanup "check bond" code
Thomas Lamprecht [Fri, 23 Oct 2020 19:08:38 +0000 (21:08 +0200)]
network: cleanup "check bond" code

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoInotify: allow bond of bond
Alexandre Derumier [Tue, 20 Oct 2020 11:26:11 +0000 (13:26 +0200)]
Inotify: allow bond of bond

for example,some users need to do active-backup bond, on top of 2 lacp bond.

3 years agoProcFSTools: add read_pressure
Alexandre Derumier [Tue, 6 Oct 2020 11:58:39 +0000 (13:58 +0200)]
ProcFSTools: add read_pressure

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>
3 years agobump version to 6.2-3
Thomas Lamprecht [Fri, 18 Sep 2020 15:35:58 +0000 (17:35 +0200)]
bump version to 6.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoproperly encode YAML via YAML::XS
Fabian Grünbichler [Thu, 17 Sep 2020 11:16:58 +0000 (13:16 +0200)]
properly encode YAML via YAML::XS

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>
3 years agotools: sync_mountpoint: throw actual error is syncfs fails
Thomas Lamprecht [Fri, 18 Sep 2020 09:59:32 +0000 (11:59 +0200)]
tools: sync_mountpoint: throw actual error is syncfs fails

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosync_mountpoint: open path so that sync works
Stoiko Ivanov [Thu, 17 Sep 2020 19:17:00 +0000 (21:17 +0200)]
sync_mountpoint: open path so that sync works

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>
3 years agod/control: add missing libtimedate-perl to depends
Fabian Grünbichler [Thu, 17 Sep 2020 11:00:33 +0000 (13:00 +0200)]
d/control: add missing libtimedate-perl to depends

Fixes: b18826ce61e6e2438acc08f05aaa5395bdcd4974
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agowrap-and-sort d/control
Fabian Grünbichler [Thu, 17 Sep 2020 10:54:30 +0000 (12:54 +0200)]
wrap-and-sort d/control

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agod/copyright: update
Thomas Lamprecht [Tue, 8 Sep 2020 16:30:28 +0000 (18:30 +0200)]
d/copyright: update

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.2-2
Thomas Lamprecht [Mon, 7 Sep 2020 08:01:09 +0000 (10:01 +0200)]
bump version to 6.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoget_options: allow no arguments if all are optional
Thomas Lamprecht [Mon, 7 Sep 2020 07:59:01 +0000 (09:59 +0200)]
get_options: allow no arguments if all are optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosendmail helper: allow empty display name in from
Stoiko Ivanov [Thu, 3 Sep 2020 12:09:45 +0000 (14:09 +0200)]
sendmail helper: allow empty display name in from

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>
3 years agosendmail-helper: only send multipart if necessary
Stoiko Ivanov [Thu, 3 Sep 2020 12:09:44 +0000 (14:09 +0200)]
sendmail-helper: only send multipart if necessary

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>
3 years agoget_options: allow optional arguments "arg_params" if no ambiguity
Thomas Lamprecht [Wed, 26 Aug 2020 19:21:03 +0000 (21:21 +0200)]
get_options: allow optional arguments "arg_params" if no ambiguity

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>
3 years agobump version to 6.2-1
Thomas Lamprecht [Wed, 19 Aug 2020 10:29:13 +0000 (12:29 +0200)]
bump version to 6.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorun command: fix matching \r\n and use non-capturing group for it
Thomas Lamprecht [Wed, 19 Aug 2020 06:54:08 +0000 (08:54 +0200)]
run command: fix matching \r\n and use non-capturing group for it

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agorun_command: improve performance for logging and long lines
Dominik Csapak [Thu, 30 Jul 2020 09:04:10 +0000 (11:04 +0200)]
run_command: improve performance for logging and long lines

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>
3 years agosafe_read_from: bump default size limit to 512k
Fabian Grünbichler [Fri, 14 Aug 2020 07:48:33 +0000 (09:48 +0200)]
safe_read_from: bump default size limit to 512k

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>
3 years agobump version to 6.1-5
Thomas Lamprecht [Tue, 7 Jul 2020 17:27:26 +0000 (19:27 +0200)]
bump version to 6.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agosendmail: separate 'mailto' list from the rest of the parameters
Oguz Bektas [Tue, 7 Jul 2020 12:55:41 +0000 (14:55 +0200)]
sendmail: separate 'mailto' list from the rest of the parameters

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agoJSONSchema: use validator in print_property_string too
Stefan Reiter [Thu, 25 Jun 2020 11:35:40 +0000 (13:35 +0200)]
JSONSchema: use validator in print_property_string too

Suggested-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoJSONSchema: add format validator support and cleanup check_format
Stefan Reiter [Thu, 25 Jun 2020 11:35:39 +0000 (13:35 +0200)]
JSONSchema: add format validator support and cleanup check_format

Adds a third, optional parameter to register_format that allows specifying
a function that will be called after parsing and can validate the parsed
data. A validator should die on failed validation, and can also change the
parsed object by returning a modified version of it.

This is useful so one can register a format with its hash, thus allowing
documentation to be generated automatically, while still enforcing certain
validation rules.

The validator only needs to be called in parse_property_string, since
check_format always calls parse_property_string if there is a
possibility of a validator existing at all. parse_property_string should
then be called with named formats for best effect, as only then can
validators be used.

Clean up 'check_format' as well (which pretty much amounts to a rewrite).
No existing functionality is intentionally changed.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.1-4
Thomas Lamprecht [Fri, 3 Jul 2020 12:17:04 +0000 (14:17 +0200)]
bump version to 6.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofollouwp: improve comment detection and refactor slightly
Thomas Lamprecht [Fri, 26 Jun 2020 07:55:21 +0000 (09:55 +0200)]
follouwp: improve comment detection and refactor slightly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoschema: register 'timezone' format and add verification method
Oguz Bektas [Wed, 17 Jun 2020 13:32:29 +0000 (15:32 +0200)]
schema: register 'timezone' format and add verification method

/usr/share/zoneinfo/zone.tab has the valid list of time zones.

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2796: debian/postinst: check for existing /etc/aliases
Stoiko Ivanov [Fri, 12 Jun 2020 09:14:38 +0000 (11:14 +0200)]
fix #2796: debian/postinst: check for existing /etc/aliases

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agofix #2374: bridge-ports is assumed to be defined
Mira Limbeck [Wed, 10 Jun 2020 14:03:38 +0000 (16:03 +0200)]
fix #2374: bridge-ports is assumed to be defined

bridge-ports is an optional parameter but was assumed to be defined in
the code. This resulted in 'use of uninitialized value' warnings.

By reordering of the $ports definition before the replace, we get rid of
the 'use of uninitialized value' when no bridge-port is specified.

In the second case we set it to an empty string when it is undefined.

Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
3 years agobump version to 6.1-3
Thomas Lamprecht [Mon, 8 Jun 2020 15:37:13 +0000 (17:37 +0200)]
bump version to 6.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoInotify: write_network_interfaces : always autostart bond slaves interfaces
Alexandre Derumier [Sun, 7 Jun 2020 11:39:47 +0000 (13:39 +0200)]
Inotify: write_network_interfaces : always autostart bond slaves interfaces

Currently, bond slaves are mostly working without autostart,
because bond slaves scripts from ifupdown1 && also ifupdown2
 have some kind of hacks to start the slaves.

But if users want to do some tuning on the ifaces, they are not applied.

Also, with ifupdown2 + ovs, this kind of hack is not implemented (yet), so the
slaves of the bond are still down.

Debian/Ubuntu official docs always set "auto ethX" for bond slaves,
it's really more clean like this.

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agoAdd cpu core count to /nodes/{id}/status API result
Mike Beattie [Fri, 29 May 2020 10:58:52 +0000 (22:58 +1200)]
Add cpu core count to /nodes/{id}/status API result

This is useful for when collecting data for Guest OS licensing (Microsoft)
where physical core count matters, not socket or thread count.

The "cpus" value counts threads when Hyperthreading is enabled.

Signed-off-by: Mike Beattie <mike@ethernal.org>
3 years agonetwork: vlan-aware bridge: fix pvid when trunks is defined
Alexandre Derumier [Mon, 25 May 2020 11:05:08 +0000 (13:05 +0200)]
network: vlan-aware bridge: fix pvid when trunks is defined

Currently, when a trunks is defined, the vlan tag is not used
for pvid with vlan-aware bridge. (It's ok with ovs switch)

example:

net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,tag=2,trunks=2-11

before
------
tap100i0  2-11

after
-----
tap100i0  2 PVID Egress Untagged
 3-11

No regression for other configurations:

net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1

before
------
tap100i0  1 PVID Egress Untagged
 2-4094

after
-----
tap100i0  1 PVID Egress Untagged
 2-4094

net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,tag=2

before
------
tap100i0  2 PVID Egress Untagged

after
-----
tap100i0  2 PVID Egress Untagged

net0: e1000=BA:90:68:B8:CF:F5,bridge=vmbr1,trunks=2-11

before
------
tap100i0  1 PVID Egress Untagged
 2-11

after
-----
tap100i0  1 PVID Egress Untagged
 2-11

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agoread_bridge_mtu: public method instead private
Alexandre Derumier [Fri, 17 Apr 2020 05:47:05 +0000 (07:47 +0200)]
read_bridge_mtu: public method instead private

3 years agobump version to 6.1-2
Thomas Lamprecht [Sat, 9 May 2020 19:01:10 +0000 (21:01 +0200)]
bump version to 6.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonetwork: bridge add IF: do not add all VLANs if $trunks are passed
Thomas Lamprecht [Sat, 9 May 2020 18:53:28 +0000 (20:53 +0200)]
network: bridge add IF: do not add all VLANs if $trunks are passed

fixes commit 89ea13ef6b1555f92309da5c298e16579163eaf4 and
restores old behavior, the "if !$trunks" post-if was a bit suble, it
did not guard the die, but the system command previously - the die
was || (ORd) to the command, bad code style to begin with..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.1-1
Thomas Lamprecht [Wed, 6 May 2020 10:14:10 +0000 (12:14 +0200)]
bump version to 6.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonetwork: fix adding vlan tags to bridge
Fabian Grünbichler [Wed, 6 May 2020 10:03:20 +0000 (12:03 +0200)]
network: fix adding vlan tags to bridge

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoProcFSTools: fix read_meminfo without KSM
Stoiko Ivanov [Tue, 5 May 2020 15:01:07 +0000 (17:01 +0200)]
ProcFSTools: fix read_meminfo without KSM

on kernel configs where KSM is not enabled (e.g. an openstack instance at
OVH) the file /sys/kernel/mm/ksm/pages_sharing does not exist.
In that case there is no memory shared so assuming 0 is reasonable.

While this is not the case with our shipped kernel, and thus will probably
not happen on a PVE installation, PMG can run quite happily with a different
kernel (the reporter had this on an openstack instance at OVH).

a quick grep through our codebase showed only the API2::Nodes::Nodeinfo::status
call as user of the memshared property.

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
3 years agoprint_text_table: handle undefined values in comparision
Fabian Ebner [Tue, 28 Apr 2020 08:18:26 +0000 (10:18 +0200)]
print_text_table: handle undefined values in comparision

by introducing a safe_compare helper. Fixes warnings, e.g.
pvesh get /nodes/<NODE>/network
would print "use of uninitialized"-warnings if there are inactive
network interfaces, because for those, 'active' is undef.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
3 years agofix #2696: avoid 'undefined value' warning in 'pvesh help unknown'
Stefan Reiter [Mon, 4 May 2020 12:02:47 +0000 (14:02 +0200)]
fix #2696: avoid 'undefined value' warning in 'pvesh help unknown'

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agobump version to 6.0-20
Fabian Grünbichler [Mon, 20 Apr 2020 08:04:10 +0000 (10:04 +0200)]
bump version to 6.0-20

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoJSONSchema: allow to import parse_property_string
Thomas Lamprecht [Sat, 2 May 2020 16:42:35 +0000 (18:42 +0200)]
JSONSchema: allow to import parse_property_string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobuild: remove ACME modules
Fabian Grünbichler [Mon, 20 Apr 2020 08:03:08 +0000 (10:03 +0200)]
build: remove ACME modules

from Makefile as well

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoMove the code to proxmox-acme and add a dependency on it.
Wolfgang Link [Thu, 16 Apr 2020 05:18:20 +0000 (07:18 +0200)]
Move the code to proxmox-acme and add a dependency on it.

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
3 years agosection config: use croak so that the error is from the callers POV
Thomas Lamprecht [Wed, 29 Apr 2020 12:51:59 +0000 (14:51 +0200)]
section config: use croak so that the error is from the callers POV

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoJSONSchema: extend pve-configid regex by '-'
Dominik Csapak [Thu, 9 Apr 2020 14:10:41 +0000 (16:10 +0200)]
JSONSchema: extend pve-configid regex by '-'

we use this format for all 'delete' options but we have some options
that have a '-' in the name (e.g. 'sync-defaults-options') that cannot
be deleted if it is not included

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agonetwork: replace system() with run_command()
Fabian Grünbichler [Wed, 8 Apr 2020 12:02:50 +0000 (14:02 +0200)]
network: replace system() with run_command()

easier to read and extend, and safer as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agonetwork: remove unused debug code
Fabian Grünbichler [Wed, 8 Apr 2020 12:02:48 +0000 (14:02 +0200)]
network: remove unused debug code

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoinotify: trailing whitespaces: comment and drop now superfluous chomp
Thomas Lamprecht [Tue, 7 Apr 2020 16:12:54 +0000 (18:12 +0200)]
inotify: trailing whitespaces: comment and drop now superfluous chomp

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoInotify: read_interfaces : remove trailing whitespaces
Alexandre Derumier [Sun, 5 Apr 2020 08:33:00 +0000 (10:33 +0200)]
Inotify: read_interfaces : remove trailing whitespaces

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
4 years agobump version to 6.0-19
Thomas Lamprecht [Sat, 4 Apr 2020 17:55:27 +0000 (19:55 +0200)]
bump version to 6.0-19

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoidmap followup: avoid false-negatives through falsy values in collision check
Thomas Lamprecht [Thu, 2 Apr 2020 15:30:55 +0000 (17:30 +0200)]
idmap followup: avoid false-negatives through falsy values in collision check

By using "exists" when checking if a hash entry is set, else things
like "0" could get accepted by mistake.

Also cleanup the code a little, like dropping the "PVE::JSONSchema::"
prefix, this is now in that module after all.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoJSONSchema: add idmap parser and storagepair format
Fabian Grünbichler [Mon, 30 Mar 2020 11:41:28 +0000 (13:41 +0200)]
JSONSchema: add idmap parser and storagepair format

generalized from the start to support extension to bridges or other
entities as well.

this gets us incremental support for the CLI, e.g.:

--targetstorage foo:bar --targetstorage bar:baz --targetstorage foo

creates a mapping of

foo=>bar
bar=>baz

with a default of foo

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agocpuset: also split write methods
Wolfgang Bumiller [Wed, 1 Apr 2020 10:20:59 +0000 (12:20 +0200)]
cpuset: also split write methods

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>