]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
mgr/cephadm: fix rgw spec migration with simple specs 55963/head
authorAdam King <adking@redhat.com>
Mon, 3 Jul 2023 18:33:34 +0000 (14:33 -0400)
committerAdam King <adking@redhat.com>
Sun, 10 Mar 2024 19:32:45 +0000 (15:32 -0400)
commit182e4dfa19ea438758b9977cc52da02d12bfb11c
treeb47c0d5b179d5b38fdaa9cd8e71a1af777f37053
parent145c8b2f3fc4c7d0d36dadbf1c414f3f90d190e2
mgr/cephadm: fix rgw spec migration with simple specs

The rgw spec migration code, intended to formalize
the rgw_frontend_type spec option, doesn't work with
simple specs i.e.

service_type: rgw
service_id: rgw.1
service_name: rgw.rgw.1
placement:
  label: rgw

because the migration code assumes there will always be
a "spec" section inside the spec. This is the case for
more involved rgw specs such as

service_type: rgw
service_id: foo
placement:
  label: rgw
  count_per_host: 2
spec:
  rgw_realm: myrealm
  rgw_zone: myzone
  rgw_frontend_type: "beast"
  rgw_frontend_port: 5000

which is what the migration is actually concerned about
(verification of the rgw_frontend_type in these specs).

In the case where the spec is more simple, we should
just leave the spec alone and move on. Unfortunately
the current code assumes the field will always be
there and hits an unhandled KeyError when trying to
migrate the more simple specs. This causes the
cephadm module to crash shortly after starting an
upgrade to a version that includes this migration
and it's very difficult to find the root cause. This
can be worked around by adding fields to the rgw
spec before upgrade so the "spec" field exists in
the spec and the migration works as intended.

This commit fixes the migration in the simple
case as well as adding testing for that case to
both the unit tests and orch/cephadm teuthology
upgrade tests

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

Conflicts:
qa/suites/orch/cephadm/upgrade/3-upgrade/simple.yaml
src/pybind/mgr/cephadm/migrations.py
src/pybind/mgr/cephadm/tests/test_migration.py