]> git.apps.os.sepia.ceph.com Git - ceph.git/log
ceph.git
22 months agodoc/man: radosgw-admin.rst typo 53315/head
Zac Dover [Wed, 6 Sep 2023 14:23:06 +0000 (00:23 +1000)]
doc/man: radosgw-admin.rst typo

Edit the text in the "bucket radoslist" entry.

Signed-off-by: Zac Dover <zac.dover@proton.me>
(cherry picked from commit fb808732e8c8f9b64a443aa3ea30a677b1347be3)

22 months agoMerge pull request #53312 from zdover23/wip-doc-2023-09-07-backport-53302-to-reef
Anthony D'Atri [Wed, 6 Sep 2023 15:15:16 +0000 (11:15 -0400)]
Merge pull request #53312 from zdover23/wip-doc-2023-09-07-backport-53302-to-reef

reef: doc/man: remove docs about support for unix domain sockets

22 months agodoc/man: remove docs about support for unix domain sockets 53312/head
Zac Dover [Wed, 6 Sep 2023 06:33:43 +0000 (16:33 +1000)]
doc/man: remove docs about support for unix domain sockets

doc/man: support for unix domain sockets is not implemented, hence we
removed documentation about it.

(Note: the changes in this commit were the work of Rok Jaklič in
https://github.com/ceph/ceph/pull/48537. This pull request has been
raised because that pull request was for some mysterious reason causing
merge conflicts that were never resolved.)

Co-authored-by: Rok Jaklič rjaklic@gmail.com
Signed-off-by: Zac Dover <zac.dover@proton.me>
(cherry picked from commit fa40b7ef560fc60a107dad1604650e0bcf27e77e)

22 months agoMerge pull request #53254 from rhcs-dashboard/wip-62657-reef
Nizamudeen A [Wed, 6 Sep 2023 05:20:18 +0000 (10:50 +0530)]
Merge pull request #53254 from rhcs-dashboard/wip-62657-reef

reef: mgr/dashboard: fix image columns naming

Reviewed-by: Nizamudeen A <nia@redhat.com>
22 months agoMerge pull request #53220 from rhcs-dashboard/wip-62642-reef
Nizamudeen A [Tue, 5 Sep 2023 06:36:39 +0000 (12:06 +0530)]
Merge pull request #53220 from rhcs-dashboard/wip-62642-reef

reef: mgr/dashboard: cleanup rbd-mirror process in dashboard e2e

Reviewed-by: Ilya Dryomov <idryomov@redhat.com>
22 months agoMerge pull request #53267 from zdover23/wip-doc-2023-09-04-backport-53264-to-reef
Anthony D'Atri [Sun, 3 Sep 2023 22:13:04 +0000 (18:13 -0400)]
Merge pull request #53267 from zdover23/wip-doc-2023-09-04-backport-53264-to-reef

reef: doc/man/8: improve radosgw-admin.rst

22 months agodoc/man/8: improve radosgw-admin.rst 53267/head
Anthony D'Atri [Sun, 3 Sep 2023 13:56:44 +0000 (09:56 -0400)]
doc/man/8: improve radosgw-admin.rst

Signed-off-by: Anthony D'Atri <anthonyeleven@users.noreply.github.com>
(cherry picked from commit d986537f9b06e7e848b9624718a2eda21bb54f70)

22 months agoMerge pull request #53261 from zdover23/wip-doc-2023-09-03-backport-50360-to-reef
Anthony D'Atri [Sun, 3 Sep 2023 12:17:18 +0000 (08:17 -0400)]
Merge pull request #53261 from zdover23/wip-doc-2023-09-03-backport-50360-to-reef

reef: doc/radosgw: multisite - edit "migrating a single-site"

22 months agodoc/radosgw: multisite - edit "migrating a single-site" 53261/head
tgfree [Fri, 3 Mar 2023 03:17:59 +0000 (11:17 +0800)]
doc/radosgw: multisite - edit "migrating a single-site"
Add the import step of the section "Migrating a Single-Site Deployment to Multi-Site"
in doc/radosgw/multisite.rst. The field "name" and "api_name" should be matched.

Signed-off-by: Qi Tao <tgfree7@gmail.com>
(cherry picked from commit 579c14055d202429ad25a469c30a3d68e0329391)

22 months agoMerge pull request #53260 from zdover23/wip-doc-2023-09-02-backport-48180-to-reef
zdover23 [Sun, 3 Sep 2023 05:33:10 +0000 (15:33 +1000)]
Merge pull request #53260 from zdover23/wip-doc-2023-09-02-backport-48180-to-reef

reef: doc: make instructions to get an updated cephadm common

Reviewed-by: Anthony D'Atri <anthony.datri@gmail.com>
Reviewed-by: John Mulligan <jmulligan@redhat.com>
22 months agoMerge pull request #53258 from zdover23/wip-doc-2023-09-02-backport-53247-to-reef
Anthony D'Atri [Fri, 1 Sep 2023 23:10:09 +0000 (19:10 -0400)]
Merge pull request #53258 from zdover23/wip-doc-2023-09-02-backport-53247-to-reef

reef: doc/README.md - improve "Running a test cluster"

22 months agodoc: make instructions to get an updated cephadm common 53260/head
John Mulligan [Wed, 24 May 2023 17:42:26 +0000 (13:42 -0400)]
doc: make instructions to get an updated cephadm common

As discussed in person and over the ceph orch weekly, we want all users
to use a recent supported version of cephadm. Previously, the
instructions only had those downloading cephadm with curl using the
"add-repo" and "install" commands to get a up-to-date cephadm build.
According to ADK we've seen cases of users get "old" distro packages
in the past. Change the instructions so that the "update cephadm" steps
are common after acquiring a "bootstrap copy" of cephadm.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit d7921e88d69b4bc355da9c0327cc33e59e7d7abb)
(cherry picked from commit d11cf0e82aab8d4cef9d423e5d463a373eaf383a)
(cherry picked from commit 9ad38033cc5c7f177cb8fe3bae696682687e0346)

doc: update the cephadm download instructions

Starting with reef, cephadm is a compiled (zipapp) python application.
The cephadm script has been renamed and thus the old curl-based
download instructions will no loner work. While cephadm still has
no dependencies outside the Python stdlib, this will be changed in
future versions so it is no longer appropriate to just download the
source file of cephadm and run it either.

This change updates the `Install cephadm` section of the doc to explain
how to acquire a "compiled" version of cephadm as well as:
* moving and tweaking the note that the two installation methods are
  distinct
* adding a new note linking to instructions on building cephadm
* moving the distribution-specific installations before the curl-based
  installation to subtly hint that we prefer you to get it using
  packages if you can
* Noting cephadm's minimal required python verision and how to run it
  with a particular python version.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit d11cf0e82aab8d4cef9d423e5d463a373eaf383a)

doc: add instructions for compiling cephadm

Now that cephadm is based on zipapp, add a short section to the
developer docs explaining how to build cephadm yourself.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 9ad38033cc5c7f177cb8fe3bae696682687e0346)

22 months agodoc/README.md - improve "Running a test cluster" 53258/head
Zac Dover [Fri, 1 Sep 2023 00:19:58 +0000 (10:19 +1000)]
doc/README.md - improve "Running a test cluster"

Improve the English in the section "Running a test cluster in the
ceph/README.md file.

Signed-off-by: Zac Dover <zac.dover@proton.me>
(cherry picked from commit 420ecc7addaad1969cb634289c2399ea38ea9a90)

22 months agoMerge pull request #53256 from zdover23/wip-doc-2023-09-02-backport-53249-to-reef
Anthony D'Atri [Fri, 1 Sep 2023 18:31:44 +0000 (14:31 -0400)]
Merge pull request #53256 from zdover23/wip-doc-2023-09-02-backport-53249-to-reef

reef: doc/start: correct ABC test chart

22 months agodoc/start: correct ABC test chart 53256/head
Dmitry Kvashnin [Fri, 1 Sep 2023 10:53:18 +0000 (10:53 +0000)]
doc/start: correct ABC test chart

Signed-off-by: Dmitry Kvashnin <dm.kvashnin@gmail.com>
(cherry picked from commit fdbd567d913bdacbbd36d2c3b9180af8a1750228)

22 months agomgr/dashboard: fix image columns naming 53254/head
Pedro Gonzalez Gomez [Wed, 23 Aug 2023 16:34:55 +0000 (18:34 +0200)]
mgr/dashboard: fix image columns naming

Fixes: https://tracker.ceph.com/issues/62551
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
(cherry picked from commit 338bb5c8a46e2a84fd139c392302e7ff846d3ef8)

22 months agoMerge pull request #53124 from adk3798/reef-batch-pre-refactor
Adam King [Thu, 31 Aug 2023 19:38:36 +0000 (15:38 -0400)]
Merge pull request #53124 from adk3798/reef-batch-pre-refactor

reef: cephadm batch backport Aug 23

Reviewed-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: filter hosts that can't support VIP for ingress 53124/head
Adam King [Tue, 1 Aug 2023 21:43:36 +0000 (17:43 -0400)]
mgr/cephadm: filter hosts that can't support VIP for ingress

Keepalive daemons need the host to have an interface
on which they can set up their VIP. If a host
does not have any interface that can work, we should
filter it out

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 17bc76f5bb6b3ef8c962ce31a80c5a3a43b5bdd2)

22 months agomgr/cephadm: select IPs/interface based on VIP for keepalive conf
Adam King [Tue, 1 Aug 2023 20:32:06 +0000 (16:32 -0400)]
mgr/cephadm: select IPs/interface based on VIP for keepalive conf

We need to make sure the keepalive conf sets
the unicast src and peer IPs to be the ones
in the same subnet as the VIP we're setting up,
as well as specify the correct interface. Otherwise,
the keepalive daemons don't speak to each other
properly and all end up going into MASTER state.

Fixes: https://tracker.ceph.com/issues/62276
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 58ddc4e20f7cead1f2594241450f4beb5230c746)

Conflicts:
src/pybind/mgr/cephadm/tests/test_services.py

22 months agoCephadm: Add first_virtual_router_id to generated yaml on test
Luis Domingues [Tue, 20 Jun 2023 10:20:39 +0000 (12:20 +0200)]
Cephadm: Add first_virtual_router_id to generated yaml on test

It seems that the ServiceSpec, when dump to yaml will generate
a yaml with first_virtual_router_id, as its default value is 50.

Signed-off-by: Luis Domingues <domingues.luis@protonmail.ch>
(cherry picked from commit 0901f98a05e5d55b8b3cc17a0cae38094ae88a6f)
(cherry picked from commit 929cf28a1edb47db9e9e18e0212a919072c33c7b)

22 months agocephadm: Add parameter to set keepalived's virtual router id
Luis Domingues [Tue, 20 Jun 2023 07:07:57 +0000 (09:07 +0200)]
cephadm: Add parameter to set keepalived's virtual router id

When deploying more than 1 ingress, two instances of keepalived
can be generated with the same virtual_router_id. This commit
adds posibility to change the virtual_router_id of keepalived
from the spec file.

Signed-off-by: Luis Domingues <domingues.luis@protonmail.ch>
(cherry picked from commit bb69368fb5cd1def58cbe638dbd4d3bcf63e431f)
(cherry picked from commit 12cb31447e9a4efe02b32b03271d288a2ebcb0ab)

22 months agocephadm: Split multicast interface and unicast_ip in keepalived.conf
Luis Domingues [Tue, 13 Jun 2023 07:59:35 +0000 (09:59 +0200)]
cephadm: Split multicast interface and unicast_ip in keepalived.conf

When deploying keepalived, cephadm set interface and unicast_src_ip
in keepalived.conf. However, having both options are set, but
if unicast_src_ip is not in the interface set by 'interface',
the instrances of keepalived will not properly commuicate.

This commit makes both options exclusive, and add an option to set
either one or the other. Default is set to 'interface', as it seems
multicast is the default way to deploy keepalived.

Signed-off-by: Luis Domingues <domingues.luis@protonmail.ch>
(cherry picked from commit 0dfe3e68a9284736f643a06acfda719cec0a6ea4)
(cherry picked from commit 837c273da2aa3dd3b3fe09b9ac04fd032149de6d)

22 months agocephadm: fixups for unit tests
Adam King [Wed, 23 Aug 2023 21:24:13 +0000 (17:24 -0400)]
cephadm: fixups for unit tests

These fixes really should be part of the commits
that brought in/changed the tests, but it's
difficult to find the exact commits as part of
this batch backport so I'm doing these minor fixups
in their own commit

Signed-off-by: Adam King <adking@redhat.com>
22 months agopybind/mgr/cephadm: extend haproxy protocol test case
John Mulligan [Wed, 12 Jul 2023 14:18:49 +0000 (10:18 -0400)]
pybind/mgr/cephadm: extend haproxy protocol test case

Extend that haproxy protocol test case so that for host1 we exercise the
new logic for gathering known-good IPs for the host and add those to
the ganesha config.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 1e960026d01a94d97ab960c820227fd5fa4157fa)

22 months agopybind/mgr/cephadm: add all known good IPs for hosts to haproxy list
John Mulligan [Tue, 11 Jul 2023 21:07:25 +0000 (17:07 -0400)]
pybind/mgr/cephadm: add all known good IPs for hosts to haproxy list

Fixes: https://tracker.ceph.com/issues/61852
It was discovered that when the primary IP address of hosts managed by
cephadm are not all on the same subnet, then there's a chance that
ganesha will reject haproxy protocol connections.

Expand the list to all valid addresses for the hosts under management
such that we will not reject proxy protocol messages from the hosts
under cephadm management. This method was chosen over more sophisticated
possible approaches because we do not want to complicate the workflow
for the people setting up haxproxy+ganesha and do not want to miss any
possible subtle edge cases by trying to come up with the "perfect" list
of addresses.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit aab6a04df274e74d873827724247a1145797441b)

22 months agopybind/mgr/cephadm: move haproxy client addrs to func
John Mulligan [Tue, 11 Jul 2023 20:29:44 +0000 (16:29 -0400)]
pybind/mgr/cephadm: move haproxy client addrs to func

Move the list comprehension that gets the list of IP addresses for the
haproxy_hosts list to a separate function. This is in preparation for
making the logic more complex in a later commit.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit b1d2bb6ec53c2aa3574db2f5d3dc3878d2969a58)

22 months agocephadm: have attempt_bind raise up OSErrors
Adam King [Fri, 18 Aug 2023 16:32:38 +0000 (12:32 -0400)]
cephadm: have attempt_bind raise up OSErrors

Before it was always converting the OSError to
our self-defined "Error" class. This causes an issue
with the port_in_use function that has special handling
for OSError when the errno is EADDRNOTAVAIL or
EAFNOSUPPORT. Since the error being raised was no
longer an OSError it wasn't being caught and checked
properly in port_in_use.

This has the additional property of being necessary
to check port availability for haproxy on its VIP. If
we fail deployment when EADDRNOTAVAIL is raised, it becomes
difficult to deploy the ingress service. If we deploy
haproxy first it fails because the VIP isn't available
yet (since keepalive isn't up) and it fails saying the port
it wants to bind to is unavailable (specifically EADDRNOTAVAIL).
If we try to deploy keepalive first it fails because it
needs to know the location of the haproxy daemons in
order to build its config file. This has worked in the past
by just having the haproxy fail to bind at first and then
fix itself once the keepalive daemon is deployed. That
no longer works if the haproxy daemon fails to deploy
because cephadm is reporting the port it needs is
unavailable. Since EADDRNOTAVAIL when deploying
haproxy likely means the VIP is not up rather than
something else is taking up the port it needs, fixing
the handling of this allows ingress deployment to
work while also allowing multiple haproxy daemons
on the same host to use the same frontend port
bound to different VIPs.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit b2f133fd994cc63f1fa55320aac987e760e43160)

22 months agomgr/cephadm: only check haproxy frontend_port conflicts on VIP
Adam King [Fri, 11 Aug 2023 18:00:31 +0000 (14:00 -0400)]
mgr/cephadm: only check haproxy frontend_port conflicts on VIP

If we know what IP the frontend_port will be binding
to, we can pass that down through the port_ips mapping
so cephadm will only check if that port on that specific
VIP if in use. This allows multiple haproxy daemons
to be bound to the same port on different VIPs on the
same host.

Note that you still must use a different monitor port
for the two different ingress services as that port
is bound to on the actual IP of the host. Only the
frontend port can be the same for haproxies on the
same host as long as the VIP is different.

Fixes: https://tracker.ceph.com/issues/57614
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 640af155986ac85d12367f43ac45b682a9fa9415)

Conflicts:
src/pybind/mgr/cephadm/tests/test_services.py

22 months agocephadm: support for specifying IP a port will be bound to on
Adam King [Fri, 11 Aug 2023 17:35:10 +0000 (13:35 -0400)]
cephadm: support for specifying IP a port will be bound to on

This is mostly for checking for port conflicts.
Currently, we just check if the port is bound to
on any IP on the host. This mechanism should allow
certain daemon types to specify a port -> IP mapping
that will be passed to the cephadm binary. That
mapping will then be used by cephadm to only
check for the port being bound to on that specific
IP rather than any IP on the host. The end result
is we could have daemons bound to the same
port on different IPs on the same node.

It's expected that daemon types will set this
up as part of their prepare_create or generate_config
functions where they may have more info about the
specific IPs and ports they need.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 178cbdab33f0eed2d0916524162b2533653865fd)

Conflicts:
src/cephadm/cephadm.py

22 months agodoc/cephadm: document haproxy protocol options
John Mulligan [Tue, 21 Mar 2023 20:47:35 +0000 (16:47 -0400)]
doc/cephadm: document haproxy protocol options

There are now two ways to run NFS with ingress using haxproxy. This
makes three distinct modes for ingress. Document these.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 92ce0ae60039be899ae04e14504badd9b0e8939e)

Conflicts:
doc/mgr/nfs.rst

22 months agoqa/cephadm: teuthology test for nfs ingress-mode=haproxy-protocol
John Mulligan [Tue, 21 Mar 2023 20:20:42 +0000 (16:20 -0400)]
qa/cephadm: teuthology test for nfs ingress-mode=haproxy-protocol

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit a1f6314fd831eb934e19dce95d532e6744ffef39)

22 months agomgr/cephadm: add test explicitly validating proxy protocol
John Mulligan [Tue, 21 Mar 2023 19:40:17 +0000 (15:40 -0400)]
mgr/cephadm: add test explicitly validating proxy protocol

Adds a test case that specifically ensures that the proper values
appear in the configuration files for both nfs and haproxy when
the proxy protocol is enabled.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 509cab9833fddcc5bf9ba54f84901f4ab2ddbebb)

22 months agomgr/cephadm: parametrize test for haproxy protocol support
John Mulligan [Tue, 21 Mar 2023 17:51:48 +0000 (13:51 -0400)]
mgr/cephadm: parametrize test for haproxy protocol support

Make a few small tweaks to an existing test to validate that it
functions similarly when the haxproxy protocol is disabled or enabled.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 23bcc7573a0cc6f01942a40dcf84a916545272d5)

22 months agomgr/cephadm: minor reorganizing of nfs service test
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: minor reorganizing of nfs service test

This change makes some formatting and organizational changes to one of
the nfs + ingress test cases. This is in preparation for a future change
that will parametrize this function allowing it to test haproxy config
when proxy protocol is enabled and when not.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 5ad7f2d0d57adb0a7f94403090ecb82c748c16c1)

22 months agomgr/nfs: add support for selecting between haproxy ingress modes
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/nfs: add support for selecting between haproxy ingress modes

When the haproxy-standard mode is selected, the haproxy ingress will
behave as in previous versions of ceph. When the haproxy-protocol mode
is selected, we need to enable protocol support on the ingress service
and nfs service.

While were at it, make a few organization tweaks to improve readability.

Fixes: https://tracker.ceph.com/issues/58933
Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 322c109f6bd6fa9c4449b4f938d907e1bc75629d)

22 months agomgr/cephadm: add two new ingress types for haproxy
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: add two new ingress types for haproxy

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 61f25e39a2146ebceef100abdf697d712defa5a4)

22 months agomgr/cephadm: add haproxy hosts to nfs ganesha configuration
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: add haproxy hosts to nfs ganesha configuration

When haproxy protocol support is enabled a list of IP Addresses where
valid haproxy instances can be needs to be supplied to the ganesha server.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 2f5023aa726de7e28daffcee66ecaa99251d4047)

22 months agomgr/cephadm: set haxproxy protocol in config when enabled
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: set haxproxy protocol in config when enabled

When the haproxy protocol is enabled at the service level, add the
'send-proxy-v2' option to the haproxy configuration file.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit c56953f2570337e48c812a137338a96f989b6cfb)

22 months agomgr/cephadm: add enable_haproxy_protocol to ingress and nfs service specs
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: add enable_haproxy_protocol to ingress and nfs service specs

Add a new boolean field, enable_haproxy_protocol, to both the ingress
service spec and the nfs service spec. The ingress service spec needs
the field to tell haproxy to enable proxy protocol (v2) support.
The nfs service spec needs the field to allow the nfs server to accept
proxy protocol messages.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 5691def1f8634e4e0a55b313febea1fd0d8cb41a)

Conflicts:
src/python-common/ceph/deployment/service_spec.py

22 months agomgr/cephadm: add optional HAProxy_Hosts field to ganesha conf template
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: add optional HAProxy_Hosts field to ganesha conf template

When NFS-Ganesha is used behind a HAProxy with proxy protocol support
enabled ganesha requires that HAProxy_Hosts is set to a list of hosts
that are permitted to use the proxy protocol. This change adds support
for specifying HAProxy_Hosts in the ganesha configuration file template.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 7c7b7b672118c9ec3803f46998a3174cccb6dfb6)

22 months agomgr/cephadm: add support for default server options to template
John Mulligan [Tue, 21 Mar 2023 15:42:25 +0000 (11:42 -0400)]
mgr/cephadm: add support for default server options to template

Add support for default server-options within the haproxy backend
section. This change will later be used to enable haproxy proxy protocol
(v2)  support.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 9613181e286f2e11574d8240d531c592a2196881)

22 months agomgr/cephadm: bump nvmeof image version to 0.0.2
Adam King [Tue, 8 Aug 2023 14:51:57 +0000 (10:51 -0400)]
mgr/cephadm: bump nvmeof image version to 0.0.2

0.0.2 includes a patch that allows the nvmeof
daemon to use non-admin keyrings, so we should
use it over 0.0.1

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 3f0bece48d84732617ebf0c402da3edd01960f49)

22 months agomgr/cephadm: rename "igw_id" to "nvmeof_gw_id"
Adam King [Wed, 2 Aug 2023 19:53:10 +0000 (15:53 -0400)]
mgr/cephadm: rename "igw_id" to "nvmeof_gw_id"

"igw_id" was leftover from the nvmeof implementation
being taken heavily from the iscsi implementation. "igw"
means nothing in this context, so we can change the name.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit eac3ba46b89c09a795c12d6dc45a00cde710a41b)

22 months agomgr/cephadm: configure nvmeof with ip of target host
Adam King [Fri, 28 Jul 2023 21:27:55 +0000 (17:27 -0400)]
mgr/cephadm: configure nvmeof with ip of target host

This is the IP the nvmeof daemon will bind
to, so it should be the IP of the host we're
deploying the nvmeof daemon on, not the IP
of the active mgr

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 25a9f5ab0bb8d3e050c8714ec3539feb3b2febf5)

22 months agomgr/cephadm: make nvme-of auth keyring more restricted
Adam King [Fri, 28 Jul 2023 20:59:42 +0000 (16:59 -0400)]
mgr/cephadm: make nvme-of auth keyring more restricted

Rather than giving full admin privileges,
try to be a bit more strict by limiting it
to profile rbd mon caps and full OSD
privileges for rbd tagged pools. I also wanted
to include an OSD cap like

allow all pool="*" object_prefix "nvmeof.state"

but this caused a failure in the nvme-of daemon

RADOS permission error (Failed to operate write op for oid nvmeof.None.state)

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 6aa14a228d47cfccbc2c11a9abdd3e513570af25)

22 months agoqa/cephadm: add basic nvmeof deployment test
Adam King [Fri, 28 Jul 2023 18:01:11 +0000 (14:01 -0400)]
qa/cephadm: add basic nvmeof deployment test

Similar to what is done for iscsi, basic deployment
test to make sure we can deploy the daemon and
it comes up in running state with no issue

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit f97f242eee758d98d1749e8796db5b0b0392b6ad)

22 months agomgr/cephadm: still remove daemons in error state if ok-to-stop fails
Adam King [Fri, 28 Jul 2023 17:24:06 +0000 (13:24 -0400)]
mgr/cephadm: still remove daemons in error state if ok-to-stop fails

The ok-to-stop function works for certain daemons
by checking if there are at least a certain number
(typically 1) daemon(s) that are actually running
and saying it's not ok-to-stop if if that won't
be true after the removals. This case breaks down
when all the daemons are in error state, making
it so cephadm will refuse to remove a set of
daemons that aren't even working because they're
not "ok to stop". Since ok-to-stop works in a
yes or no fashion, something like this where we
want to be willing to remove a certain subset
(or potentially all currently deployed) daemons
it's easier to keep this logic as part of applying
the service

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 8bf99ba7b0862d7340690c74b6aa3ad995ae1098)

22 months agocephadm: mount keyring deployed for nvmeof daemon
Adam King [Thu, 27 Jul 2023 19:47:51 +0000 (15:47 -0400)]
cephadm: mount keyring deployed for nvmeof daemon

Before, we were just using the client.admin keyring
as a temporary workaround while we figured out
how to get the keyring to work. We should swap
over to using the keyring we actually generated
for the nvmeof daemon.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit bad1259e3830adadac6f04591976899da5cbbb80)

22 months agomgr/cephadm: add rados_id to nvmeof conf
Adam King [Thu, 27 Jul 2023 19:44:47 +0000 (15:44 -0400)]
mgr/cephadm: add rados_id to nvmeof conf

This is going to be used as the rados_id
to be set when connecting to the cluster using
the keyring we generate for the nvmeof daemon.

The python librados library defaults the name
to "client.admin" and so if we don't provide
a name or rados_id, we'll only be able to
use nvmeof with the "client.admin" keyring

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 3e8ad229f79a16bddd85a77bf5273f3751e33f56)

22 months agoAdding support for extra args by using the field tgt_cmd_extra_args
Redouane Kachach [Tue, 11 Jul 2023 08:19:11 +0000 (10:19 +0200)]
Adding support for extra args by using the field tgt_cmd_extra_args

Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit 050c0f9b1445deacec3825406fe2e70a20d0c1fc)

22 months agoAddressing reviewers comments
Redouane Kachach [Tue, 11 Jul 2023 08:01:39 +0000 (10:01 +0200)]
Addressing reviewers comments

Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit 5a043fe6d25fd986a5ccb55b4920922c1fcd0f22)

22 months agoAdding more ports needed by nvmeof daemon
Redouane Kachach [Tue, 11 Jul 2023 07:09:50 +0000 (09:09 +0200)]
Adding more ports needed by nvmeof daemon

Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit 1dcbf61e13e2eafca88a86ea8adb1210c8f73c94)

22 months agomgr/cephadm: Adding suppport for nvmeof
Redouane Kachach [Tue, 7 Mar 2023 13:45:35 +0000 (14:45 +0100)]
mgr/cephadm: Adding suppport for nvmeof
Fixes: https://tracker.ceph.com/issues/61929
Signed-off-by: Redouane Kachach <rkachach@redhat.com>
(cherry picked from commit ea6eb5e3eec1b5be6a1d7d85f7affcad87123604)

22 months agodocs/cephadm: document new extra_{container,entrypoint}_args behavior
John Mulligan [Mon, 26 Jun 2023 16:08:34 +0000 (12:08 -0400)]
docs/cephadm: document new extra_{container,entrypoint}_args behavior

Document the new behaviors of extra_container_args and
extra_entrypoint_args. Document that current (previous in code terms)
behavior of splitting strings on spaces and document the recently added
support for ArgumentSpec objects and how they are used.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 344c89a2c646729e941fcdbbd562432d863e8220)

22 months agomgr/cephadm: rework how _process_ls_output builds a DaemonDescription
John Mulligan [Mon, 29 May 2023 20:52:31 +0000 (16:52 -0400)]
mgr/cephadm: rework how _process_ls_output builds a DaemonDescription

Previously, the _process_ls_output function would create an
DaemonDescription and then assign values to attributes one-by-one.  This
prevents the class from doing any data type/value conversions unless we
resort to more complex approaches like descriptors or `__setattr__` for
example. Update the _process_ls_output function to build a
DaemonDescription using keyword args so that we have the opportunity
later to convert data passed to it in `__init__`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 1fd4132c7c03602719f29230732b12c8afa04779)

22 months agomgr/cephadm: update package to use ArgumentSpec based types
John Mulligan [Thu, 25 May 2023 23:30:11 +0000 (19:30 -0400)]
mgr/cephadm: update package to use ArgumentSpec based types

Update the cephadm mgr module to match the changes to use
ArgumentSpec based types for extra_container_args and extra_entrypoint
args.

Update orchestrator/_interface.py to match the changes to use
ArgumentSpec based types for extra_container_args and extra_entrypoint args.

The job of splitting up arguments is no longer done here but
lies in a method of the ArgumentSpec type.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit de16e6cb7d4bb0c4473977d56162f0d591811604)

22 months agopython-common: extend arguments test to assert splitting behavior
John Mulligan [Thu, 25 May 2023 21:46:58 +0000 (17:46 -0400)]
python-common: extend arguments test to assert splitting behavior

Use the existing arguments test to verify that the ArgumentSpec
objects split the arguments as intended.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 62b4c6cbbbd2df01af92c696a93e2d3eb833b0e2)

22 months agopython-common: extend args handling test for new ArgumentSpec type
John Mulligan [Wed, 17 May 2023 20:57:24 +0000 (16:57 -0400)]
python-common: extend args handling test for new ArgumentSpec type

Add cases to test_extra_args_handling test to verify new behaviors
brought in by the switch to ArgumentSpec and ArgumentList types.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 9eafce2c499f6d5b0e31297a3e85b5ff42ff9cc2)

22 months agopython-common: replace types for extra_*_args with ArgSpec based types
John Mulligan [Wed, 17 May 2023 17:50:19 +0000 (13:50 -0400)]
python-common: replace types for extra_*_args with ArgSpec based types

Use the ArgSpec, ArgumentList, and GeneralArgList types throughout
the deployment module to support extra_container_args and
extra_entrypoint_args. The GeneralArgList type supports all possible
input forms while ArgumentList reflects the internal representation
of the argument lists.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 925e09a46437bf9a8de0d7b853cdc3126ffe4260)

Conflicts:
src/python-common/ceph/deployment/service_spec.py

22 months agopython-common: add an ArgumentSpec type for handling args
John Mulligan [Wed, 17 May 2023 17:49:23 +0000 (13:49 -0400)]
python-common: add an ArgumentSpec type for handling args

Add a new ArgumentSpec type to the deployment package. The
ArgumentSpec serves a dual purpose:
* to allow more advanced configuration of extra arguments
* to keep backwards compatibility with string-based args

The previous versions of cephadm supported supplying extra container and
entrypoint arguments for fine-tuning of services and creating custom
containers. However, this mode assumed that spaces in an argument
always meant that the argument should be split into two parts:
"--foo bar" becomes `["--foo", "bar"]`. In some cases there's a good
reason to keep spaces as in "--title=My Little Cluster". When
an argument is expressed as a single string the ArgumentSpec is
designed to retain the existing behavior. When an argument is
expressed as a JSON object then you can explicitly express if
you want the argument split on spaces or not (not split is the default).

The alternative was to keep using strings but add some level of
shell-style quoting. This was discussed but deemed complex and
difficult to read in YAML. Round tripping that data is also challenging.
The JSON object approach also allows for future fields to be added
providing for possible extensibility.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 1bae8b0c0c39246bfc92e8f366ddb9e345cee343)

22 months agomgr/orchestrator: reformat ceph.deployment.service_spec import line
John Mulligan [Thu, 25 May 2023 23:17:02 +0000 (19:17 -0400)]
mgr/orchestrator: reformat ceph.deployment.service_spec import line

Quoting https://peps.python.org/pep-0008/#maximum-line-length
```
The preferred way of wrapping long lines is by using Python’s
implied line continuation inside parentheses, brackets and braces. Long
lines can be broken over multiple lines by wrapping expressions in
parentheses. These should be used in preference to using a backslash for
line continuation.
```

I also think it is much more readable and is similar to the style
applied by automated code formatting tools like `black`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 5cc6f0a147247799478556e01b397f3ee6599f2e)

22 months agomgr/cephadm: reformat ceph.deployment.service_spec import line
John Mulligan [Thu, 25 May 2023 22:54:05 +0000 (18:54 -0400)]
mgr/cephadm: reformat ceph.deployment.service_spec import line

Quoting https://peps.python.org/pep-0008/#maximum-line-length
```
The preferred way of wrapping long lines is by using Python’s
implied line continuation inside parentheses, brackets and braces. Long
lines can be broken over multiple lines by wrapping expressions in
parentheses. These should be used in preference to using a backslash for
line continuation.
```

I also think it is much more readable and is similar to the style
applied by automated code formatting tools like `black`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 3d7b9342383ab5d4a2c7a346d6982aea09ebc6f8)

22 months agopython-common: reformat ceph.deployment.service_spec import line
John Mulligan [Fri, 26 May 2023 15:40:51 +0000 (11:40 -0400)]
python-common: reformat ceph.deployment.service_spec import line

Quoting https://peps.python.org/pep-0008/#maximum-line-length
```
The preferred way of wrapping long lines is by using Python’s
implied line continuation inside parentheses, brackets and braces. Long
lines can be broken over multiple lines by wrapping expressions in
parentheses. These should be used in preference to using a backslash for
line continuation.
```

I also think it is much more readable and is similar to the style
applied by automated code formatting tools like `black`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit d895398bcbc0f96c0139ca74600d2c8f3175a33b)

22 months agopython-common: add tests for service spec extra args handling
John Mulligan [Wed, 17 May 2023 18:30:18 +0000 (14:30 -0400)]
python-common: add tests for service spec extra args handling

There were no existing tests for how the service spec(s) handled the
extra_container_args and extra_entrypoint_args values.  Add a short
parametrized test function to assert some basic properties of how the
arguments are currently handled. In particular, it asserts that the
values can appear at the top-level of the YAML and under spec.

This is in preparation for adding a more sophisticated argument
type in the future.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 4561fc37084faa766bd199f052bd2b2a1589269e)

22 months agoqa/workunits/cephadm: update script use use cephadm _orch deploy
John Mulligan [Tue, 20 Jun 2023 20:58:07 +0000 (16:58 -0400)]
qa/workunits/cephadm: update script use use cephadm _orch deploy

cephadm _orch deploy will eventually be the only deploy method so
we need to update the test script.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: dont set ctx.image if json deploy image is unset
John Mulligan [Mon, 19 Jun 2023 16:54:24 +0000 (12:54 -0400)]
cephadm: dont set ctx.image if json deploy image is unset

If no image has been provided in the "deploy from" json do not set
ctx.image to it (empty-string or None) as we may have had a valid
value passed on the --image CLI option.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: remove call to get_parm from fetch_configs
John Mulligan [Thu, 15 Jun 2023 19:54:09 +0000 (15:54 -0400)]
cephadm: remove call to get_parm from fetch_configs

Stop using get_parm in fetch_configs. Doing so makes clear that
the two if-branches in fetch_configs are symmetric, in the
handling of custom_config_files and symmetric with the behavior
of fetch_custom_config_files.
It also reveals that get_parm only has one remaining caller making it
simpler to remove get_parm in the future.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: convert test case to call command_deploy_from
John Mulligan [Sat, 20 May 2023 17:45:10 +0000 (13:45 -0400)]
cephadm: convert test case to call command_deploy_from

The test was previously using command_deploy but that is being
deprecated so call command_deploy_from instead.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: combine deploy functions some more
John Mulligan [Tue, 30 May 2023 20:23:13 +0000 (16:23 -0400)]
cephadm: combine deploy functions some more

During review it was pointed out that much of command_deploy and
command_deploy_from were still common. Combine the bulk of
command_deploy and command_deploy_from into a new _common_deploy.
The old _common_deploy is renamed to _dispatch_deploy but kept
as a separate function.

The reason for keeping _dispatch_deploy as a function is that
it limits the scope of variables. It helps knowing exactly what
is needed and what is not needed from _common_deploy.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: drop deploy_arguments key from deploy config JSON
John Mulligan [Thu, 1 Jun 2023 17:27:37 +0000 (13:27 -0400)]
cephadm: drop deploy_arguments key from deploy config JSON

Drop the now unnecessary deploy_arguments subsection from the JSON
object that the new `_orch deploy` takes. The intermediate code that
used it in the ceph mgr module has been replaced with `params`.

We still want to share some code with the old deploy, especially the
default values for various things that get attached to `ctx`. In
some cases this is particularly important as not all code checks
that `ctx` has an attribute first. Create an `ArgumentFacade` type
to reuse the `add_argument` calls for deploy, and instead store the
default key-value pairs for `ctx`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add a test for the apply_deploy_config_to_ctx function
John Mulligan [Thu, 1 Jun 2023 17:27:27 +0000 (13:27 -0400)]
cephadm: add a test for the apply_deploy_config_to_ctx function

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: split command_deploy_from into mockable parts
John Mulligan [Sat, 20 May 2023 17:42:02 +0000 (13:42 -0400)]
cephadm: split command_deploy_from into mockable parts

Split up command_deploy_from so that the part that reads the JSON
from an input source is moved into read_configuration_source and
the part that applied the configuration data to the ctx is moved
into apply_deploy_config_to_ctx. This will make these sections
reusable and, more importantly, make it easier to mock/monkeypatch
these functions in tests.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: make the old command_deploy deprecated with decorator
John Mulligan [Thu, 18 May 2023 20:14:24 +0000 (16:14 -0400)]
cephadm: make the old command_deploy deprecated with decorator

Add a deprecated command decorator. Decorate the old command_deploy with
it. By default it just logs if a deprecated command was used, but
custom builds of cephadm can set the NO_DEPRECATED var to True
and fail if a deprecated command is used.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: add exchange types and use them for deploy
John Mulligan [Thu, 18 May 2023 19:10:16 +0000 (15:10 -0400)]
mgr/cephadm: add exchange types and use them for deploy

Add an exchange module for defining the "exchange protocol" that the
mgr module uses for communicating with the cephadm binary.  The
exchange module classes use data descriptors to define supported
fields in the resulting data and will be serialized to JSON for
communicating with cephadm.

The cephadm binary does not use these types because it currently
doesn't import anything outside of the standard library. A suggested
future change would be to move 'exhange.py' to python-common somewhere
and have the module be imported by both the mgr and cephadm and used
for both serialization and deserialization.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: convert test_services.py for new deploy
John Mulligan [Tue, 16 May 2023 23:44:51 +0000 (19:44 -0400)]
mgr/cephadm: convert test_services.py for new deploy

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: convert test_cephadm.py for new deploy
John Mulligan [Tue, 16 May 2023 23:44:34 +0000 (19:44 -0400)]
mgr/cephadm: convert test_cephadm.py for new deploy

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: block future use of extra_args
John Mulligan [Tue, 16 May 2023 17:49:28 +0000 (13:49 -0400)]
mgr/cephadm: block future use of extra_args

Convert `extra_args` into a read-only property so that
current code continues to work but anything that tries
to set any `extra_args` now or in the future will be
intentionally broken.

This is mainly to find issues when running unit and teuthology tests.
This patch could be dropped before the final merge if desired.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: convert extra_args to daemon_params dict
John Mulligan [Tue, 16 May 2023 17:48:58 +0000 (13:48 -0400)]
mgr/cephadm: convert extra_args to daemon_params dict

In serve.py we were creating various command line arguments
(and their values) to pass to cephadm. Now that we support
a single unified JSON-based input we can stop passing
these as CLI parameters and just pass it as a singular
JSONified dict.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: deploy using deploy-from command
John Mulligan [Thu, 11 May 2023 15:07:53 +0000 (11:07 -0400)]
mgr/cephadm: deploy using deploy-from command

The new `deploy-from` command aims to be a cleaner, clearer way to pass
input to cephadm for service deployment. Make a minimal set of change to
use that new command.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agomgr/cephadm: allow passing a list as a compound command to _run_cephadm
John Mulligan [Wed, 24 May 2023 18:11:52 +0000 (14:11 -0400)]
mgr/cephadm: allow passing a list as a compound command to _run_cephadm

As we're adding "namespaces" to the cephadm command it's easier to work
with a compound list of terms as the command. This also avoids an issue
where the function call injects args between the command and the "args"
passed to _run_cephadm.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: update code to use fetch_custom_config_files
John Mulligan [Thu, 15 Jun 2023 19:34:15 +0000 (15:34 -0400)]
cephadm: update code to use fetch_custom_config_files

Update the code to use fetch_custom_config_files rather than
get_custom_config_files.  Like other fetch_ functions recently added
to cephadm we don't LBYL for checking values on ctx, but rather
call the fetch function on ctx and then check if the result contains
actionable data.
get_custom_config_files gets removed as no remaining callers exist.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add fetch_custom_config_files function
John Mulligan [Thu, 15 Jun 2023 19:34:09 +0000 (15:34 -0400)]
cephadm: add fetch_custom_config_files function

This function works similarly to get_custom_config_files but doesn't
require the use of "ctx.config_json" and will prefer sourcing the
data from `config_blobs`.
This function also returns the list of dicts rather than return a dict
with exactly one key which maps to said list of dicts. There appeared
to be no benefit to that when the call sites of get_custom_config_files
was examined.

This function is `fetch_configs` evil twin.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: update code to use the fetch_tcp_ports function
John Mulligan [Fri, 26 May 2023 19:13:03 +0000 (15:13 -0400)]
cephadm: update code to use the fetch_tcp_ports function

Replace a bunch of locations that were "parsing" the tcp ports to use
the recently added fetch_tcp_ports function.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add fetch_tcp_ports function for getting processed ports
John Mulligan [Fri, 26 May 2023 19:06:40 +0000 (15:06 -0400)]
cephadm: add fetch_tcp_ports function for getting processed ports

The cephadm cli can pass ports as either a string containing space
separated port numbers or, in the newer method, a (JSON) list of ints.
The fetch_tcp_ports function abstracts away the handling of
these input forms.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add deploy-from command
John Mulligan [Thu, 11 May 2023 15:05:07 +0000 (11:05 -0400)]
cephadm: add deploy-from command

Add the `deploy-from` command. This command is like `deploy` in
functionality but instead of sourcing input from a mixture of various
CLI arguments, CLI arguments that take JSON strings, and JSON data
provided on stdin - this command aims to take configuration from a
single unified JSON object provided on the commands stdin.

This change strives to be as reasonably backwards compatible with
`deploy` as possible and this leads to some awkward hoop-jumping,
including: needing to nest CLI arguments inside the JSON, because
that is what the manager constructs; duplicate sources of the fsid
(CLI and JSON); the strange behavior of CephadmContext when setting
values; and a few others I'm probably forgetting.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: move the definition of most deploy args into a function
John Mulligan [Thu, 11 May 2023 14:55:14 +0000 (10:55 -0400)]
cephadm: move the definition of most deploy args into a function

Moving the bulk of the arguments specific to the `deploy` command will
allow future reuse of these arguments.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: be more explicit with a Dict's type specification
John Mulligan [Thu, 11 May 2023 14:36:50 +0000 (10:36 -0400)]
cephadm: be more explicit with a Dict's type specification

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: update code to use fetch_configs function
John Mulligan [Thu, 11 May 2023 14:36:13 +0000 (10:36 -0400)]
cephadm: update code to use fetch_configs function

Use the fetch_configs function wherever we were previously reading
configs via `get_parm(ctx.config_json)`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add fetch_configs function for reading configuration items from ctx
John Mulligan [Thu, 11 May 2023 14:30:51 +0000 (10:30 -0400)]
cephadm: add fetch_configs function for reading configuration items from ctx

The CephadmContext holds much of cephadm's state, including values
from cli options and (soon) configuration file input. Add a
`fetch_configs` function that reads processed configuration items from `config_blobs`
(a dict mapping config name to arbitrary configuration content) or
falls back to using the `get_parm` function on `ctx.config_json`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: update code to use fetch_meta function
John Mulligan [Sat, 20 May 2023 14:55:16 +0000 (10:55 -0400)]
cephadm: update code to use fetch_meta function

Use the fetch_meta function wherever we require the metadata
properties dict.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: add fetch_meta function for reading metadata properties from ctx
John Mulligan [Thu, 11 May 2023 14:30:12 +0000 (10:30 -0400)]
cephadm: add fetch_meta function for reading metadata properties from ctx

The CephadmContext holds much of cephadm's state, including values from
cli options and (soon) configuration file input. Add a `fetch_meta`
function that reads processed metadata from `meta_properties` or parses
JSON stored on `meta_json`. Parsed JSON is saved to `meta_properties`.
Future code should always use fetch_meta for reading, and only ever
set `meta_properties` as a python dict, not round trip JSON through
meta_json.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: split default_image decorator into two functions
John Mulligan [Thu, 11 May 2023 14:25:38 +0000 (10:25 -0400)]
cephadm: split default_image decorator into two functions

Keep default_image as a decorator for functions that will only
ever need to update an image passed by the CLI. For other future
functions that want to execute code prior to assigning an image
from CLI parameters add `update_default_image` which takes a
CephadmContext and updates it and can be used by the caller
at an arbitrary point in the code flow.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: change tests to assert using mock call not func.args
John Mulligan [Thu, 1 Jun 2023 15:16:13 +0000 (11:16 -0400)]
cephadm: change tests to assert using mock call not func.args

The Python docs [1] note that:
  Changed in version 3.8: Added args and kwargs properties.

In order to run tests on python 3.6 (example: `tox -e py36`) we
change the tests to do the asserts using the older call(...)
comparison style, with mock.ANY used for args we don't care about.

[1] - https://docs.python.org/3/library/unittest.mock.html#unittest.mock.Mock.call_args

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: remove unused import from tests
John Mulligan [Thu, 1 Jun 2023 15:15:48 +0000 (11:15 -0400)]
cephadm: remove unused import from tests

This import breaks running tox with `-e py36` and adds no value. Just
remove it.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
22 months agocephadm: use enum for tracking redeploy/reconfig
Adam King [Wed, 31 May 2023 23:38:38 +0000 (19:38 -0400)]
cephadm: use enum for tracking redeploy/reconfig

Since the options are mutually exclusive, using
an enum is preferable to having multiple bools
to track each of them

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 7081759d48f4e9f21a6482c2f32446d9b1f895ea)

22 months agocephadm: open ports in firewall when adopting monitoring stack daemons
Adam King [Thu, 13 Apr 2023 17:54:00 +0000 (13:54 -0400)]
cephadm: open ports in firewall when adopting monitoring stack daemons

Otherwise we risk the prometheus/alertmanager/grafana
not functioning properly after adoption due to the necessary
port in the firewall not being open.

Fixes: https://tracker.ceph.com/issues/59443
Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit 40a98174ccab080fd540e05b6adadcf82e9c2a78)

22 months agocephadm: still try to open ports in firewall on redeploy/reconfig
Adam King [Thu, 13 Apr 2023 17:05:11 +0000 (13:05 -0400)]
cephadm: still try to open ports in firewall on redeploy/reconfig

Prior to this patch we were discarding the provided
ports on reconfig and redeploy in order to not fail
thinking there was a port conflict with the instance
of the daemon we were about to reconfig/redeploy. However,
it's still desirable for us to make sure the firewall ports
are open when we do a reconfig/redpeloy, so this refactors
the port handling approach to have it do that but
still avoid checking for port conflicts. It also include
an update of the type signature of deploy_daemon
to the py3 style. That wasn't needed for the change
but since I was added an arugment there I thought we might
as well do it now.

Signed-off-by: Adam King <adking@redhat.com>
(cherry picked from commit fdecd66f1306d3bf60780dbd44c9cb8e63b3892a)

22 months agocephadm: use DEFAULT_MODE constant at additional locations
John Mulligan [Tue, 6 Jun 2023 17:26:35 +0000 (13:26 -0400)]
cephadm: use DEFAULT_MODE constant at additional locations

Now that we have a DEFAULT_MODE constant we can replace other locations
where 0o600 is used with the constant.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit ca9b5d0bd6082112bcd2297a58113c9bb32dc954)

22 months agocephadm: use 0o600 as the default mode for write_new
John Mulligan [Tue, 6 Jun 2023 17:24:37 +0000 (13:24 -0400)]
cephadm: use 0o600 as the default mode for write_new

Add a constant DEFAULT_MODE of `0o600`, and make it the default of
the perms argument to write_new. This reduces a lot of code since
0o600 is the majority of the permissions used. Other cases can continue
to pass None to indicate no particular permissions are desired.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit b76132035be9383dafba382d0291da4068bfa94e)

22 months agocephadm: convert SNMPGateway create_daemon_conf to use write_new
John Mulligan [Tue, 6 Jun 2023 17:16:29 +0000 (13:16 -0400)]
cephadm: convert SNMPGateway create_daemon_conf to use write_new

While it is not entirely clear why this pattern of using os.open and
posix open flags instead of `open` directly was used I determined (using
strace) that the only major difference between these open flags and
those used by `open` was the lack of O_TRUNC. Unlike some other cases
this function does not use an intermediate temporary file.  This means
that if the file being written already exists and the data being written
is smaller then the remaining data will not be over-written.

Example:
```
$ cat existing
AAAAAAAA
$ cat existing
bbbAAAAA
```

I looked over the context that this function is used in and decided that
this behavior must not be intentional. Thus it should be safe
to convert this function to `write_new`.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit 6ec5a5ead36a79ce331b6943296c401feea7a896)