John Mulligan [Thu, 30 Jan 2025 00:14:30 +0000 (19:14 -0500)]
cephadm: use parsed_container_mem_usage in cephadm.py
Replace the use of _parse_mem_usage and related command calls with
parsed_container_mem_usage.
This needs a lot of tests to be updated so that the call functions that
now originate in `container_engines.py` get mocked. funkypatch handles
most of the extra work for us - but it needs to be added to many tests.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
John Mulligan [Thu, 30 Jan 2025 00:12:41 +0000 (19:12 -0500)]
cephadm: add parsed_container_mem_usage to container_engines
Add a new function that combines the call and parse operations that
exist in cephadm.py (currently _parse_mem_usage and related command
calls). This will be used in a future commit to replace that code and
reduce the size of cephadm.py.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
John Mulligan [Thu, 30 Jan 2025 00:10:47 +0000 (19:10 -0500)]
cephadm: add support for not mocking certain call methods
Add support for not mocking certain call methods that are usually mocked
out when with_cephadm_ctx is called. These mocks are fairly limited and
do not coordinate well when other mocks (esp. funkypatch) is being used
in a test. Allow the caller to set `mock_cephadm_call_fn=False` and skip
setting these mocks.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
John Mulligan [Thu, 30 Jan 2025 00:04:29 +0000 (19:04 -0500)]
cephadm: rework with_cephadm_ctx fixture to use exitstack
Rework the `with_cephadm_ctx` function in fixtures.py to make use of
contextlib.ExitStack. The use of ExitStack, to quote the python docs,
"is designed to make it easy to programmatically combine other context
managers." This function makes use of many mock.patch context managers
and does already try to programmatically combine them - and the current
method is awkward.
A future change will do even more to control what gets mocked out and
so a this clean up makes things easier to read now and easier to update
later.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
John Mulligan [Mon, 27 Jan 2025 19:33:28 +0000 (14:33 -0500)]
cephadm: move get_legacy_daemon_fsid to data_utils
This function has few dependencies and is essentially a wrapper over
get_legacy_config_fsid a function that is already in data_utils.
Continue reducing the size of cephadm by moving this function out
of cephadm.py.
Signed-off-by: John Mulligan <jmulligan@redhat.com>
Zac Dover [Wed, 29 Jan 2025 14:05:59 +0000 (00:05 +1000)]
doc/cephadm: simplify confusing math proposition
s/This means that the exact device size is 3.64 * 1000, or 3640GB"/This
means that the exact device size is 3.64TB, or 3640 GB"/
In the original text, the number "3.64" appears to refer to a quantity
(and indeed, it is a quantity of Terabytes), but it is unlabeled. Also,
on repeated recent readings of this sentence I found it more puzzling
than enlightening. So I made this commit.
Zac Dover [Fri, 24 Jan 2025 13:46:19 +0000 (23:46 +1000)]
doc/cephfs: edit disaster-recovery-experts (6 of x)
In doc/cephfs/disaster-recovery-experts.rst, incorporate Anthony's
suggestions in
https://github.com/ceph/ceph/pull/61462#discussion_r1923917812
and
https://github.com/ceph/ceph/pull/61462#discussion_r1923920724
and reword the sentences in the section "Using an alternate metadata
pool for recovery" to be in the imperative mood, which better suits the
ordered list format that was introduced in
https://github.com/ceph/ceph/pull/61493.
Follows https://github.com/ceph/ceph/pull/61493.
https://tracker.ceph.com/issues/69557
Co-authored-by: Anthony D'Atri <anthony.datri@gmail.com> Signed-off-by: Zac Dover <zac.dover@proton.me>
Ilya Dryomov [Sat, 25 Jan 2025 10:11:14 +0000 (11:11 +0100)]
doc/rados: pool and namespace are independent osdcap restrictions
For the "profile {name}" syntax, pool and namespace restrictions are
independent of each other (i.e. specifying namespace doesn't also
require specifying pool like is currently suggested). A cap can look
like "profile rbd namespace=myns", signifying that the RBD profile is
to be allowed in myns namespace of any pool.
For the "allow {access-spec}" syntax, pool restriction is optional.
A cap can look like "allow r namespace=myns", "allow w object_prefix
myprefix" or "allow rw namespace=myns object_prefix myprefix", for
example.
John Mulligan [Tue, 21 Jan 2025 21:28:42 +0000 (16:28 -0500)]
container: add label ceph=True back
Add a label used by cephadm internally that was always set by
ceph-container [1] back to the new containerfile. This should
prevent issues with cephadm shell command thinking official ceph images
are not official ceph images.
Zac Dover [Thu, 23 Jan 2025 09:49:26 +0000 (19:49 +1000)]
doc/cephfs: edit disaster-recovery-experts (5 of x)
Put the procedure in the section called "Using an alternate metadata
pool for recovery" into an ordered list, so that it is in a proper
procedure format.
This commit is meant only to break the procedure into steps. The English
language in each of these steps could be improved, but that improvement
will be done after this formatting has been merged and backported.
Dan Mick [Thu, 23 Jan 2025 02:28:15 +0000 (18:28 -0800)]
container/build.sh: fix up org vs. repo naming
release builds were using the wrong container repo name because of
confused variable naming and inadequate separation. Keep the hostname,
org name, and repo name in separate variables, and assemble the full
path with a version when tagging is done.
Ilya Dryomov [Wed, 22 Jan 2025 19:34:11 +0000 (20:34 +0100)]
librbd: clear ctx before initiating close in Image::{aio_,}close()
Image::aio_close() must clear ctx before initiating close. Otherwise
the provided callback may see a non-NULL ctx and attempt to close the
image again from Image destructor, leading to an invalid memory access
as ImageCtx and ImageState are both freed immediately after the image
is closed (i.e. before AioCompletion is completed and the callback is
executed).
The same adjustment is made to Image::close() just for consistency.
Mohit Agrawal [Mon, 20 Jan 2025 06:03:31 +0000 (11:33 +0530)]
neorados_pool_test: Erase a pool name from local map during delete_pool
The test case itself call CoTearDown function by the end of every test case
and the function call delete_pool on the basis of pool name exists in
local set <created_pools> and if the pool does not exist during CoTearDown
it throws an exception so the test case expects the pool should be exists
before leaving the test case.
Solution: During delete_pool erase a pool name from a local map
and CoTearDown iterate over local copy instead of the
orignal copy.
Zac Dover [Tue, 21 Jan 2025 05:53:19 +0000 (15:53 +1000)]
doc/cephfs: edit disaster-recovery-experts (4 of x)
Edit the seventh and final section of
doc/cephfs/disaster-recovery-experts.rst in preparation for adding
deeper explanations of the contexts in which one should use the various
commands listed on that page.
The section edited in this commit is
* Using an alternate metadata pool for recovery
A future commit might beneficially put this section into the format of
an ordered list. If so, such a commit should only reformat the
content and should not make any changes to the English. It's enough to
verify content or format. Let's not overload our editorial faculties by
forcing ourselves to walk and chew gum at the same time.