]> git.proxmox.com Git - pve-common.git/log
pve-common.git
2 years agod/control: bump debhelper compat to >= 12
Thomas Lamprecht [Sun, 9 May 2021 15:32:30 +0000 (17:32 +0200)]
d/control: bump debhelper compat to >= 12

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 6.4-3
Thomas Lamprecht [Fri, 7 May 2021 14:24:39 +0000 (16:24 +0200)]
bump version to 6.4-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodaemon: add compat code for pmgproxy 6.x
Stoiko Ivanov [Wed, 5 May 2021 14:36:24 +0000 (16:36 +0200)]
daemon: add compat code for pmgproxy 6.x

The changes to the listening behavior introduced with PVE 6.4 break
backwardscompatibility w.r.t. listening address and logging, which
should not be changed without explictly notifying the user.

This patch re-adds the family parameter, which is still used by
pmgproxy and based on its existence creates the socket as before.

compared to the IO::Socket::IP->new call used before
390fc10dc4a696dd30646cbdd018ad08d855175f, the only change is the
renaming of 'LocalAddr' to 'LocalHost' (which are synonymous in
IO::Socket::IP [0])

It can simply be reverted with the release of pmg-api 7.0 (where
we'll record the change in the release-notes and upgrade-page)

[0] https://perldoc.perl.org/IO::Socket::IP
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agodaemon: explicitly bind to wildcard address.
Stoiko Ivanov [Wed, 5 May 2021 14:36:23 +0000 (16:36 +0200)]
daemon: explicitly bind to wildcard address.

with the recent change in pve-manager pveproxy (and spiceproxy)
try binding to '::' per default. This fails for hosts having disabled
ipv6 via kernel commandline.

Our desired behavior of binding on '::' and only falling back to
'0.0.0.0' in case this is not supported is not directly possible with
IO::Socket::IP->new (or rather by Socket::GetAddrInfo, which at least
on my system always returns the v4 wildcard-address first).

the code now binds to:
* the provided $host if not undef
* '::' if $host is not set
* '0.0.0.0' if $host is not set and binding on '::' yields undef,
  which means that it failed to create a socket which normally means
  that IPv6 is disabled

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodaemon: drop Domain parameter from create_reusable_socket
Stoiko Ivanov [Wed, 5 May 2021 14:36:22 +0000 (16:36 +0200)]
daemon: drop Domain parameter from create_reusable_socket

The Domain parameter for IO::Socket::IP is not used/needed.
It is needed to create a IP Socket when calling IO::Socket->new,
but here we call IO::Socket::IP-new directly (see [0]).

[0] https://perldoc.perl.org/IO::Socket::IP

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agoschema: check format: parse list formats as arrays
Fabian Ebner [Thu, 18 Mar 2021 08:44:18 +0000 (09:44 +0100)]
schema: check format: parse list formats as arrays

Previously, the returned value would be only the last element or undef in case
of an empty list. There's only a handful of callers of check_format() that look
at the return value and AFAICT none of the exisitng ones is for a -list format.
But best to avoid any future surprises.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agoindentation fix
Fabian Ebner [Thu, 18 Mar 2021 08:44:17 +0000 (09:44 +0100)]
indentation fix

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2 years agobump version to 6.4-2
Thomas Lamprecht [Mon, 26 Apr 2021 17:34:26 +0000 (19:34 +0200)]
bump version to 6.4-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoINotify: add support for dummy interfaces type
Alexandre Derumier [Sun, 22 Nov 2020 16:37:25 +0000 (17:37 +0100)]
INotify: add support for dummy interfaces type

They can be used like loopback, but not limited to only 1 interface.
It's needed for bgp with multipath/ecmp to have a unique src ip

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
3 years agoREST handler: make API return validation opt-in
Thomas Lamprecht [Sun, 4 Apr 2021 15:05:56 +0000 (17:05 +0200)]
REST handler: make API return validation opt-in

It has not shown any real value in the last decade+ it was enabled,
and it can actually add quite some performance overhead. E.g., if an
API endpoint returns a few 100k of relatively simple entries we can
easily require several seconds, even tens of seconds, to run the
return validation - making it easier to run into timeouts along the
transmit path to the client.

The CLI handler has it still enabled, normally there's no timeout
there as no HTTP transmit path is involved, and d.csapak had a slight
preference for that in an off-list discussion.

The actual implementations in PMG or PVE could enable it too if
running under debug mode.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agocode cleanup
Thomas Lamprecht [Sun, 4 Apr 2021 15:04:56 +0000 (17:04 +0200)]
code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 6.4-1
Thomas Lamprecht [Fri, 23 Apr 2021 12:59:57 +0000 (14:59 +0200)]
bump version to 6.4-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoallow workers to count warnings and finish tasks in a WARNINGS state
Fabian Ebner [Fri, 9 Apr 2021 08:44:35 +0000 (10:44 +0200)]
allow workers to count warnings and finish tasks in a WARNINGS state

as is already supported by the UI (and PBS).

A nice bonus is that warn() can be used by both workers and non-workers. For
workers, the output is redirected/duplicated as set up by {fork,tee}_worker(),
and non-erroring workers that issued a warning will end in a WARNINGS state.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
3 years agopbs: keep a separate $USE_CRYPT_PARAMS list per command exe
Thomas Lamprecht [Fri, 23 Apr 2021 12:15:13 +0000 (14:15 +0200)]
pbs: keep a separate $USE_CRYPT_PARAMS list per command exe

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agopbs: rework client exe handling and error message
Thomas Lamprecht [Fri, 23 Apr 2021 12:14:36 +0000 (14:14 +0200)]
pbs: rework client exe handling and error message

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBSClient: use crypt params for file 'list' and 'extract'
Stefan Reiter [Thu, 22 Apr 2021 15:34:51 +0000 (17:34 +0200)]
PBSClient: use crypt params for file 'list' and 'extract'

Necessary for accessing encrypted backups.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoPBSClient: add file_restore_extract function
Stefan Reiter [Thu, 22 Apr 2021 15:34:50 +0000 (17:34 +0200)]
PBSClient: add file_restore_extract function

*_prepare creates a fifo for streaming data back to clients directly,
filefile_restore_extract blocks and should be called from a background
worker - while it is running outcoming data can be read from the FIFO.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoPBSClient: add file_restore_list command
Stefan Reiter [Thu, 22 Apr 2021 15:34:49 +0000 (17:34 +0200)]
PBSClient: add file_restore_list command

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoPBSClient: adapt error message to include full package names
Stefan Reiter [Thu, 22 Apr 2021 15:34:48 +0000 (17:34 +0200)]
PBSClient: adapt error message to include full package names

More helpful for a user to know what they're missing.

Suggested-by: Dominic Jäger <d.jaeger@proxmox.com>
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agodaemon: create_reusable_socket: listen on IPv6 and IPv4
Oguz Bektas [Wed, 24 Mar 2021 13:20:36 +0000 (14:20 +0100)]
daemon: create_reusable_socket: listen on IPv6 and IPv4

When the 'Domain' configuration of IO::Socket::IP is set to PF_INET6,
it will prefer IPv6, but since we don't set 'V6Only' it will also
listen on IPv4 interfaces[0].

Drop the now obsoleted '$family' parameter.

[0]: https://perldoc.perl.org/IO::Socket::IP#REPLACING-IO::Socket-DEFAULT-BEHAVIOUR

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoPBSClient: allow running other binaries
Stefan Reiter [Wed, 21 Apr 2021 11:15:31 +0000 (13:15 +0200)]
PBSClient: allow running other binaries

...such as proxmox-file-restore.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoJSONSchema: don't cycle-check 'download' responses
Stefan Reiter [Wed, 21 Apr 2021 11:15:30 +0000 (13:15 +0200)]
JSONSchema: don't cycle-check 'download' responses

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofixup: remove double braces
Stefan Reiter [Mon, 19 Apr 2021 08:43:50 +0000 (10:43 +0200)]
fixup: remove double braces

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoschema: pull out abstract 'id-pair' verifier
Fabian Grünbichler [Tue, 13 Apr 2021 12:16:29 +0000 (14:16 +0200)]
schema: pull out abstract 'id-pair' verifier

we'll need another one for guest bridge IDs

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agotools: getaddrinfo: code/indentation cleanup
Thomas Lamprecht [Tue, 6 Apr 2021 08:33:51 +0000 (10:33 +0200)]
tools: getaddrinfo: code/indentation cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoget_options: don't set optional positional params to `undef`
Wolfgang Bumiller [Tue, 16 Mar 2021 10:24:24 +0000 (11:24 +0100)]
get_options: don't set optional positional params to `undef`

Currently this happened if (and only if) at least one
positional parameter was passed.

We run into this with
  `pmgconfig cert delete <type> [<restart>]`
vs
  `pvenode cert delete [<restart>]`

where in the PVE case the `restart` option was simply
omitted, whereas for PMG due to the existence of `<type>`
the `restart` option was explicitly passedset in the $opts
hash but ended up being `undef`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agobump version to 6.3-5
Thomas Lamprecht [Tue, 9 Mar 2021 07:35:17 +0000 (08:35 +0100)]
bump version to 6.3-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoformat: fix render_bytes with CLIFormatter
Stefan Reiter [Wed, 17 Feb 2021 13:32:16 +0000 (14:32 +0100)]
format: fix render_bytes with CLIFormatter

CLIFormatter passes in an options hash as a second paramter, which so
far was ignored. Now that we treat it as a precision parameter, check if
it is a hash and extract the option from it before using it.

Otherwise perl puts HASH(0x...) into the format and sprintf chokes.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agonet: ip from CIDR: sort result
Thomas Lamprecht [Thu, 25 Feb 2021 12:07:56 +0000 (13:07 +0100)]
net: ip from CIDR: sort result

this should not be a real problem yet, but the perl keys hash pseudo
random order was an issue way to often to bet on that..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agonetwork: get_local_ip_from_cidr: return unique IPs
Fabian Ebner [Mon, 22 Feb 2021 13:24:07 +0000 (14:24 +0100)]
network: get_local_ip_from_cidr: return unique IPs

to avoid erroring out when "multiple" addresses are configured on live
migration, when in fact it's the same IP multiple times.

Seems like the same problem for a caller in pve-cluster was fixed by checking
the uniqueness afterwards, see commit 266041169beb36c8892ca54265e2d91335307ffb
in pve-cluster. But there doesn't seem to be any caller relying on the current
behavior, and no additional information other than the addresses are returned,
so fix it here.

Reported here:
https://forum.proxmox.com/threads/live-migration-of-vms-via-full-mesh-network-could-not-get-ip-multiple-addresses-configured-on-local-node-for-network.84585/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
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>