Commit Graph

27 Commits

Author SHA1 Message Date
Fiona Ebner
8d524b3e0f use POSIX::_exit instead of exit in forked child
This avoids calling the END blocks and destructor routines most of
which have nothing to do with the fork, so it cannot be assumed to be
safe to do from the fork.

Move the call to pve_rados_shutdown from the destructor routine,
which will not be called by the child anymore. Make sure the cleanup
is also done when the worker dies.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-08-11 09:01:01 +02:00
Fiona Ebner
8cab00fca3 reset inherited signal handlers in child worker
For example, if pvestatd is the parent, the inherited signal handlers
from pvestatd, i.e. PVE/Daemon.pm's handlers would be invoked by the
child.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-08-11 09:01:00 +02:00
Fiona Ebner
30168568c5 refactor pverados worker into dedicated function
No functional change intended.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2023-08-11 09:00:58 +02:00
Thomas Lamprecht
80deebd9c5 create new mon_cmd method for new behavior with compat wrapper
Rename the $noerr param to $no_result_catch while changing the method
name, as it was a bit confusing because we only ever adhere to it for
the actual command result, not other die's.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 14:40:03 +01:00
Thomas Lamprecht
f9120f0235 avoid one-argument "bless"
can be pretty confusing because if we ever would add a subclass
basing on this module it would get the parent as class and thus the
method calls would not be overridable

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 14:17:56 +01:00
Thomas Lamprecht
9cbd85f940 update POD
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 14:17:19 +01:00
Thomas Lamprecht
79453d8e8a cleanup use statements and drop unused exporter
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-11-17 14:16:51 +01:00
Aaron Lauterer
a9607c2869 mon_command: optionally ignore errors
In some situations we do not want to abort if the Ceph API returns an
error. For example if we run the 'osd ok-to-stop' or similar calls, we
are interested in the status message in the error case.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-11-17 14:04:02 +01:00
Aaron Lauterer
f65e5245f7 mon_command: refactor to pass all data to perl
By passing back all return values from the Ceph API (RADOS.xs) to Perl
we are more flexible to make more than just the data available further
up the stack. These values are:

* return code
* status message (can contain useful information)
* data

The Ceph API interaction happens in a child process. We need to en- and
decode the returned hash in JSON to pass it between the child and parent
process.

RADOS.pm::mon_command now returns not just the data, but all information
as a hash ref.  Therefore dependent packages (pve-manager, pve-storage)
need to adapt.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2022-11-17 14:04:02 +01:00
Thomas Lamprecht
84e27dc27c mon_command: include prefix in error message
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-06-05 12:04:53 +02:00
Tim Marx
e57969deb0 fix #1950: use /etc/pve/ceph.conf as default
If there is no symlink between '/etc/ceph/ceph.conf -> /etc/pve/ceph.conf',
executing a RADOS command results in an exception.
For example on a cluster node where no monitor is configured and no
'pveceph init' was performed, this leads to unexpected conditions. On such a
node, if you check the monitor tab in GUI the monitors are correctly displayed,
but they seem to have no quorum, because actually the RADOS command didn't return.

Signed-off-by: Tim Marx <t.marx@proxmox.com>
2018-12-10 16:13:59 +01:00
Alwin Antreich
ac526fae88 Make error messages in Rados.pm prettier
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-06-20 10:04:14 +02:00
Alwin Antreich
c0a9abbddf allow to specify the userid with rados_create
This allows to connect to a cluster with a different user, besides admin

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-04-05 11:04:32 +02:00
Alwin Antreich
eb3519482f Split method pve_rados_connect
To be able to connect through librados2 without a config file, the
method pve_rados_connect is split up into pve_rados_connect and
pve_rados_conf_read_file.

Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-04-05 11:01:05 +02:00
Alwin Antreich
fb22f3c5c6 white space cleanup
Signed-off-by: Alwin Antreich <a.antreich@proxmox.com>
2018-04-05 10:57:27 +02:00
Dietmar Maurer
cc2b4dbc1e add method to get/set timeout 2014-01-22 07:58:34 +01:00
Dietmar Maurer
2eb2d02e01 allow clean shutdown with displaying 'partial read' error. 2014-01-21 12:28:05 +01:00
Dietmar Maurer
187aea7087 detect forked connections
Else more than one process can kill our worker!
2014-01-21 12:06:49 +01:00
Dietmar Maurer
10e8c7a140 cleanup 2014-01-21 11:00:27 +01:00
Dietmar Maurer
8172535ca4 implement timeout 2014-01-21 10:33:44 +01:00
Dietmar Maurer
e2171b3622 depend on libpve-access-control
We need to be able to close open server sockets.
2014-01-21 09:18:01 +01:00
Dietmar Maurer
9539bd3700 always for worker process
librados does not work well when we fork after rados_connect().
So we always fork a separate worker and use IPC to send/receive data.
2014-01-21 09:11:21 +01:00
Dietmar Maurer
f5996c6255 improve examples 2014-01-17 09:20:31 +01:00
Dietmar Maurer
23c2cb25b6 avoid unnecessary warning 2014-01-17 09:17:14 +01:00
Dietmar Maurer
b2a25d5d82 use json format by default 2014-01-16 13:24:28 +01:00
Dietmar Maurer
612779b19b allow to set client_mount_timeout 2014-01-16 12:45:12 +01:00
Dietmar Maurer
27bfc7c68e initial import 2014-01-16 11:24:54 +01:00