]> git.proxmox.com Git - pve-cluster.git/log
pve-cluster.git
9 months agodatacenter: add APT/fencing/replication notification configuration
Lukas Wagner [Thu, 20 Jul 2023 14:32:04 +0000 (16:32 +0200)]
datacenter: add APT/fencing/replication notification configuration

These options allow setting the notification target for package update
notifications, node fencing notifications and replication notifications.

Also, fencing and replication has now new options that allow disabling
notifications altogether.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
9 months agocluster files: add notifications.cfg
Lukas Wagner [Thu, 20 Jul 2023 14:32:03 +0000 (16:32 +0200)]
cluster files: add notifications.cfg

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
10 months agobump version to 8.0.2
Thomas Lamprecht [Sat, 1 Jul 2023 17:23:03 +0000 (19:23 +0200)]
bump version to 8.0.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agod/control: bump dependency for libpve-common-perl to >= 8.0.6
Thomas Lamprecht [Sat, 1 Jul 2023 17:29:01 +0000 (19:29 +0200)]
d/control: bump dependency for libpve-common-perl to >= 8.0.6

to get new run_fork_with_timeout behavior in list context.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: updatecerts: check and report if we got a timeout
Thomas Lamprecht [Sat, 1 Jul 2023 16:40:10 +0000 (18:40 +0200)]
pvecm: updatecerts: check and report if we got a timeout

If timeout is reached, run_fork_with_timeout will warn "got timeout".
When processing triggers for pve-manager (because of ExecStartPre of
pveproxy.service invoking pvecm updatecerts) that warning can appear
in the apt output without any context (output of the forked sub
doesn't appear there). So give it some actual content using the
$got_timeout returned in wantarray list context of the
run_fork_with_timeout method.

Note that this could be seen as clash with the silent flag, but IMO
that is a bit misnamed, we mostly want to avoid outputting the info
messages from updatecerts_and_ssh, and that silent (i.e., quite) gets
convoluted with a no-error behavior seems also odd.
TBH., I actually thought about printing the "waiting for quorum" at
least once for the silent case too, but for now omitted it – lets
wait on actual feedback and then maybe restructure this completely.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: updatecerts: reword comment
Thomas Lamprecht [Sat, 1 Jul 2023 16:35:13 +0000 (18:35 +0200)]
pvecm: updatecerts: reword comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: updatecerts: only report quorum-wait progress if not silent
Thomas Lamprecht [Sat, 1 Jul 2023 15:16:27 +0000 (17:16 +0200)]
pvecm: updatecerts: only report quorum-wait progress if not silent

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: updatecerts: improve variable naming
Thomas Lamprecht [Sat, 1 Jul 2023 15:15:55 +0000 (17:15 +0200)]
pvecm: updatecerts: improve variable naming

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: updatecerts: wait for quorum
Fiona Ebner [Fri, 30 Jun 2023 11:59:42 +0000 (13:59 +0200)]
pvecm: updatecerts: wait for quorum

Mostly useful for the updatecerts call triggered via the ExecStartPre
hook for pveproxy.service.

When starting a node that's part of a cluster, there is a time window
between the start of pve-cluster.service and when quorum is reached
(from the node's perspective). pveproxy.service is ordered after
pve-cluster.service, but that does not prevent the ExecStartPre hook
from being executed before the node is part of the quorate partition.

The pvecm updatecerts command won't do much without quorum. Generating
local (non-pmxcfs) files is still done before waiting on quorum.

In particular, it might happen that the base directories for observed
files will not get created during/after the upgrade from Proxmox VE 7
to 8 (reported in the community forum [0] and reproduced right away in
a virtual test cluster).

Waiting on quorum should highly increase the chances for successful
execution of the ExecStartPre hook.

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

Suggested-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agosetup: split generation of local (i.e. non-pmxcfs) files out into helper
Fiona Ebner [Fri, 30 Jun 2023 11:59:41 +0000 (13:59 +0200)]
setup: split generation of local (i.e. non-pmxcfs) files out into helper

In preparation to wait for quorum in the updatecerts command. The
generation of files that do not depend on quorum should still be done
beforehand.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agofix typo
Fiona Ebner [Fri, 30 Jun 2023 11:59:44 +0000 (13:59 +0200)]
fix typo

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: style cleanups
Thomas Lamprecht [Sat, 1 Jul 2023 14:32:09 +0000 (16:32 +0200)]
pvecm: style cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopmxcfs: drop unused variable from full_write
Thomas Lamprecht [Sat, 1 Jul 2023 11:28:48 +0000 (13:28 +0200)]
pmxcfs: drop unused variable from full_write

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopmxcfs: log resolved IP and improve log on failure to resolve
Thomas Lamprecht [Fri, 30 Jun 2023 13:39:18 +0000 (15:39 +0200)]
pmxcfs: log resolved IP and improve log on failure to resolve

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopmxcfs: check all addresses from getaddrinfo to find non-loopback one
Thomas Lamprecht [Fri, 30 Jun 2023 09:29:18 +0000 (11:29 +0200)]
pmxcfs: check all addresses from getaddrinfo to find non-loopback one

Make the resolution of the node name to a local non-loopback address
through getaddrinfo more flexible.

Don't just ask for one, but for all addresses, then loop through the
returned linked list until the first non-loopback one is found.

It seems that some cloud-init templates hosting providers, like e.g.
OVH use, are misconfigured in always adding 127.0.1.1 for the
hostname to /etc/hosts, even if another mapping for the hostname
exists already. This popped up in our community forum with the
upgrade to bookworm, so might be related to the cloud-init version
from Bookworm.

Some examples pointed out by Alexandre:
https://forum.proxmox.com/threads/129678/
https://forum.proxmox.com/threads/129669/#post-568172
https://forum.proxmox.com/threads/129398/#post-568290

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
10 months agopvecm: update comment about updatecerts timeout
Fiona Ebner [Wed, 28 Jun 2023 13:23:16 +0000 (15:23 +0200)]
pvecm: update comment about updatecerts timeout

The call was moved by 84c3ab0 ("pve-cluster.service: move pvecm call
to pveproxy.service") to pveproxy.service's ExecStartPre.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agodatacenter config: turn shutdown policy into a standard option
Fiona Ebner [Fri, 16 Jun 2023 11:33:37 +0000 (13:33 +0200)]
datacenter config: turn shutdown policy into a standard option

to be re-used by the node/status API endpoint.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
11 months agobuildsys: improve DSC target
Thomas Lamprecht [Mon, 5 Jun 2023 10:06:49 +0000 (12:06 +0200)]
buildsys: improve DSC target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 8.0.1
Thomas Lamprecht [Mon, 5 Jun 2023 10:05:05 +0000 (12:05 +0200)]
bump version to 8.0.1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoadd cfg files for resource mapping
Dominik Csapak [Thu, 25 May 2023 10:17:43 +0000 (12:17 +0200)]
add cfg files for resource mapping

There might be more mapping types in the future, but for now it's:

- mapping/pci.cfg
- mapping/usb.cfg

Add them to both, the perl side (PVE/Cluster.pm) and pmxcfs side
(status.c).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ TL: Dominik, Fabian and I decided to do a s/resource/mapping/
   rename on the cfg & API paths and privileges, so ammend that ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agopvecm: fix cluster join over ssh with newer rsync
Dominik Csapak [Fri, 2 Jun 2023 13:20:23 +0000 (15:20 +0200)]
pvecm: fix cluster join over ssh with newer rsync

Since rsync 3.2.4, the syntax to give multiple files in one parameter
does not work anymore, so instead add both files explicitly.

this fixes the cluster join over ssh on Bookworm based Proxmox VE,
and Bullseye has rsync 3.2.3 so no change required there.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
11 months agobuildsys: use correct perl vendorarch path again
Thomas Lamprecht [Wed, 31 May 2023 12:08:43 +0000 (14:08 +0200)]
buildsys: use correct perl vendorarch path again

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agoupdate gitignore
Thomas Lamprecht [Wed, 31 May 2023 11:50:26 +0000 (13:50 +0200)]
update gitignore

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: rework doc-gen cleanup and makefile inclusion
Thomas Lamprecht [Wed, 31 May 2023 11:47:09 +0000 (13:47 +0200)]
buildsys: rework doc-gen cleanup and makefile inclusion

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agomakefile: convert to use simple parenthesis
Thomas Lamprecht [Wed, 31 May 2023 11:46:56 +0000 (13:46 +0200)]
makefile: convert to use simple parenthesis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump glib2 dependency to 2.68, required by g_memdup2
Wolfgang Bumiller [Wed, 31 May 2023 11:34:38 +0000 (13:34 +0200)]
bump glib2 dependency to 2.68, required by g_memdup2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agobuildsys: move -Wl linker flags from CFLAGS to LDFLAGS
Wolfgang Bumiller [Wed, 31 May 2023 11:17:04 +0000 (13:17 +0200)]
buildsys: move -Wl linker flags from CFLAGS to LDFLAGS

(requires to also be buildable with clang)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
11 months agobuildsys: derive upload dist automatically
Thomas Lamprecht [Fri, 19 May 2023 16:30:39 +0000 (18:30 +0200)]
buildsys: derive upload dist automatically

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobump version to 8.0.0
Thomas Lamprecht [Fri, 19 May 2023 16:07:47 +0000 (18:07 +0200)]
bump version to 8.0.0

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agore-organize source hierachy
Thomas Lamprecht [Fri, 19 May 2023 16:04:20 +0000 (18:04 +0200)]
re-organize source hierachy

data/src was a bit odd, and git is good enough to resolve such things
for history (blame) or applying patches, so don't bother enduring
this.

The process was basically:

 git mv data/src/ data/pmxcfs
 git mv data/ src
 git mv cpgtest.c src/test
 git mv src/cts/* src/test/scripts

And a few Makefile fixups.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add sbuild convenience target
Thomas Lamprecht [Fri, 19 May 2023 15:34:39 +0000 (17:34 +0200)]
buildsys: add sbuild convenience target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: drop bogus and unused NOVIEW variable
Thomas Lamprecht [Fri, 19 May 2023 15:34:25 +0000 (17:34 +0200)]
buildsys: drop bogus and unused NOVIEW variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: drop bogus and unused PERL_APIVER
Thomas Lamprecht [Fri, 19 May 2023 15:34:09 +0000 (17:34 +0200)]
buildsys: drop bogus and unused PERL_APIVER

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agopmxcfs: migrate to g_memdup2
Thomas Lamprecht [Fri, 19 May 2023 15:29:08 +0000 (17:29 +0200)]
pmxcfs: migrate to g_memdup2

As the previously used g_memdup is deprecated since GLib 2.68, due to
being prone to integer overflows when converting the argument from a
gsize to a guint, while that only produces a warning we compile with
Werror, so this FTBFS.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: avoid versioned build-dependcies with a -1 Debian revisions
Thomas Lamprecht [Fri, 19 May 2023 15:26:23 +0000 (17:26 +0200)]
d/control: avoid versioned build-dependcies with a -1 Debian revisions

for us not _that_ relevant, but it makes backporting unnecessarily
difficult and is just useless.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: add DSC target
Thomas Lamprecht [Fri, 19 May 2023 15:17:46 +0000 (17:17 +0200)]
buildsys: add DSC target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: refactor generating build directory into own target
Thomas Lamprecht [Fri, 19 May 2023 15:16:55 +0000 (17:16 +0200)]
buildsys: refactor generating build directory into own target

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agobuildsys: use full DEB_VERSION
Thomas Lamprecht [Fri, 19 May 2023 15:06:39 +0000 (17:06 +0200)]
buildsys: use full DEB_VERSION

we're in control of this, so don't need to be scared about epoch
bumps or the like

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: raise standards version compliance to 4.6.2
Thomas Lamprecht [Fri, 19 May 2023 15:05:55 +0000 (17:05 +0200)]
d/control: raise standards version compliance to 4.6.2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agod/control: define compat level via build-depends and raise to 13
Thomas Lamprecht [Fri, 19 May 2023 15:05:51 +0000 (17:05 +0200)]
d/control: define compat level via build-depends and raise to 13

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agouse combined dpkg packaging variable makefile fragment
Thomas Lamprecht [Fri, 19 May 2023 15:05:04 +0000 (17:05 +0200)]
use combined dpkg packaging variable makefile fragment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agomakefile: convert to use simple parenthesis
Thomas Lamprecht [Fri, 19 May 2023 15:04:05 +0000 (17:04 +0200)]
makefile: convert to use simple parenthesis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
11 months agodrop out of date authors file
Thomas Lamprecht [Fri, 19 May 2023 14:56:10 +0000 (16:56 +0200)]
drop out of date authors file

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agobump version to 7.3-3
Thomas Lamprecht [Mon, 20 Mar 2023 10:17:04 +0000 (11:17 +0100)]
bump version to 7.3-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agocrs: add ha-rebalance-on-start sub-option to datacenter config
Thomas Lamprecht [Mon, 20 Mar 2023 06:39:25 +0000 (07:39 +0100)]
crs: add ha-rebalance-on-start sub-option to datacenter config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
13 months agodc config: mark HA CRS scheduler sub-property optional
Thomas Lamprecht [Mon, 20 Mar 2023 06:36:04 +0000 (07:36 +0100)]
dc config: mark HA CRS scheduler sub-property optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
14 months agofix #4234: vzdump: add cluster-wide configuration
Leo Nunner [Tue, 7 Mar 2023 12:11:03 +0000 (13:11 +0100)]
fix #4234: vzdump: add cluster-wide configuration

Introduce a cluster-wide vzdump.conf file which gets filled with the
default vzdump configuration.

Signed-off-by: Leo Nunner <l.nunner@proxmox.com>
14 months agopvecm add: require user to navigate out of /etc/pve
Friedrich Weber [Thu, 9 Mar 2023 12:30:19 +0000 (13:30 +0100)]
pvecm add: require user to navigate out of /etc/pve

If `pvecm add` is issued from /etc/pve (or any subdirectory), it
prints some errors:

    [...]
    shell-init: error retrieving current directory: getcwd: cannot
    access parent directories: Transport endpoint is not connected
    [...]
    successfully added node 'pve-c2' to cluster.
    cannot fetch initial working directory: Transport endpoint is not
    connected at /usr/share/perl5/PVE/CLI/pvecm.pm line 446.

The reason is that `pvecm add` restarts pmxcfs, which re-mounts the
fuse mount at /etc/pve, invalidating pvecm's working directory.

The error messages give the impression that something went wrong.
Indeed, the second error indicates the temporary directory is not
cleaned up. The cluster join itself actually works, though.

The issue could be fixed by chdir'ing to / in `pvecm add`. However,
the user's shell would still remain in the now-invalid /etc/pve,
potentially leading to confusing "transport endpoint not connected"
messages in future interactions.

To avoid this, require the user to chdir out of /etc/pve before
running `pvecm add`.

Signed-off-by: Friedrich Weber <f.weber@proxmox.com>
15 months agofix variable declared in conditional statement
Thomas Lamprecht [Fri, 27 Jan 2023 10:40:22 +0000 (11:40 +0100)]
fix variable declared in conditional statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agobump version to 7.3-2
Thomas Lamprecht [Tue, 3 Jan 2023 15:32:18 +0000 (16:32 +0100)]
bump version to 7.3-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
16 months agofix #1295: add config schema to control pending update notifications
Thomas Lamprecht [Tue, 3 Jan 2023 15:08:21 +0000 (16:08 +0100)]
fix #1295: add config schema to control pending update notifications

For now allow a simple selection of `auto` (current behavior),
`always` (if updates are available) or `never`.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agobump version to 7.3-1
Thomas Lamprecht [Mon, 21 Nov 2022 07:34:41 +0000 (08:34 +0100)]
bump version to 7.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodatacenter config: add 'case-sensitive' option to to 'tag-styles'
Thomas Lamprecht [Mon, 21 Nov 2022 07:32:08 +0000 (08:32 +0100)]
datacenter config: add 'case-sensitive' option to to 'tag-styles'

defaults to off, but admins that want that can turn it on easily

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodatacenter config: remove typos in "user-tag-access" description
Stefan Sterz [Fri, 18 Nov 2022 15:28:03 +0000 (16:28 +0100)]
datacenter config: remove typos in "user-tag-access" description

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
17 months agobump version to 7.2-3
Thomas Lamprecht [Thu, 17 Nov 2022 12:04:38 +0000 (13:04 +0100)]
bump version to 7.2-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agoregister new file firewall/cluster.fw
Stefan Hrdlicka [Mon, 24 Oct 2022 14:33:59 +0000 (16:33 +0200)]
register new file firewall/cluster.fw

added file for cache from bugzilla case #1965

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
17 months agodatacenter config: add cluster resource scheduling (crs) options
Fiona Ebner [Thu, 10 Nov 2022 14:37:48 +0000 (15:37 +0100)]
datacenter config: add cluster resource scheduling (crs) options

Initially, with a setting for HA to switch between basic (just count
services) and static (use static node and resource information).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
17 months agodatacenter config: add 'ordering' property to 'tag-style' option
Dominik Csapak [Wed, 16 Nov 2022 15:47:59 +0000 (16:47 +0100)]
datacenter config: add 'ordering' property to 'tag-style' option

So that the admin can decide if the tags should be sorted in the
front end UI.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodatacenter config: add options to control tag usage rights
Dominik Csapak [Wed, 16 Nov 2022 15:47:58 +0000 (16:47 +0100)]
datacenter config: add options to control tag usage rights

By adding a 'user-tag-privileges' and 'registered-tags' option.

The former sets the general policy by which "normal" users (with just
'VM.Config.Options' on the respective guest) can set or delete tags
on a guest, and the latter is a list of registered tags only settable
by users with admin-like permission ('Sys.Modify' on '/'); it is
designed to be used as source/target for actions like backup jobs in
the future.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [T: drop outdated stuff & reword/work commit message]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agodatacenter config: add tag-style property
Dominik Csapak [Wed, 16 Nov 2022 15:47:57 +0000 (16:47 +0100)]
datacenter config: add tag-style property

It's a property string containing 'tree-shape' and 'colors' the
colors are formatted like this:

<tag>:<background-color>[:<text-color>]

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agocluster: add get_guest_config_properties
Dominik Csapak [Wed, 16 Nov 2022 15:47:56 +0000 (16:47 +0100)]
cluster: add get_guest_config_properties

Akin to the singular get_guest_config_property, but with the
possibility to query a list of properties.

Uses the CFS_IPC_GET_GUEST_CONFIG_PROPERTIES introduced in the
previous patch.

Note that the same details apply w.r.t. parsing and permissions as
the singular variant, iow. one needs to take caution and filter
allowed guests views  on call site when using this.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [T: reword/extend commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
17 months agopmxcfs: add IPC call to get multiple guest config properties at once
Dominik Csapak [Wed, 16 Nov 2022 15:47:55 +0000 (16:47 +0100)]
pmxcfs: add IPC call to get multiple guest config properties at once

Previously we used the existing IPC call just for getting the `lock`
property of virtual guests in the cluster resource API call, but for
the tag display we'll to get another one and calling this twice seems
rather non-ideal.

Thus introduce a successor: CFS_IPC_GET_GUEST_CONFIG_PROPERTIES

It allows one to get multiple properties from a single, or all
virtual guest in-memory configs in one go. Keep the existing IPC call
as is for backward compatibility and add this as separate, new one.

The new IPC command basically behaves the same as the previous
CFS_IPC_GET_GUEST_CONFIG_PROPERTY, but takes a list of properties
instead and returns multiple properties per guest.

The existing perl wrapper around the IPC call to get a single
property was switched over to use the new IPC call too, so we'll
be able to drop the old IPC command with the next major release if
nothing comes up.

= Benchmark =

== Setup ==

Proxmox VE in a VM with CPU type host (Intel 12700k) and 4 cores
10000 typical configs with both 'lock' and 'tags' set at the end, and
fairly long tags ('test-tag1,test-tag2,test-tag3') (normal VM with a
snapshot, ~ 1 KiB)

== Test ==

Average of 100 runs each with time in milliseconds

== Previous Results ==

num props  total time  time per iteration
1          1054.2      10.2

== Results with this Patch ==

num props  total time  time per iter  function
2          1332.2      13.2           get_properties
1          1051.2      10.2           get_properties
2          2082.2      20.2           get_property, 2 separate calls
1          1034.2      10.2           get_property

So, a call with the new code for one property is the same as with the
old code, and adding a second property only adds a bit of additional
time (in this case ~30%).

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
 [ T: reword & re-structure commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
18 months agoRevert "add nodes/hardware-map.conf"
Thomas Lamprecht [Wed, 9 Nov 2022 08:42:29 +0000 (09:42 +0100)]
Revert "add nodes/hardware-map.conf"

This reverts commit 7ab9ce86d35a91ca0d8b0d6906db3bc4cb3f3881.

18 months agoadd nodes/hardware-map.conf
Dominik Csapak [Tue, 20 Sep 2022 12:50:07 +0000 (14:50 +0200)]
add nodes/hardware-map.conf

to PVE/Cluster.pm
and status.c

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
19 months agodb: whitespace/style cleanup & a typo fix
Thomas Lamprecht [Tue, 4 Oct 2022 12:05:28 +0000 (14:05 +0200)]
db: whitespace/style cleanup & a typo fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
19 months agologger: drop fixme comment and add context to clusterlog duplicate log
Thomas Lamprecht [Tue, 4 Oct 2022 12:04:51 +0000 (14:04 +0200)]
logger: drop fixme comment and add context to clusterlog duplicate log

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
20 months agopmxcfs: fix typo s/udpate/update
Fabian Grünbichler [Mon, 5 Sep 2022 11:36:45 +0000 (13:36 +0200)]
pmxcfs: fix typo s/udpate/update

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
21 months agoadd 'allow-subdomains' to webauthn schema
Wolfgang Bumiller [Mon, 25 Jul 2022 11:51:08 +0000 (13:51 +0200)]
add 'allow-subdomains' to webauthn schema

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
22 months agobump version to 7.2-2
Thomas Lamprecht [Thu, 14 Jul 2022 05:38:52 +0000 (07:38 +0200)]
bump version to 7.2-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agocode style and update some comments
Thomas Lamprecht [Thu, 14 Jul 2022 05:35:20 +0000 (07:35 +0200)]
code style and update some comments

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
22 months agocorosync.conf sync: reload after sleep
Fabian Grünbichler [Thu, 7 Jul 2022 08:21:52 +0000 (10:21 +0200)]
corosync.conf sync: reload after sleep

if processing a corosync.conf update is delayed on a single node,
reloading the config too early can have disastrous results (loss of
token and HA fence). artifically delay the reload command by one second
to allow update propagation in most scenarios until a proper solution
(e.g., using broadcasting/querying of locally deployed config versions)
has been developed and fully tested.

reported on the forum:
https://forum.proxmox.com/threads/expanding-cluster-reboots-all-vms.110903/

reported issue can be reproduced by deploying a patched pmxcfs on
non-reloading node that sleeps before writing out a broadcasted
corosync.conf update and adding a node to the cluster, leading to the
following sequence of events:

- corosync config reload command received
- corosync config update written out

which causes that particular node to have a different view of cluster
topology, causing all corosync communication to fail for all nodes until
corosync on the affected node is restarted (the on-disk config is
correct after all, just not in effect).

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agocluster config: mark qdevice end point as protected
Stefan Sterz [Wed, 11 May 2022 09:27:07 +0000 (11:27 +0200)]
cluster config: mark qdevice end point as protected

The qdevice status endpoint retrieves some required info via writing
a status command to the qdevice socket
(/var/run/corosync-qdevice/corosync-qdevice.sock) and then parsing
the response.
Since the socket has 0755 permissions and is owned by root it can not
be written by the unprivileged pveproxy that runs as www-data user.

Relay the endpoint to the privileged pvedaemon by marking it as
`protected` to allow the end point to retrieve data from the qdevice
properly.

Fixes an issue where the api would return an empty object.

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
Tested-by: Oguz Bektas <o.bektas@proxmox.com>
 [ T: extend commit message ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter cfg: clarify that next-id upper boundary is exclusive and fix max
Thomas Lamprecht [Wed, 4 May 2022 05:25:41 +0000 (07:25 +0200)]
datacenter cfg: clarify that next-id upper boundary is exclusive and fix max

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agovmid range: drop perl error context for lower > upper check
Thomas Lamprecht [Mon, 2 May 2022 10:59:14 +0000 (12:59 +0200)]
vmid range: drop perl error context for lower > upper check

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.2-1
Thomas Lamprecht [Thu, 28 Apr 2022 15:11:13 +0000 (17:11 +0200)]
bump version to 7.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoparse datacenter config: remove "\s*" from comment regex
Stefan Sterz [Thu, 24 Feb 2022 14:21:48 +0000 (15:21 +0100)]
parse datacenter config: remove "\s*" from comment regex

To be consistent with PBS's implementation of multi-line comments
remove "\s*" here too. Since the regex isn't lazy .* matches
everything \s* would anyway. (Note that new lines occurs after "$").

Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2 years agodatacenter config: add some comments and improve "console" description
Thomas Lamprecht [Wed, 27 Apr 2022 05:46:38 +0000 (07:46 +0200)]
datacenter config: add some comments and improve "console" description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #439: datacenter config: add infrastructure for next-id range configuration
Thomas Lamprecht [Thu, 24 Mar 2022 13:59:38 +0000 (14:59 +0100)]
fix #439: datacenter config: add infrastructure for next-id range configuration

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter config: fix indentation style
Thomas Lamprecht [Thu, 24 Mar 2022 13:55:50 +0000 (14:55 +0100)]
datacenter config: fix indentation style

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter config: refactor ref-checking for serialization
Thomas Lamprecht [Thu, 24 Mar 2022 12:09:57 +0000 (13:09 +0100)]
datacenter config: refactor ref-checking for serialization

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter config: import parse_property_string
Thomas Lamprecht [Thu, 24 Mar 2022 12:07:50 +0000 (13:07 +0100)]
datacenter config: import parse_property_string

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3957: spell 'occurred' correctly
Fabian Grünbichler [Fri, 25 Mar 2022 08:07:42 +0000 (09:07 +0100)]
fix #3957: spell 'occurred' correctly

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoCluster: fix typo
Dominik Csapak [Mon, 14 Mar 2022 09:03:07 +0000 (10:03 +0100)]
Cluster: fix typo

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 years agobump version to 7.1-3
Thomas Lamprecht [Wed, 15 Dec 2021 14:24:26 +0000 (15:24 +0100)]
bump version to 7.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoclusterlog: fix segfault / wrong iteration bounds
Fabian Grünbichler [Tue, 14 Dec 2021 10:19:12 +0000 (11:19 +0100)]
clusterlog: fix segfault / wrong iteration bounds

the clusterlog struct is a basic ring buffer:

struct clog_base {
    uint32_t size; // total size of this clog_base
    uint32_t cpos; // index into data, starts counting at start of clog_base, initially 0
    char data[];
};

an entry consists of indices of the next and previous entries and
various fields (fixed-length ones omitted here):

typedef struct {
uint32_t prev; // index of previous entry, or 0 if none exists
uint32_t next; // index of next entry
[..] // fixed-length fields
uint8_t node_len;
uint8_t ident_len;
uint8_t tag_len;
uint32_t msg_len;
char data[]; // node+ident+tag+msg - variable-length fields
} clog_entry_t;

the next and prev indices are calculated when allocating a new entry,
and the position of the current entry 'cpos' is updated accordingly
(clog_alloc_entry):
- size of the entry is padded with up to 7 bytes
- first entry goes to index 8
- second and subsequent entries go to the current entry's 'next' index
- if the current entry's 'next' index is out of bonds, the first entry
  is overwritten => wrap-around
- the 'prev' index of the new entry is set to cpos
- cpos is set to the index of the new entry
- the 'next' index of the new entry is set to its index+padded size

when iterating over the entries, the following bounds are used to follow
the 'prev' links starting at the current entry:

while (cpos && (cpos <= clog->cpos || cpos > (clog->cpos + CLOG_MAX_ENTRY_SIZE))) {

while this handles a not-yet-wrapped around ring buffer (cpos would be 0
when reaching the first entry), and tries to handle wrap-arounds by
terminating when reaching a 'red-zone' of 'CLOG_MAX_ENTRY_SIZE' starting
at the current entry (this covers the current entry which was already
visited as first entry during the iteration, and the next entry after it
which might have been overwritten) - but it's possible that entries line
up so that the wrap-around 'prev' index of the first entry points to a
location *before* the current entry.

for example, looking at clog_base with S being the size field, C being
the cpos field, followed by the actual data. N/P are the next/prev
indices of the entry at C, Q denotes the 'prev' index of the first entry
in the data array, and 'R' the red zone used for the loop check in case
of wrap-around.

first, fill up the buffer with six large entries:

Q                               P      C      N
|                               |      |      |
|                               |      |      |
v                               v      v      v
+-+-+------+------+------+------+------+------+-+
| | |      |      |      |      |      |      |x|
| | |   1  |   2  |   3  |   4  |   5  |   6  |x|
| | |      |      |      |      |      |      |x|
+-+-+------+------+------+------+------+------+-+
 S C                                    RRRRRRRRRRR

iterating from C backwards ends up at Q being 0, terminating the loop
without a wrap-around after having visit 6->1

now the next (in this example, smaller) entry that gets allocated/insert
needs to wrap around, because the empty space at the end (denoted by
XXX) is too small:

    C      N                          QP
    |      |                          ||
    |      |                          ||
    v      v                          vv
+-+-+------+------+------+------+------+------+-+
| | |      |      |      |      |      |      |x|
| | |   7  |   2  |   3  |   4  |   5  |   6  |x|
| | |      |      |      |      |      |      |x|
+-+-+------+------+------+------+------+------+-+
 S C RRRRRRRRRRR

iterating backwards from C terminates the loop when reaching the red
zone, with the (second) entry no longer being considered since it partly
overlaps it. only 7->3 are visited.

adding more entries we end up with the following layout:

                                   P  QC   N
                                   |  ||   |
                                   |  ||   |
                                   v  vv   v
+-+-+------+---+---+---+---+---+---+---+---+--+-+
| | |      |   |   |   |   |   |   |   |   |##|x|
| | |   7  | 8 | 9 |10 |11 |12 |13 |14 |15 |#6|x|
| | |      |   |   |   |   |   |   |   |   |##|x|
+-+-+------+---+---+---+---+---+---+---+---+--+-+
 S C                                    RRRRRRRRRRR

with # denoting space previously occupied the last large entry (#6)
which is still unmodified (the rest of that entry's data has been
overwritten by entries #14 and #15).

iterating from C (to the left/P) the loop ends up at entry #7, follows
the link to Q (which satisfies the loop bounds as Q < C), and the data
starting at (invalid index) Q gets interpreted as an entry. it is
possible (though even more unlikely than the partial overwrite case)
that Q and C line up perfectly, which would cause the loop to become an
infinite loop. the loop *should* terminate after having visited 15-7,
without wrapping around.

note that the actual sizes of the entries are not relevant, the
requirements are:
- entry before last wrap-around must be big enough that entry of current
  index can overtake it without another wrap-around
- method that does iteration must be called before next wrap-around

the fix is obviously trivial once the issue became apparent - when
wrapping around during iteration, additionally check that we are not
jumping across the red zone into already invalidated parts of data.

clusterlog_merge is technically not affected since it aborts before a
wrap-around anyway, but it doesn't hurt to have the checks consistently
in case this ever changes.

thanks to @kev1904 on our community forums for reporting and providing the data
to nail the cause down fast!

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agoclusterlog: segfault reproducer
Fabian Grünbichler [Tue, 14 Dec 2021 10:19:11 +0000 (11:19 +0100)]
clusterlog: segfault reproducer

see next commit for details.

get_state mimics the code path triggered in the wild, the other two are
affected just the same.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agod/copyright: update years
Thomas Lamprecht [Thu, 18 Nov 2021 07:48:22 +0000 (08:48 +0100)]
d/copyright: update years

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobuildsys: fix variable names
Thomas Lamprecht [Mon, 15 Nov 2021 13:43:37 +0000 (14:43 +0100)]
buildsys: fix variable names

wrong was only the DBG one but make the LIB one use an underscore
separator too...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agobump version to 7.1-2
Thomas Lamprecht [Mon, 15 Nov 2021 13:32:00 +0000 (14:32 +0100)]
bump version to 7.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter.cfg: code style fixes
Thomas Lamprecht [Mon, 15 Nov 2021 13:30:02 +0000 (14:30 +0100)]
datacenter.cfg: code style fixes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agodatacenter.cfg: fix fall back for undefined config
Thomas Lamprecht [Mon, 15 Nov 2021 13:27:12 +0000 (14:27 +0100)]
datacenter.cfg: fix fall back for undefined config

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reported-by: Oguz Bektas <o.bektas@proxmox.com>
2 years agobump version to 7.1-1
Thomas Lamprecht [Mon, 15 Nov 2021 07:24:36 +0000 (08:24 +0100)]
bump version to 7.1-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agofix #3596: handle delnode of offline node
Fabian Grünbichler [Fri, 12 Nov 2021 08:45:27 +0000 (09:45 +0100)]
fix #3596: handle delnode of offline node

the recommended way is to first shutdown, then delnode, and never let it
come back online, in which case corosync-cfgtool won't be able to kill
the removed (offline) node.

also, the order was wrong - if we first update corosync.conf to remove
the node entry from the nodelist, corosync doesn't know about the nodeid
anymore, so killing will fail even if the node is still online.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2 years agobump version to 7.0-5
Thomas Lamprecht [Thu, 11 Nov 2021 16:22:03 +0000 (17:22 +0100)]
bump version to 7.0-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosysctl: disable net.ipv4.igmp_link_local_mcast_reports
Alexandre Derumier [Wed, 6 Oct 2021 08:32:20 +0000 (10:32 +0200)]
sysctl: disable net.ipv4.igmp_link_local_mcast_reports

currently, when veth or tap interfaces are plugged to bridge,
an igmp v3 report is broadcasted to the network, with the
bridge mac adddress.

Users have reported problems with hetzner for example, blocking the server
because of the unknown mac flooding the network.
https://forum.proxmox.com/threads/proxmox-claiming-mac-address.52601/page-6#post-421676

some traces:

ip addr:

190: fwbr109i0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 22:5f:0b:cb:ac:42 brd ff:ff:ff:ff:ff:ff

ebtable log:
Oct  6 09:46:24 kvmformation3 kernel: [437256.753355] MAC-FLOOD-F IN=fwpr109p0 OUT=eno1 MAC source = 22:5f:0b:cb:ac:42 MAC dest = 01:00:5e:00:00:16 proto = 0x0800 IP SRC=0.0.0.0 IP DST=224.0.0.22, IP tos=0xC0, IP proto=2

tcpdump -e -i eno1 igmp
09:53:23.914825 22:5f:0b:cb:ac:42 (oui Unknown) > 01:00:5e:00:00:16 (oui Unknown), ethertype IPv4 (0x0800), length 54: 0.0.0.0 > igmp.mcast.net: igmp v3 report, 1 group record(s)

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agosysctl snippet: move to /usr/lib and prefix with 10-
Stoiko Ivanov [Thu, 11 Nov 2021 15:42:09 +0000 (16:42 +0100)]
sysctl snippet: move to /usr/lib and prefix with 10-

following best-practices according to `sysctl.d(5)`:
* Packages should install their configuration files in /usr/lib/ ...
* It is recommended to prefix all filenames with a two-digit number
  and a dash ...

the conffile removal is inspired by how it was done in `procps` (one
of the few packages in the debian repository, which did this
transition) and by following `dpkg-maintscript-helper(1)` and
`deb-conffiles(5)` (the former recommending the latter)

The choice of 10- as prefix is due to pve-container shipping its
snippet with that prefix already. other packages use higher numbers
(e.g. systemd - 50-)

Tested on 2 VMs (one with modifications, the other without) - worked
as advertised (the modified file was kept as
/etc/sysctl.d/pve.conf.dpkg-old and the upgrade notified me of the
change)

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2 years agocluster: small code/style cleanups
Thomas Lamprecht [Thu, 11 Nov 2021 16:08:16 +0000 (17:08 +0100)]
cluster: small code/style cleanups

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd webauthn configuration to datacenter.cfg
Wolfgang Bumiller [Tue, 9 Nov 2021 11:27:06 +0000 (12:27 +0100)]
add webauthn configuration to datacenter.cfg

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2 years agobump version to 7.0-4
Thomas Lamprecht [Tue, 9 Nov 2021 17:30:14 +0000 (18:30 +0100)]
bump version to 7.0-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2 years agoadd 'jobs.cfg' to observed files
Dominik Csapak [Mon, 8 Nov 2021 13:07:52 +0000 (14:07 +0100)]
add 'jobs.cfg' to observed files

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Tested-By: Dylan Whyte <d.whyte@proxmox.com>
Tested-By: Aaron Lauterer <a.lauterer@proxmox.com>