]> git.proxmox.com Git - pve-cluster.git/log
pve-cluster.git
3 years agobump version to 6.1-8
Thomas Lamprecht [Sun, 3 May 2020 16:19:31 +0000 (18:19 +0200)]
bump version to 6.1-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoprepare observed-files basedire: fix mounted check
Thomas Lamprecht [Sun, 3 May 2020 16:19:18 +0000 (18:19 +0200)]
prepare observed-files basedire: fix mounted check

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.1-8
Thomas Lamprecht [Sat, 2 May 2020 17:14:37 +0000 (19:14 +0200)]
bump version to 6.1-8

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agosdn: add sdn/.version file
Alexandre Derumier [Mon, 13 Apr 2020 06:12:57 +0000 (08:12 +0200)]
sdn: add sdn/.version file

4 years agosdn: remove .new files
Alexandre Derumier [Mon, 13 Apr 2020 06:12:56 +0000 (08:12 +0200)]
sdn: remove .new files

4 years agobump version to 6.1-7
Thomas Lamprecht [Thu, 30 Apr 2020 15:33:56 +0000 (17:33 +0200)]
bump version to 6.1-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoupdatecerts: create base directories of observed files
Thomas Lamprecht [Thu, 30 Apr 2020 15:30:44 +0000 (17:30 +0200)]
updatecerts: create base directories of observed files

replaces the random hacks where we do some hail-mary mkdir in a
writer or the like, to ensure that the directory structure exists and
we can write safely.

more central and safer would be pmxcfs itself, but to late in the
release cycle to do that now.

Chicken out if pmxcfs is not mounted, we don't want to trash it's
(future) mountpoint..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.1-6
Thomas Lamprecht [Thu, 30 Apr 2020 12:32:17 +0000 (14:32 +0200)]
bump version to 6.1-6

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAdd ACME plugin config file to cluster files
Wolfgang Link [Thu, 16 Apr 2020 05:18:18 +0000 (07:18 +0200)]
Add ACME plugin config file to cluster files

Signed-off-by: Wolfgang Link <w.link@proxmox.com>
4 years agocfs_lock: make it more clear that an error happened during not with the cfs-lock
Thomas Lamprecht [Wed, 29 Apr 2020 09:13:59 +0000 (11:13 +0200)]
cfs_lock: make it more clear that an error happened during not with the cfs-lock

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix trailing whitespace error
Thomas Lamprecht [Wed, 29 Apr 2020 09:11:23 +0000 (11:11 +0200)]
fix trailing whitespace error

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfs_lock: re-raise exceptions
Fabian Grünbichler [Wed, 29 Apr 2020 08:52:51 +0000 (10:52 +0200)]
cfs_lock: re-raise exceptions

so that API paths that raise an exception while holding a CFS lock
properly propagate that exception to the client, instead of the
stringified version with added noise about locks added to the front.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agocfs_lock: add firewall lock helper
Fabian Grünbichler [Wed, 29 Apr 2020 08:52:48 +0000 (10:52 +0200)]
cfs_lock: add firewall lock helper

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agobump version to 6.1-5
Thomas Lamprecht [Wed, 25 Mar 2020 16:38:49 +0000 (17:38 +0100)]
bump version to 6.1-5

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agojoin API version: factor out checks and add info to outputs
Thomas Lamprecht [Wed, 25 Mar 2020 16:31:31 +0000 (17:31 +0100)]
join API version: factor out checks and add info to outputs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAdd cluster join API version check
Stefan Reiter [Thu, 9 Jan 2020 15:31:36 +0000 (16:31 +0100)]
Add cluster join API version check

Adds API call GET /cluster/config/apiversion to retrieve remote clusters
join-API version (0 is assumed for versions without this endpoint). Also
available via CLI as 'pvecm apiver'.

Introduce API_AGE similar to storage plugin API, but with two ages for
cluster/joinee roles. Currently, all versions are intercompatible.

For future usage, a new 'addnode' parameter 'apiversion' is introduced,
to allow introducing API breakages for joining nodes as well.

As a first compatibility check, use new fallback method only if
available. This ensures full compatibility between nodes/clusters with
and without new fallback behaviour.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agopvecm: qdevice setup: fix check for odd node count
Aaron Lauterer [Tue, 24 Mar 2020 16:16:42 +0000 (17:16 +0100)]
pvecm: qdevice setup: fix check for odd node count

With Perl 5.26 the behavior of `scalar(%hash)` changed [0] causing the
check for odd numbers to never evaluate to true. Allowing odd sized
clusters to set up a QDevice. The algorithm was not changed to LMS if
forced to still create the QDevice.

Instead of showing the bucket info of the referenced hash it did show
the hash reference. Dereferencing it will again return the number of
items present in the hash.

[0] https://perldoc.perl.org/perl5260delta.html#scalar(%25hash)-return-signature-changed

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
4 years agoassert joinable: add warning if forced to continue
Thomas Lamprecht [Wed, 19 Feb 2020 08:32:36 +0000 (09:32 +0100)]
assert joinable: add warning if forced to continue

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopvecm: exec corosync commands directly
Thomas Lamprecht [Wed, 19 Feb 2020 08:32:07 +0000 (09:32 +0100)]
pvecm: exec corosync commands directly

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAdd verification and fallback to cluster join/addnode
Stefan Reiter [Thu, 9 Jan 2020 15:31:35 +0000 (16:31 +0100)]
Add verification and fallback to cluster join/addnode

Verify that the config of the new node is valid and compatible with the
cluster (i.e. that the links for the new node match the currently
configured nodes).

Additionally, fallback is provided via a new parameter to addnode,
'new_node_ip'. Previously, fallback was handled on the joining node, by
setting it's local IP as 'link0', however, a cluster with only one link,
but numbered 1-7 is still valid, and a fallback is possible, but the old
code would now fail.

Instead, pass the locally resolved IP via a seperate parameter
(resolving the IP on the cluster side is impractical, as IP resolution
could fail or provide a wrong IP for Corosync).

For compatibility reasons, allow fallback to occur via the old
method as well, but mark with FIXME for future removal.

Fallback fails in case the cluster has more than one link, in this case
only the user can know which NIC/IP corresponds to which cluster link.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoEnable support for up to 8 corosync links
Stefan Reiter [Thu, 9 Jan 2020 15:31:34 +0000 (16:31 +0100)]
Enable support for up to 8 corosync links

add_corosync_link_properties/extract_corosync_link_args are introduced
as helpers to avoid hardcoding links in parameters=>properties on
several occasions, while still providing autocompletion with pvecm by
being seperate parameters instead of an array.

Maximum number of links is given as constant MAX_LINK_COUNT, should it
change in the future.

All necessary functions have been updated to
use the new $links array format instead of seperate $link0/$link1
parameters, and call sites changed accordingly.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agocorosync: add verify_conf
Stefan Reiter [Thu, 9 Jan 2020 15:31:33 +0000 (16:31 +0100)]
corosync: add verify_conf

It does some basic sanity checking, warns the user about encryption
settings and unresolved hostnames, and finally makes sure that all nodes
have the same links configured (as well as comparing the configured
links to specified interfaces, if there are any).

A corosync.conf that has been created and modified strictly through our
API should *always* be valid.

verify_conf is called in 'addnode', warnings and errors are returned via
the API to be displayed in the task log of the node asking to join. If a
verification error occurs, it is handled specially via a "raise" outside
of any lock code that strips extra information from an Exception
instance. This ensures that multi-line formatted errors can be returned.
Warnings are always returned as array, to be printed on the caller.

Includes testing.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agobump version to 6.1-4
Thomas Lamprecht [Tue, 28 Jan 2020 14:24:48 +0000 (15:24 +0100)]
bump version to 6.1-4

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: drop shlibs:Depends for architecture independent packages
Thomas Lamprecht [Tue, 28 Jan 2020 14:26:38 +0000 (15:26 +0100)]
d/control: drop shlibs:Depends for architecture independent packages

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd some dev test scripts for evaluating a few IPC calls hands on
Thomas Lamprecht [Mon, 27 Jan 2020 17:15:56 +0000 (18:15 +0100)]
add some dev test scripts for evaluating a few IPC calls hands on

simple stuff and not a real unit or regression test, still useful
when checking how/if something works or benchmarking..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agotoken IPC: mark pointed data as const when only pointer is mutable
Thomas Lamprecht [Mon, 27 Jan 2020 17:23:40 +0000 (18:23 +0100)]
token IPC: mark pointed data as const when only pointer is mutable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: add verify_token IPC request
Fabian Grünbichler [Tue, 21 Jan 2020 12:53:57 +0000 (13:53 +0100)]
pmxcfs: add verify_token IPC request

Add a new IPC request which takes a token string and matches it with
the priv/token.cfg shadow file, this allows non-root processes with
the privilege of doing IPC requests, to verify tokens without being
able to read the full token list itself.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
[ Thomas: solved merge conflict in observer files struct ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.1-3
Thomas Lamprecht [Fri, 17 Jan 2020 09:30:15 +0000 (10:30 +0100)]
bump version to 6.1-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAdd "cpu-models.conf" to observed files
Stefan Reiter [Thu, 16 Jan 2020 15:40:47 +0000 (16:40 +0100)]
Add "cpu-models.conf" to observed files

Holds information about custom CPU models, section config style. Used in
qemu-server.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoFix #2553: Prevent the Deadlock by aligning the lockorder
Kevin Greßlehner [Tue, 14 Jan 2020 11:48:28 +0000 (11:48 +0000)]
Fix #2553: Prevent the Deadlock by aligning the lockorder

Overview:
Every once in a while the /etc/pve directory freezes. ("ls" and "df"
does not work) Therefore the most pve components do not work anymore.
(webinterface is not answering, shell commands do not work) This
mostly happens during snapshots, which happen frequently in my case.
The workaround / temporary solution is to restart the pve-cluster
service.

Steps to reproduce:
Make frequent snapshots/snapshot-deletes on a default installation.
The /etc/pve direcetory will freeze at some point.

Cause;
When a snapshot is made, it eventually invokes memdb_rename
(memdb.c:1103), which at first locks the memdb->mutex at memdb.c:1122
and then invokes the methods vmlist_different_vm_exists
(memdb.c:1147) or vmlist_register_vm (memdb.c:1233).  These methods
are defined in status.c and want to lock the mutex lock of
(status.c:689 and status.c:669.

The deadlock appears when cfs_create_guest_conf_propertiy_msg aquires
the status.c mutex lock while memdb_rename aquires the memdb.c mutex
lock at the same time. Then cfs_create_guest_conf_propertiy_msg wants
to lock the memdb.c lock at memdb_read (which is held by
memdb_rename) and vmlist_different_vm_exists or vmlist_register_vm
wants to lock the status.c lock (which is held by
cfs_create_guest_conf_propertiy_msg). Both methods are waiting for
each other to unlock their locks -> deadlock.

Fix:
Fix by aligning the lockorder of the memdb and status mutex lock
calls.

Lock &memdb->mutex in memdb_read and refer to a new method
"memdb_read_nolock" in memdb.c which doesn't handle locks by itself.
This method then handles the stuff which was originally in
memdb_read. Therefore everything except
cfs_create_guest_conf_property_msg uses memdb_read (which handles the
locking itself), and cfs_create_guest_conf_property_msg prelocks
&memdb->mutex and invokes memdb_read_nolock.

Signed-off-by: Kevin Greßlehner <kevin_gressi@live.at>
[ added more info from bug report & fixed indentation/line endings ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agogrammar fix: s/does not exists/does not exist/g
Thomas Lamprecht [Fri, 13 Dec 2019 11:05:28 +0000 (12:05 +0100)]
grammar fix: s/does not exists/does not exist/g

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodc.cfg verbose description: fix missing whitespace & reword
Thomas Lamprecht [Sat, 30 Nov 2019 14:50:22 +0000 (15:50 +0100)]
dc.cfg verbose description: fix missing whitespace & reword

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.1-2
Thomas Lamprecht [Wed, 27 Nov 2019 16:19:51 +0000 (17:19 +0100)]
bump version to 6.1-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodc.cfg: mention migrate shutdown policy in verbose desc.
Thomas Lamprecht [Wed, 27 Nov 2019 14:56:57 +0000 (15:56 +0100)]
dc.cfg: mention migrate shutdown policy in verbose desc.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoallow full-mesh routed setup for cluster join
Thomas Lamprecht [Tue, 26 Nov 2019 14:38:10 +0000 (15:38 +0100)]
allow full-mesh routed setup for cluster join

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-10
Thomas Lamprecht [Tue, 26 Nov 2019 14:09:14 +0000 (15:09 +0100)]
bump version to 6.0-10

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoadd sdn vnets/zones/controllers.cfg
Alexandre Derumier [Tue, 26 Nov 2019 13:42:52 +0000 (14:42 +0100)]
add sdn vnets/zones/controllers.cfg

Signed-off-by: Alexandre Derumier <aderumier@odiso.com>
4 years agomtunnel: allow multiple IPs if the are the same
Thomas Lamprecht [Tue, 26 Nov 2019 12:50:32 +0000 (13:50 +0100)]
mtunnel: allow multiple IPs if the are the same

To allow routed full-mesh, where the same IP is used on multiple
adapters. For the migration IP this is OK, as we just want a single
unique IP, if that one is configured more than once does not bothers
us here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agochange certificate lifetime to two years
Dominik Csapak [Tue, 26 Nov 2019 10:01:23 +0000 (11:01 +0100)]
change certificate lifetime to two years

instead of 10 years, to avoid issues with browsers/os that reject
certificates which have a longer lifetime
(e.g. macOs Catalina only accepts max 825 days if issued after july 2019)

also limit the lifetime by the expiry date of the ca, since
a certifiacte cannot be valid longer than its ca

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 years agoallow to set 'migrate' shutdown policy in datacenter.cfg
Thomas Lamprecht [Mon, 25 Nov 2019 18:53:15 +0000 (19:53 +0100)]
allow to set 'migrate' shutdown policy in datacenter.cfg

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-9
Thomas Lamprecht [Fri, 22 Nov 2019 15:30:26 +0000 (16:30 +0100)]
bump version to 6.0-9

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix buildsys for new library packages
Thomas Lamprecht [Fri, 22 Nov 2019 15:28:23 +0000 (16:28 +0100)]
fix buildsys for new library packages

This was forgotten to add/update when the package was refactored ...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #2479: use correct sub in create_conf
Oguz Bektas [Fri, 22 Nov 2019 15:21:44 +0000 (16:21 +0100)]
fix #2479: use correct sub in create_conf

'pvecm create' fails since the subroutine doesn't exist in PVE::Cluster
but in PVE::Corosync

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agocorosync: die in check_conf_exists if !$noerr
Stefan Reiter [Tue, 19 Nov 2019 09:28:29 +0000 (10:28 +0100)]
corosync: die in check_conf_exists if !$noerr

...and change $silent to $noerr for consistency.

Commit 3df092f9 (fix #1380: pvecm status: add general cluster
information) broke "pvecm status" on non-cluster nodes (well, it made
the error look worse, ofc it didn't "work" before either) because it
tries to access a totem that cannot exist without a corosync.conf.

pvecm status/nodes/expected already fail without a cluster, so it makes
more sense to fail early. But instead of copying the way the qdevice API
handles it, move the die to check_conf_exists directly, which makes
more sense then a warn anyway IMHO.

check_conf_exists is never called without $noerr = 1 outside of
pvecm.pm, so this change does not require any versioned depends/breaks.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agopvecm: move assert_joinable to avoid double call
Stefan Reiter [Tue, 19 Nov 2019 09:28:28 +0000 (10:28 +0100)]
pvecm: move assert_joinable to avoid double call

PVE::Cluster::Setup::join already calls assert_joinable, we only need the
explicit call in pvecm if we fall back to SSH.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agopvecm: fix weirdly spaced double-prompt for password on join
Stefan Reiter [Tue, 19 Nov 2019 09:28:27 +0000 (10:28 +0100)]
pvecm: fix weirdly spaced double-prompt for password on join

Not only did it display two prompts with identical meaning, the second
was indented to the end of the first in my terminal for some reason.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agocorosync config: avoid cyclic reference in closure
Thomas Lamprecht [Tue, 19 Nov 2019 15:03:45 +0000 (16:03 +0100)]
corosync config: avoid cyclic reference in closure

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-8
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:07 +0000 (11:28 +0100)]
bump version to 6.0-8

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: update breaks versions to actual one
Thomas Lamprecht [Mon, 18 Nov 2019 11:27:03 +0000 (12:27 +0100)]
d/control: update breaks versions to actual one

ha-manager and pve-manager got bumped during this series development,
so reflect that by updating the breaks versions, to not leave a gap
here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix some lintian warning about Package description/synopsis
Thomas Lamprecht [Mon, 18 Nov 2019 10:47:17 +0000 (11:47 +0100)]
fix some lintian warning about Package description/synopsis

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agod/control: make api lib depend on the same version as cluster lib
Thomas Lamprecht [Mon, 18 Nov 2019 10:46:35 +0000 (11:46 +0100)]
d/control: make api lib depend on the same version as cluster lib

As they need to be the same to work, else some half-upgrades or
half-downgrades can be done, which may break stuff badly. So tell
apt/dpkg about the relation ship be doing a hard version dependency
on ${binary:Version} which is our currently build package version

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopve-cluster.service: move pvecm call to pveproxy.service
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:06 +0000 (11:28 +0100)]
pve-cluster.service: move pvecm call to pveproxy.service

since that is were we actually require a certificate/key to be present

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agosplit package into pve-cluster/pmxcfs and perl modules
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:05 +0000 (11:28 +0100)]
split package into pve-cluster/pmxcfs and perl modules

with the former containing:
- pmxcfs binary + service
- IPCC perl bindings
- PVE::Cluster

and the latter being further split into

libpve-cluster-perl:
- PVE::DataCenterConfig
- various other perl modules not directly related to pmxcfs

and libpve-cluster-api-perl:
- ClusterConfig API
- pvecm CLI
- PVE::Corosync
- PVE::Cluster::Setup helper module

this second split is needed to avoid a (pre-existing) circular
dependency between libpve-access-control and libpve-cluster-perl:
- the cluster API code uses PVE::RPCEnvironment
- the access-control API code uses PVE::DataCenterConfig

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add versioned breaks
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:04 +0000 (11:28 +0100)]
d/control: add versioned breaks

for all the refactored/moved code

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove ssh_info code to own file
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:03 +0000 (11:28 +0100)]
move ssh_info code to own file

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agodatacenter.cfg: parse/print u2f property string
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:02 +0000 (11:28 +0100)]
datacenter.cfg: parse/print u2f property string

when parsing config, like other property strings stored in this file.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove datacenter.cfg to own file
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:01 +0000 (11:28 +0100)]
move datacenter.cfg to own file

and inline get_local_migration_ip into 'pvecm mtunnel', since all the
other callers are either wrong or have different requirements.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove CertCache to pve-manager
Fabian Grünbichler [Mon, 11 Nov 2019 10:28:00 +0000 (11:28 +0100)]
move CertCache to pve-manager

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove certificate cache to own file
Fabian Grünbichler [Mon, 11 Nov 2019 10:27:59 +0000 (11:27 +0100)]
move certificate cache to own file

and just keep node to certificate path helper in PVE::Cluster.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove corosync_link schema to Corosync.pm
Fabian Grünbichler [Mon, 11 Nov 2019 10:27:58 +0000 (11:27 +0100)]
move corosync_link schema to Corosync.pm

since it can be/is already used by all relevant files, and it is not
related at all to pmxcfs.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove cluster setup related code to own file
Fabian Grünbichler [Mon, 11 Nov 2019 10:27:57 +0000 (11:27 +0100)]
move cluster setup related code to own file

this includes:
- directory setup
- ssh setup (known hosts, keys, config)
- CA/certificate helpers
- join helpers used by API and CLI code

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomove RRD creating into own file
Fabian Grünbichler [Mon, 11 Nov 2019 10:27:56 +0000 (11:27 +0100)]
move RRD creating into own file

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agod/control: add missing build-depends
Fabian Grünbichler [Mon, 11 Nov 2019 10:27:55 +0000 (11:27 +0100)]
d/control: add missing build-depends

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agouse PVE::Certificate to read fingerprint
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:08 +0000 (13:36 +0100)]
use PVE::Certificate to read fingerprint

instead of duplicating the whole "read certificate from file" code that
we already have in pve-common.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoremove unused Data::Dumper import
Fabian Grünbichler [Wed, 6 Nov 2019 12:36:07 +0000 (13:36 +0100)]
remove unused Data::Dumper import

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agodc.conf: add missing entries to default language property (he, da)
Thomas Lamprecht [Sat, 5 Oct 2019 11:46:28 +0000 (13:46 +0200)]
dc.conf: add missing entries to default language property (he, da)

To bring it in sink with the one from widget-toolkit add Danish (da)
and Hebrew (he) to this, so user can set it as cluster wide default
language.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agodc.conf: sort languages for easier finding one
Thomas Lamprecht [Sat, 5 Oct 2019 11:41:58 +0000 (13:41 +0200)]
dc.conf: sort languages for easier finding one

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agofix #1380: pvecm status: add general cluster information
Thomas Lamprecht [Fri, 4 Oct 2019 07:26:38 +0000 (09:26 +0200)]
fix #1380: pvecm status: add general cluster information

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-7
Thomas Lamprecht [Mon, 2 Sep 2019 09:08:06 +0000 (11:08 +0200)]
bump version to 6.0-7

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: dcdb: fix returned pointer value:
Wolfgang Bumiller [Mon, 2 Sep 2019 08:47:32 +0000 (10:47 +0200)]
pmxcfs: dcdb: fix returned pointer value:

Commit 926f961f62f5 used a new temporary pointer variable
for type correctness, but the return value was still using
the previous variable which had not been moved forward
anymore.

Fixes: 926f961f62f5 ("pmxcfs dcdb: fix pointer void* aritmethic")
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump version to 6.0-6
Thomas Lamprecht [Fri, 30 Aug 2019 12:46:49 +0000 (14:46 +0200)]
bump version to 6.0-6

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs server: fix off-by-one error when ensuring string NUL termination
Thomas Lamprecht [Thu, 29 Aug 2019 14:59:55 +0000 (16:59 +0200)]
pmxcfs server: fix off-by-one error when ensuring string NUL termination

done once, then copied over by copy-is-my-hobby, once by me too :)

While this is in the relative big SHM we get from the libqb backed
IPC mechanisms, and thus there's a really really low chance to hit a
corruption of another following data element here, it's still a
possibility.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: cleanup remaining_size calculation
Wolfgang Bumiller [Fri, 30 Aug 2019 08:09:46 +0000 (10:09 +0200)]
pmxcfs: cleanup remaining_size calculation

using an end-pointer it's a bit more readable and gets rid
of an (int) cast

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agopmxcfs: get config properties: ensure we do not read after the config
Thomas Lamprecht [Thu, 29 Aug 2019 12:45:08 +0000 (14:45 +0200)]
pmxcfs: get config properties: ensure we do not read after the config

pmxcfs files need to be treated as blobs, while we can have some
assumptions on certain files, like the $vmid.conf ones, we should
still cope with problematic files.
Especially, the files may not end with \0, so always ensure that we
read at most file-size bytes.

Replace strtok_r, which assumes that the data is NUL terminated, and
use memchr, with logic ensuring that we never read over the size
returned by memdb_read.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agopmxcfs: fixup dcdb pointer void* aritmethic fix
Thomas Lamprecht [Fri, 30 Aug 2019 05:45:28 +0000 (07:45 +0200)]
pmxcfs: fixup dcdb pointer void* aritmethic fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
(cherry picked from commit be072d67c81373a59913a5df729788eaea53619e)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocheck_memdb: free data to allow building with memory leak sanitizer
Thomas Lamprecht [Thu, 29 Aug 2019 17:45:18 +0000 (19:45 +0200)]
check_memdb: free data to allow building with memory leak sanitizer

while this "memory leak" was irrelevant (short running anyway, so the
OS could clean up after us just fine) let's free the malloced stuff
nonetheless - this allows to build with -fsanitize=address and
-fsanitize=undefined

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocfs-utils cluster_config_version: actually enforce config_length when matching
Thomas Lamprecht [Thu, 29 Aug 2019 17:40:45 +0000 (19:40 +0200)]
cfs-utils cluster_config_version: actually enforce config_length when matching

Fix out-of-bound read found with AddressSanitizer

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs database: tree struct member name is array, and cannot be false
Thomas Lamprecht [Thu, 29 Aug 2019 15:11:26 +0000 (17:11 +0200)]
pmxcfs database: tree struct member name is array, and cannot be false

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs build: enable -Wpedantic
Thomas Lamprecht [Thu, 29 Aug 2019 14:57:30 +0000 (16:57 +0200)]
pmxcfs build: enable -Wpedantic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs server: fix pointer void* aritmethic
Thomas Lamprecht [Thu, 29 Aug 2019 14:50:32 +0000 (16:50 +0200)]
pmxcfs server: fix pointer void* aritmethic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: server: move request id and size in own variable
Thomas Lamprecht [Thu, 29 Aug 2019 14:36:07 +0000 (16:36 +0200)]
pmxcfs: server: move request id and size in own variable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: fix more void pointer arithmetic
Thomas Lamprecht [Thu, 29 Aug 2019 14:27:39 +0000 (16:27 +0200)]
pmxcfs: fix more void pointer arithmetic

To be able to finally enable -Wpedantic during compile in a future
patch. This ensures that the arithmetic actually happens on byte
granularity, while void* is undefined.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs status: fix pointer void* aritmethic
Thomas Lamprecht [Thu, 29 Aug 2019 14:21:59 +0000 (16:21 +0200)]
pmxcfs status: fix pointer void* aritmethic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs dcdb: fix pointer void* aritmethic
Thomas Lamprecht [Thu, 29 Aug 2019 14:20:25 +0000 (16:20 +0200)]
pmxcfs dcdb: fix pointer void* aritmethic

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs build: do not pass CFLAGS to linker stage
Thomas Lamprecht [Thu, 29 Aug 2019 14:56:50 +0000 (16:56 +0200)]
pmxcfs build: do not pass CFLAGS to linker stage

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agobump version to 6.0-5
Fabian Grünbichler [Wed, 7 Aug 2019 08:49:36 +0000 (10:49 +0200)]
bump version to 6.0-5

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agofollowup: code cleanup
Thomas Lamprecht [Wed, 17 Jul 2019 10:48:45 +0000 (12:48 +0200)]
followup: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoAPI: correctly propagate $@ with nested locks
Fabian Grünbichler [Tue, 16 Jul 2019 13:43:18 +0000 (15:43 +0200)]
API: correctly propagate $@ with nested locks

PVE::Cluster::cfs_lock_file sets $@ and returns undef for all errors,
including when $code dies. PVE::Tools::lock_file runs $code inside an
eval as well, so just setting $@ is not enough when nesting these two
types of locks.

re-die with the inner error to actually propagate error messages and
fail instead of proceeding. this triggered (probably among other cases)
when attempting to join an existing cluster without specifying all
needed links.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agomake: fix upload target
Fabian Grünbichler [Wed, 3 Jul 2019 06:44:30 +0000 (08:44 +0200)]
make: fix upload target

to correctly reference dbgsym package

4 years agobump version to 6.0-6
Fabian Grünbichler [Tue, 2 Jul 2019 08:37:39 +0000 (10:37 +0200)]
bump version to 6.0-6

4 years agocorosync: refactor and reuse IP RE matching
Fabian Grünbichler [Tue, 2 Jul 2019 08:19:52 +0000 (10:19 +0200)]
corosync: refactor and reuse IP RE matching

this avoids calling getaddrinfo for the usual case of plain IPs, and
makes the code a bit easier to read as well.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agocorosync: stylistic changes
Fabian Grünbichler [Tue, 2 Jul 2019 08:05:57 +0000 (10:05 +0200)]
corosync: stylistic changes

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoAdd functions to resolve hostnames and iterate corosync nodes
Stefan Reiter [Mon, 1 Jul 2019 15:22:14 +0000 (17:22 +0200)]
Add functions to resolve hostnames and iterate corosync nodes

The sub 'for_all_corosync_addresses' iterates through all nodes in a
passed corosync config and calls a specified function for every ringX_addr
on every node it finds (provided the IP-version matches the specified
one or undef was specified).

All ringX_addr entries that cannot be parsed as an IP address will be
best-effort resolved as hostnames. This has to happen in the exact same
way as corosync does internally, to ensure consistency with firewall
rules.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
4 years agoadd qdevice status api call
Oguz Bektas [Mon, 1 Jul 2019 16:31:01 +0000 (18:31 +0200)]
add qdevice status api call

Signed-off-by: Oguz Bektas <o.bektas@proxmox.com>
4 years agobump version to 6.0-3
Thomas Lamprecht [Thu, 27 Jun 2019 09:17:20 +0000 (11:17 +0200)]
bump version to 6.0-3

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoRevert "pvecm: remove mtunnel"
Thomas Lamprecht [Thu, 27 Jun 2019 09:15:56 +0000 (11:15 +0200)]
Revert "pvecm: remove mtunnel"

This reverts commit 7a415f9657e68114c29b0bd1cad52283c203950a.
For now we have to many bad users of that, they all never should have
used this in the first place, but it slipped in so here we are..

4 years agobump version to 6.0-2
Thomas Lamprecht [Tue, 25 Jun 2019 10:30:27 +0000 (12:30 +0200)]
bump version to 6.0-2

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agoapi: join info: we still get ring0_addr in nodelist
Thomas Lamprecht [Tue, 25 Jun 2019 10:28:49 +0000 (12:28 +0200)]
api: join info: we still get ring0_addr in nodelist

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: workaround dumb g_string_free behaviour
Thomas Lamprecht [Mon, 24 Jun 2019 10:44:51 +0000 (12:44 +0200)]
pmxcfs: workaround dumb g_string_free behaviour

While GLib mentions that this method is nullable[0][1] (i.e., can be passed
and can return null) its use of the, a bit misleading,
g_return_val_if_fail[2] voids that, as passing NULL emits an
warning[2] which looks pretty grave (assertion failure), albeit is
just noise..

[0]: https://developer.gnome.org/glib/stable/glib-Strings.html#g-string-free
[1]: https://salsa.debian.org/gnome-team/glib/blob/debian/2.58.3-2/glib/gstring.c#L196
[2]: https://developer.gnome.org/glib/stable/glib-Warnings-and-Assertions.html#g-return-val-if-fail

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agopmxcfs: get guest cfg properties: use g_string_sized_new
Thomas Lamprecht [Mon, 24 Jun 2019 10:42:20 +0000 (12:42 +0200)]
pmxcfs: get guest cfg properties: use g_string_sized_new

While with NULL as first argument g_string_new_len effectively
becomes a g_string_sized_new it can be confusing as the docs do not
mention that. Also this may lead to an error if one changes the call
with out to much research, so fix it to the one function we should
used to begin with here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>