5
0
mirror of git://git.proxmox.com/git/pve-cluster.git synced 2025-03-11 16:58:28 +03:00

747 Commits

Author SHA1 Message Date
Thomas Lamprecht
3b61597641 use combined dpkg packaging variable makefile fragment
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-19 17:05:04 +02:00
Thomas Lamprecht
49179c316f makefile: convert to use simple parenthesis
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-19 17:04:05 +02:00
Thomas Lamprecht
5f86768caa drop out of date authors file
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-05-19 16:56:10 +02:00
Thomas Lamprecht
1fa86afba4 bump version to 7.3-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-20 11:17:04 +01:00
Thomas Lamprecht
1a75f4db36 crs: add ha-rebalance-on-start sub-option to datacenter config
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-20 07:39:25 +01:00
Thomas Lamprecht
c008170e6f dc config: mark HA CRS scheduler sub-property optional
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-03-20 07:36:04 +01:00
Leo Nunner
581e22f406 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>
2023-03-11 18:11:13 +01:00
Friedrich Weber
91c2593616 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>
2023-03-11 18:01:09 +01:00
Thomas Lamprecht
deeedc09ae fix variable declared in conditional statement
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-27 11:40:22 +01:00
Thomas Lamprecht
fc822a9f65 bump version to 7.3-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-01-03 16:32:18 +01:00
Thomas Lamprecht
63e5cd0970 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>
2023-01-03 16:29:33 +01:00
Thomas Lamprecht
ce908dd9b6 bump version to 7.3-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-21 08:34:41 +01:00
Thomas Lamprecht
2453d13ff8 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>
2022-11-21 08:33:37 +01:00
Stefan Sterz
e46444634a datacenter config: remove typos in "user-tag-access" description
Signed-off-by: Stefan Sterz <s.sterz@proxmox.com>
2022-11-18 16:34:32 +01:00
Thomas Lamprecht
3cc1452379 bump version to 7.2-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 13:04:38 +01:00
Stefan Hrdlicka
cabbc27ee9 register new file firewall/cluster.fw
added file for cache from bugzilla case #1965

Signed-off-by: Stefan Hrdlicka <s.hrdlicka@proxmox.com>
2022-11-17 12:49:37 +01:00
Fiona Ebner
b466e489b7 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>
2022-11-17 12:48:59 +01:00
Dominik Csapak
8456e52e5b 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>
2022-11-17 10:02:13 +01:00
Dominik Csapak
c17e397bac 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>
2022-11-17 10:02:13 +01:00
Dominik Csapak
af234c4be9 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>
2022-11-17 10:02:13 +01:00
Dominik Csapak
3e9a2ecb1a 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>
2022-11-17 10:02:13 +01:00
Dominik Csapak
73a3182391 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>
2022-11-17 10:01:55 +01:00
Thomas Lamprecht
55d19f3f7d Revert "add nodes/hardware-map.conf"
This reverts commit 7ab9ce86d35a91ca0d8b0d6906db3bc4cb3f3881.
2022-11-09 09:42:29 +01:00
Dominik Csapak
7ab9ce86d3 add nodes/hardware-map.conf
to PVE/Cluster.pm
and status.c

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-11-08 19:03:10 +01:00
Thomas Lamprecht
48009cd2c7 db: whitespace/style cleanup & a typo fix
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-10-04 14:05:28 +02:00
Thomas Lamprecht
c16c036b81 logger: drop fixme comment and add context to clusterlog duplicate log
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-10-04 14:04:51 +02:00
Fabian Grünbichler
bafa2dc27c pmxcfs: fix typo s/udpate/update
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-05 13:36:45 +02:00
Wolfgang Bumiller
3b0214b610 add 'allow-subdomains' to webauthn schema
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-25 13:51:10 +02:00
Thomas Lamprecht
f9eb3f1510 bump version to 7.2-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-07-14 07:38:52 +02:00
Thomas Lamprecht
4f26cc86e0 code style and update some comments
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-07-14 07:35:20 +02:00
Fabian Grünbichler
f64bc7290b 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>
2022-07-07 11:34:57 +02:00
Stefan Sterz
665156658d 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>
2022-05-11 12:13:18 +02:00
Thomas Lamprecht
8ca3c4bba3 datacenter cfg: clarify that next-id upper boundary is exclusive and fix max
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-04 07:25:41 +02:00
Thomas Lamprecht
fe2bc75810 vmid range: drop perl error context for lower > upper check
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-02 12:59:14 +02:00
Thomas Lamprecht
4786150bcf bump version to 7.2-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 17:11:13 +02:00
Stefan Sterz
09b9955053 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>
2022-04-27 08:15:45 +02:00
Thomas Lamprecht
0cc6e73740 datacenter config: add some comments and improve "console" description
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 07:46:38 +02:00
Thomas Lamprecht
75e5d02e29 fix #439: datacenter config: add infrastructure for next-id range configuration
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 07:44:58 +02:00
Thomas Lamprecht
02ce710f0d datacenter config: fix indentation style
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 07:34:46 +02:00
Thomas Lamprecht
5b576e2679 datacenter config: refactor ref-checking for serialization
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 07:34:46 +02:00
Thomas Lamprecht
518662743a datacenter config: import parse_property_string
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 07:34:46 +02:00
Fabian Grünbichler
da578f5a86 fix #3957: spell 'occurred' correctly
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-03-25 09:07:42 +01:00
Dominik Csapak
8a93eeae9e Cluster: fix typo
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-03-16 10:51:58 +01:00
Thomas Lamprecht
92f5c7f00a bump version to 7.1-3
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-12-15 15:24:26 +01:00
Fabian Grünbichler
dcd4841f39 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>
2021-12-14 15:15:14 +01:00
Fabian Grünbichler
cfac4d1eb4 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>
2021-12-14 15:15:14 +01:00
Thomas Lamprecht
b4afda7e4c d/copyright: update years
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-18 08:48:22 +01:00
Thomas Lamprecht
537a44508d 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>
2021-11-15 14:43:41 +01:00
Thomas Lamprecht
5840283565 bump version to 7.1-2
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-15 14:32:00 +01:00
Thomas Lamprecht
459f60841a datacenter.cfg: code style fixes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-11-15 14:30:02 +01:00