Skip to content

Pool Migration - #69112

Merged
jamiepryde merged 21 commits into
ceph:mainfrom
jamiepryde:pool-migration-2
Nov 11, 2026
Merged

jamiepryde merged 21 commits into
ceph:mainfrom
jamiepryde:pool-migration-2

Conversation

@jamiepryde

@jamiepryde jamiepryde commented May 26, 2026 •

Copy link
Copy Markdown
Contributor

Pool migration adds the ability to migrate all data from an existing RADOS pool into a new pool, non-disruptively as a background process. The cluster remains online and serving I/O throughout.

ceph osd pool migrate <pool> creates a new (target) pool that receives the original pool's name. The original pool is renamed to a hidden .migrate- source pool. Objects are copied PG by PG until all objects have been copied from the source pool to the target pool.

This allows pool properties that are normally fixed at pool-creation time to be changed by migrating into a new pool with the desired settings. E.g. switching from a replicated pool to an erasure coded pool, or changing the erasure code plugin or profile settings.

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@github-actions

github-actions Bot commented May 26, 2026 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: mon_pool_migration_max_pg_ratio (mon.yaml.in)
+ added: osd_pool_migration_retry_interval (osd.yaml.in)
+ added: osd_debug_inject_copyfrom_single_error (global.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@adam-lj
adam-lj force-pushed the pool-migration-2 branch from c4ad171 to 1108b49 Compare June 9, 2026 13:53
Copilot AI balanced review requested due to automatic review settings July 21, 2026 14:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds experimental, non-disruptive pool migration across monitors, OSDs, clients, Crimson interfaces, observability, documentation, and QA.

Changes:

  • Implements migration state, PG scheduling, reservation, copying, redirection, and statistics.
  • Adds migration-aware librados listing and ceph_test_rados stress support.
  • Adds commands, documentation, tests, and QA configurations.

Reviewed changes

Copilot reviewed 95 out of 96 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
doc/dev/osd_internals/ceph_test_rados.rst Documents migration stress options.
doc/dev/peering_graph.generated.svg Regenerates the peering diagram.
doc/man/8/ceph.rst Adds pool-create migration options.
doc/rados/operations/pools.rst Documents pool migration.
doc/scripts/gen_state_diagram.py Updates state-diagram generation.
qa/pool-migration/enabled.yaml Defines migration-enabled QA overrides.
qa/pool-migration/none-1.yaml Adds disabled migration QA variant.
qa/pool-migration/none-2.yaml Adds disabled migration QA variant.
qa/pool-migration/none-3.yaml Adds disabled migration QA variant.
qa/standalone/mon/osd-pool-create.sh Tests migration pool creation.
qa/suites/rados/basic/pool-migration$ Links migration QA coverage.
qa/suites/rados/singleton-bluestore/pool-migration$ Links migration QA coverage.
qa/suites/rados/singleton-nomsgr/pool-migration$ Links migration QA coverage.
qa/suites/rados/singleton/pool-migration$ Links migration QA coverage.
qa/suites/rados/thrash-erasure-code-big/pool-migration$ Links EC migration QA coverage.
qa/suites/rados/thrash-erasure-code-crush-4-nodes/pool-migration$ Links EC migration QA coverage.
qa/suites/rados/thrash-erasure-code-isa/pool-migration$ Links ISA migration QA coverage.
qa/suites/rados/thrash-erasure-code-overwrites/pool-migration$ Links EC-overwrite migration coverage.
qa/suites/rados/thrash-erasure-code-shec/pool-migration$ Links SHEC migration coverage.
qa/suites/rados/thrash-erasure-code/pool-migration$ Links EC migration coverage.
qa/suites/rados/thrash/pool-migration$ Links replicated migration coverage.
qa/suites/upgrade/squid-x/parallel/pool-migration$ Adds upgrade migration coverage.
qa/tasks/ceph_manager.py Adds migration progress handling.
qa/tasks/rados.py Passes migration stress options.
src/common/json/OSDStructures.cc Implements migration command JSON.
src/common/json/OSDStructures.h Defines migration command structures.
src/common/options/mon.yaml.in Adds monitor migration controls.
src/common/options/osd.yaml.in Adds OSD migration controls.
src/crimson/osd/ec_backend.cc Adapts Crimson EC migration paths.
src/crimson/osd/osd.cc Handles migration messages in Crimson.
src/crimson/osd/pg.cc Adds Crimson PG migration handling.
src/crimson/osd/pg.h Extends Crimson migration callbacks.
src/crimson/osd/pg_recovery.cc Integrates migration recovery states.
src/crimson/osd/pg_recovery.h Declares migration recovery support.
src/crimson/osd/shard_services.cc Routes migration messages.
src/crimson/osd/shard_services.h Declares migration message services.
src/include/ceph_features.h Adds Umbrella migration features.
src/include/rados.h Extends public operation flags.
src/messages/MOSDPGMigratedPool.h Adds PG-migrated notification.
src/messages/MOSDRepOp.h Extends replication messages.
src/messages/MPoolMigrationReserve.h Adds migration reservation messages.
src/mgr/DaemonServer.cc Exposes migration statistics.
src/mon/MonCommands.h Registers migration command parameters.
src/mon/Monitor.cc Handles migration-related monitor state.
src/mon/OSDMonitor.cc Implements migration orchestration.
src/mon/OSDMonitor.h Declares migration scheduling helpers.
src/mon/PGMap.cc Reports migration health and rates.
src/mon/PGMap.h Extends migration statistics state.
src/msg/Message.cc Registers migration message types.
src/msg/Message.h Adds migration message identifiers.
src/osd/ECBackend.cc Integrates EC migration operations.
src/osd/ECBackendL.cc Updates legacy EC backend migration handling.
src/osd/ECCommon.cc Adds EC migration bookkeeping.
src/osd/ECCommon.h Declares EC migration helpers.
src/osd/ECCommonL.cc Adds legacy EC migration bookkeeping.
src/osd/ECCommonL.h Declares legacy EC migration helpers.
src/osd/ECListener.h Extends EC listener interface.
src/osd/ECMsgTypes.cc Encodes migration EC metadata.
src/osd/ECMsgTypes.h Defines migration EC metadata.
src/osd/OSD.cc Routes migration events and messages.
src/osd/OSD.h Declares OSD migration handlers.
src/osd/OSDMap.cc Adds migration-aware map behavior.
src/osd/OSDMap.h Exposes migration map state.
src/osd/OpRequest.h Adds request feature inspection.
src/osd/PG.cc Integrates PG migration lifecycle.
src/osd/PG.h Declares PG migration operations.
src/osd/PGBackend.h Extends backend migration interfaces.
src/osd/PGPeeringEvent.h Adds migration peering events.
src/osd/PGTransaction.h Adds migration transaction metadata.
src/osd/PeeringState.cc Implements migration peering states.
src/osd/PeeringState.h Declares migration state machine.
src/osd/PrimaryLogPG.cc Implements object migration and routing.
src/osd/PrimaryLogPG.h Declares migration PG operations.
src/osd/ReplicatedBackend.cc Integrates replicated migration writes.
src/osd/ReplicatedBackend.h Extends replicated backend interfaces.
src/osd/object_state.h Tracks migration object state.
src/osd/osd_internal_types.h Adds internal migration types.
src/osd/osd_perf_counters.cc Registers migration counters.
src/osd/osd_perf_counters.h Declares migration counters.
src/osd/osd_types.cc Encodes migration pool state and statistics.
src/osd/osd_types.h Defines migration pool state and statistics.
src/osd/recovery_types.h Extends recovery reservation data.
src/osdc/Objecter.cc Adds migration routing and listing.
src/osdc/Objecter.h Adds migration-aware listing state.
src/osdc/SplitOp.cc Propagates migration operation flags.
src/test/librados/list.cc Tests migration-aware object listing.
src/test/mon/CMakeLists.txt Registers monitor migration tests.
src/test/mon/test_osd_monitor.cc Tests migration scheduling helpers.
src/test/osd/CMakeLists.txt Updates OSD test targets.
src/test/osd/MockPGBackendListener.h Updates backend migration mocks.
src/test/osd/MockPeeringListener.cc Updates peering mock callbacks.
src/test/osd/MockPeeringListener.h Adds migration mock state.
src/test/osd/RadosModel.h Adds migration stress orchestration.
src/test/osd/TestECBackend.cc Updates EC listener test stub.
src/test/osd/TestPeeringState.cc Tests migration peering behavior.
src/test/osd/TestRados.cc Adds migration stress CLI options.

Comment thread src/osd/osd_types.h Resolved
Comment thread src/osd/osd_types.h Resolved
Comment thread src/osdc/Objecter.cc Resolved
Comment thread src/osdc/Objecter.cc
Comment on lines +4341 to +4345
// Early exit only for non-migrating pools. During migration the full
// triple-read (TGT → SRC → TGT) must complete before any results are
// returned, otherwise the src and intermediate reads will re-emit every
// object that was already paged out, causing massive duplication.
if (list_context->current_stage == NListContext::TGT_READ &&
Comment thread src/test/osd/RadosModel.h Resolved
Comment thread qa/tasks/ceph_manager.py
Comment on lines +3003 to 3005
elif wait_for_migration and self.get_is_migration_paused():
self.log("migration paused (waiting or toofull) resetting timeout")
start = time.time()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we'll hit eventually hit the teuthology job timeout and fail with a generic error if we're stuck in migration_wait or migration_toofull. Not sure if we want the original deadline like co-pilot suggests for this case, or something slightly longer.

Comment thread src/mon/OSDMonitor.cc Resolved
Comment thread src/test/librados/list.cc Outdated
Comment on lines +581 to +585
// Start Migration
tgt_pool_name = get_temp_pool_name();
{
std::string c = "{\"prefix\": \"osd pool create\", \"pool\": \"" + tgt_pool_name +
"\", \"migrate_from_pool\": \"" + src_pool_name + "\"}";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've changed the CLI since this was reviewed, but the issue still exists. Both the pool migration tests in list.cc finish migration with 0 objects before writing any objects to the source and target pools, which means the tests are not doing what they claim to be doing. The test setups need to be rewritten.

Comment thread src/test/osd/TestRados.cc Resolved
Comment thread doc/man/8/ceph.rst Resolved
Copilot AI review requested due to automatic review settings July 22, 2026 10:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings July 22, 2026 17:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

Copilot AI review requested due to automatic review settings July 22, 2026 21:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 95 out of 96 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (10)

qa/tasks/rados.py:222

  • These arguments do not match TestRados.cc: the executable accepts --migration-enable-ec-optimizations and --migration-interval. Enabling either task option currently makes ceph_test_rados exit with “unknown arg”, so the migration task cannot use these settings.
    if config.get('migration-enable_ec_optmizations', False):
        args.extend(['--migration-enable-ec-optmizations'])
    migration_interval = config.get('migration_interval')
    if migration_interval is not None:
        args.extend(['--migration_interval', str(migration_interval)])

src/test/osd/TestRados.cc:501

  • The documented flag does not match the parser’s --migration-enable-ec-optimizations, so copying the usage text produces an unknown-argument failure.
    src/test/osd/RadosModel.h:262
  • Both values originate as int CLI arguments, but these uint8_t parameters silently wrap values above 255 (for example, a 300-second interval becomes 44 seconds). Keep the constructor types consistent with the stored int members and documented integer range.
    src/test/osd/RadosModel.h:381
  • The worker is stopped only after rados.shutdown() has already run, although it can still be inside or about to call rados.mon_command(). In addition, finished is a plain bool read and written by different threads, which is a data race. Signal the worker through synchronized state, wake it from its sleep, join it, and only then shut down the Rados client.
    src/osdc/Objecter.cc:4345
  • Suppressing the max_entries return path makes one rados_nobjects_list_next() refill scan both complete pools (and the target again) before returning. The C API requests only 1024 entries per refill, so a large migrating pool now accumulates every object in client memory and can make listing appear hung or exhaust memory. Preserve bounded pagination while carrying enough cross-stage state to deduplicate across calls.
    src/osdc/Objecter.cc:4391
  • At the end of the first target scan, tgt_pos is normally the max handle, so the second target stage starts at end-of-pool and reads nothing. Objects moved after the first target scan but before the source scan reaches them are therefore omitted. The final target pass must restart from the beginning (new objects may hash anywhere), with deduplication handling repeats.
    src/osd/osd_types.h:1682
  • pg_pool_t is default-constructed throughout the monitor, but this new scalar has no initializer. Encoding every Umbrella-format pool therefore reads an indeterminate value, and decoded maps can expose arbitrary migration progress. Initialize it explicitly.
    src/crimson/osd/pg.h:615
  • Pool creation currently inherits FLAG_CRIMSON from a Crimson source and does not reject migration, so the peering state can reach this callback and deliberately abort the OSD. Either implement the reservation path before advertising migration for Crimson pools or reject such migrations in the monitor command.
    qa/tasks/ceph_manager.py:3005
  • A paused/toofull migration is not progress, but this branch resets start on every poll. With the default wait_for_migration=True, a permanently full target makes wait_for_clean() wait forever instead of honoring its timeout. Keep logging the paused state without resetting the deadline.
                elif wait_for_migration and self.get_is_migration_paused():
                    self.log("migration paused (waiting or toofull) resetting timeout")
                    start = time.time()

doc/man/8/ceph.rst:1191

  • Both option spellings differ from the actual CLI: use --enable-ec-optimizations and --migrate-from-pool. As written, this man-page command fails argument parsing.
	{--enable-ec-optimisations} {--migrate_from_pool=<srcname>}

Comment thread src/osd/osd_types.h Resolved
Comment thread src/mon/PGMap.cc Resolved
Comment thread qa/standalone/mon/osd-pool-create.sh Resolved
Comment thread doc/rados/operations/pools.rst Resolved
Comment thread src/test/osd/RadosModel.h Resolved
Comment thread src/test/librados/list.cc Resolved
Comment thread src/test/librados/list.cc Resolved
Copilot AI review requested due to automatic review settings July 24, 2026 07:49
bill-scales and others added 7 commits November 9, 2026 18:38
Add the watermark and range-scan logic that decides which objects a
source PG migrates next:

- Add next_pool_migration() and earliest_pool_migration() to find the
  lowest-hash object still to migrate, and
  consider_updating_migration_watermark() to advance the watermark past
  objects that have been migrated or deleted.
- Rework scan_range_migration() and update_range(PoolMigrationInterval*)
  to scan from the watermark, and to leave alone log updates for objects
  below it.
- Split on_activate_complete() into _on_activate_committed(), which
  every shard runs, and the primary-only on_activate_complete(). Both
  now take an HBHandle, and on_activate_committed() is added.
  _on_activate_committed() scans the first migration range, merges
  missing objects into it, sets the watermark from earliest_pool_migration()
  and builds the target PG list (initialize_pool_migration_target_pg_list).
- In on_activate_complete(), queue DoPoolMigration when the PG needs
  migration and nothing else (recovery or backfill) is pending.
- Make recover_pool_migration() initialise the migration interval, and
  keep it up to date with update_range() before choosing the next object.
- Erase an object from pool_migrations_in_flight when it is recovered,
  and assert that none are left in _clear_recovery_state().
- Add the on_pool_migration_source_starting() override.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Implement the core object copy engine for pool migration in PrimaryLogPG:

- Implement migration_copy_from_check() and cancel_pool_migration_copy_ops()
  to transfer object data, attributes, and omap to the target pool.
- Handle copy-from completion, failure retries, and out-of-order copies.
- Support migrating whiteout head objects (adding whiteout flag to
  object_copy_data_t, creating whiteouts on target, updating whiteout stats,
  and passing pool_migration flag to _delete_oid).
- Add CEPH_OSD_COPY_FROM_FLAG_POOL_MIGRATION flag in rados.h.
- Update PGMap with pool migration throughput and object statistics rate summaries.
- Update SplitOp target calculation for objecter copy-from operations.
- Add osd_debug_inject_copyfrom_single_error config option for error injection.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Bill Scales <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Add snapshot context, clone, and watcher migration support to PrimaryLogPG:

- Preserve clone snapsets and snapshot metadata during migration, mirroring
  snapsets to the target pool.
- Source the pool snap context and pool-snaps mode from the migration-chain
  root pool (PGPool), so clone-on-write during migration uses the root's
  snapc, and honour MAP_SNAP_CLONE in execute_ctx to keep the source
  object's snapset.seq instead of fast-forwarding it to the pool seq.
- Refactor trim_object() into add_trim_to_ctx() to allow applying clone trims
  directly to an existing OpContext during migration copy and clone processing.
- Handle clone trimming, pruned clone cleanup, and snapset rebuilds during
  in-flight object copies.
- Add flags2 field to ceph_osd_op.copy_from and define
  CEPH_OSD_COPY_FROM_FLAG_POOL_MIGRATION_HAS_RES and
  CEPH_OSD_COPY_FROM_FLAG2_POOL_MIGRATION_HAS_CLONES in rados.h.
- Migrate registered object watchers to the target pool.
- Update scrubber to tolerate intermediate snapshot states and incomplete clones
  on migration target pools.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Extend the quiesce mechanism (which until now only handled copy
failures) so that in-flight migration copies are drained when the
migration is suspended or the PG re-peers, rather than being discarded.

- Add two quiesce reasons, SUSPEND_NEEDED and NEW_INTERVAL, and the
  pool_migration_quiesce_last_started_reset flag.
  on_pool_migration_source_suspended() sets SUSPEND_NEEDED if copies are
  still in flight, and finishes the suspension once they have drained.
- on_change(): instead of always clearing the quiesce state, set
  NEW_INTERVAL when copies from the previous interval are still in
  flight. An in-progress FATAL_ERROR, RETRY_NEEDED or SUSPEND_NEEDED
  quiesce is preserved.
- _clear_recovery_state(): keep the migrations that still have an
  outstanding copy so they can drain, drop deferred ones that have no
  outstanding op (a pending source delete, or a head waiting for its
  clones), and no longer assert that the in-flight set is empty.
- _on_activate_committed(): while a quiesce is active keep
  pool_migrations_in_flight and re-scan the interval; if everything has
  already drained during teardown, complete the quiesce there. Stop
  resetting the pool_migration_reservations_granted and
  pool_migration_waiting_for_reservations members.
- handle_pool_migration_quiesce_complete(): replace the if/else with a
  switch over all reasons. RETRY_NEEDED clears
  pool_migration_reservations_granted_source before requesting a new
  reservation. SUSPEND_NEEDED rewinds last_pool_migration_started to the
  watermark and completes the suspension. NEW_INTERVAL restarts migration
  with queue_recovery(). The FATAL_ERROR handling is unchanged apart from
  the re-indent.
- C_Migrate::finish() and the source delete completion: complete the
  quiesce when the last in-flight head is removed, and drop objects from
  pool_migrations_in_flight when a source delete finishes after a peering
  reset.
- handle_pool_migration_copy_failure() no longer returns a bool, because
  the caller never needed the result. It also takes a `stale` flag: a
  completion from a previous interval drains the migration accounting but
  must not drop the recovery read lock (which now belongs to recovery after
  the interval change), avoiding a leaked read lock on a clone.
- on_pool_migration_source_suspended(): flush ownerless parked deletes from
  pool_migrations_in_flight and rewind last_pool_migration_started to the
  watermark, so the SUSPEND quiesce can drain instead of hanging.
- recover_pool_migration(): log when quiescing.

Also remove the duplicate declarations of earliest_pool_migration(),
update_migration_watermark() and consider_updating_migration_watermark(),
and of on_pool_migration_source_starting() and
on_pool_migration_source_reserved(), left over from earlier commits, and
a stray blank line in do_op_impl().

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Implement client-side I/O redirection and transparent object listing in Objecter:

- Redirect client reads and writes between source and target pools based on the
  migration watermark and target pool configuration.
- Support cascaded/multi-hop migrations using migration_root.
- Transparently merge object listings and namespace enumerations across migrating
  pools.
- Redirect snapshot-metadata lookups (pool_snap_by_name, pool_snap_get_info
  and pool_snap_list in Objecter, and the equivalents in the neorados RADOS
  client) to the migration-chain root pool.
- Update Client and MDS utility helpers for migration pool lookups.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
…olicing, snap/delete routing, listing, status)

Implement the pool migration control plane and scheduling logic in OSDMonitor:

- Add 'ceph osd pool migrate' CLI command with full pool creation options
  and --enable_ec_optimizations.
- Add --show-all option to 'ceph osd pool ls' to list migration source pools.
- Implement migration scheduling and throttle concurrency via
  mon_pool_migration_max_pg_ratio.
- Add policing to prevent pool resize, split, or merge operations during migration.
- Add POOL MIGRATION cluster health warning in PGMap reporting migration progress.
- Process MOSDPGMigratedPool messages and track per-PG completion in PGMap.
- Correctly route snapshot creation, deletion, and pool removal across cascades.
- Filter out migration source pools in RadosClient::pool_list.
- Skip pools with FLAG_NOPGCHANGE in DaemonServer::adjust_pgs autoscaler check.
- Include <cls/sem_set/ops.h> in PGMap.cc.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Add test support for pool migration. The teuthology configuration is
disabled for now (see below), so only the standalone test and
ceph_test_rados change are exercised by default.

ceph_test_rados:
- Add --migrate-pool, --migration-enable-ec-optimizations,
  --initial-migration-delay, --migration-interval and
  --migration-pg-count (TestRados.cc, qa/tasks/rados.py). With
  --migrate-pool, RadosTestContext runs a thread that repeatedly issues
  "osd pool migrate" for the test pool (optionally alternating pg_num),
  waits for the migration to finish, then sleeps for the migration
  interval. Link ceph_test_rados with json_structures for the request
  encoding.
- Replace the std::cerr progress output in RadosModel.h with a LogHelper
  base class, so that output (including TestWatchContext) carries the
  optional timestamp, and list the in-flight op numbers when waiting.
- Fix the watch handling in the ops: on a watched object a rollback now
  marks itself done, a read asserts that the head object exists (not the
  snapshot being read), and the watch callback acks the notify.

Standalone test:
- Add TEST_osd_pool_create_migrate_from to osd-pool-create.sh. It
  migrates an EC pool that has been merged down to 2 PGs and checks that
  pg_num changes on both the source (.migrate-1) and target pools are
  blocked by the mon (nopgchange) and skipped by the mgr.

Teuthology:
- Add qa/pool-migration/ with enabled.yaml and three "none" fragments,
  and link it as a pool-migration facet into the rados basic, singleton,
  thrash and thrash-erasure-code suites and the squid-x parallel upgrade
  suite. enabled.yaml is entirely commented out ("Disabled until pool
  migration is stable"), so no suite runs a migration yet.
- ceph_manager.py: add wait_for_clean(wait_for_migration=...). PGs that
  are migrating, migration_wait or migration_toofull count as clean
  when it is False (the thrashers now pass False), and when it is True,
  migration progress or a paused migration resets the timeout. Add
  helpers for these checks, and compare PG state flags rather than the
  exact string "active+clean". Re-indent several nearby log blocks.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Bill Scales <[email protected]>
Co-authored-by: Adam Lyon-Jones <[email protected]>
Co-authored-by: Tom Sollers <[email protected]>
Co-authored-by: Jamie Pryde <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
@ljflores

ljflores commented Nov 9, 2026

Copy link
Copy Markdown
Member

Seeing one related failure from the QA results:

/a/lflores-2026-11-06_17:44:29-rados-wip-lflores-testing-pool-migration-2-distro-default-trial/723637

2026-11-06T18:57:36.034 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: [ RUN      ] LibRadosList.PoolMigrationRadosLSBasic
2026-11-06T18:57:36.034 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: Client id is: 0
2026-11-06T18:57:36.034 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: /ceph/rpmbuild/BUILD/ceph-21.3.0-4340-g6bcf771e/src/test/librados/list.cc:592: Failure
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: Expected equality of these values:
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   0
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   rados_mon_command(*cluster, cmd, 1, "", 0, &outbuf, &outbuflen, &outs, &outslen)
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:     Which is: -1
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: /ceph/rpmbuild/BUILD/ceph-21.3.0-4340-g6bcf771e/src/test/librados/list.cc:626: Failure
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: Expected equality of these values:
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   0
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   rados_write(tgt_ioctx, "foo2", buf2, sizeof(buf2), 0)
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:     Which is: -30
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:
2026-11-06T18:57:36.035 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: [  FAILED  ] LibRadosList.PoolMigrationRadosLSBasic (2814 ms)
2026-11-06T18:57:36.036 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: [ RUN      ] LibRadosList.PoolMigrationRadosLSMultiple
2026-11-06T18:57:36.036 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: Client id is: 0
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: /ceph/rpmbuild/BUILD/ceph-21.3.0-4340-g6bcf771e/src/test/librados/list.cc:592: Failure
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: Expected equality of these values:
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   0
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:   rados_mon_command(*cluster, cmd, 1, "", 0, &outbuf, &outbuflen, &outs, &outslen)
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:     Which is: -1
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list: *** Caught signal (Segmentation fault) **
2026-11-06T18:57:36.179 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  in thread 7f743cccda00 thread_name:ceph_test_rados
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  ceph version 21.3.0-4340-g6bcf771e (6bcf771e6506356713d7b5ac72c7cfab9b3b249c) umbrella (dev - RelWithDebInfo)
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  1: /lib64/libc.so.6(+0x411c0) [0x7f743c8681c0]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  2: /lib64/librados.so.2(+0x98fb5) [0x7f743d9fffb5]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  3: rados_write()
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  4: (LibRadosList_PoolMigrationRadosLSMultiple_Test::TestBody()+0x46e) [0x56036a817a5e]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  5: ceph_test_rados_api_list(+0xa6f52) [0x56036a877f52]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  6: (testing::Test::Run()+0xe3) [0x56036a84a0c3]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  7: (testing::TestInfo::Run()+0x245) [0x56036a84a3a5]
2026-11-06T18:57:36.180 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  8: ceph_test_rados_api_list(+0x908fa) [0x56036a8618fa]
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  9: (testing::internal::UnitTestImpl::RunAllTests()+0x85c) [0x56036a85c6cc]
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  10: (testing::UnitTest::Run()+0x120) [0x56036a853ee0]
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  11: main()
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  12: /lib64/libc.so.6(+0x2a58e) [0x7f743c85158e]
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  13: __libc_start_main()
2026-11-06T18:57:36.181 INFO:tasks.workunit.client.0.trial115.stdout:                 api_list:  14: _start()

jamiepryde and others added 4 commits November 9, 2026 21:02
Add and update unit tests for pool migration control plane and peering state machine:

- Add test_osd_monitor.cc covering CalcMigratingPgCount* and TargetPgMigrating*
  cases for migration scheduling calculations.
- Update TestPeeringState.cc by removing POOL_MIGRATION conditional guards and
  adding test cases for migration peering state transitions, target reservation
  preemption, and retries.
- Add unit tests in test/librados/list.cc for object listing during migration
  (PoolMigrationRadosLSBasic, PoolMigrationRadosLSMultiple).
- Add MockPeeringListener and MockPGBackend infrastructure for migration
  callback testing.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Bill Scales <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Expose pool migration functionality via the Ceph Manager dashboard REST API:

- Add pool migration endpoint (POST /api/pool/{pool_name}/migrate) to the
  dashboard Pool controller.
- Update OpenAPI specification with migration endpoint schema and parameters.
- Add unit test coverage in test_pool.py.

Signed-off-by: Jamie Pryde <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
Add documentation and update peering state diagrams for pool migration:

- pools.rst: add a "Migrating a Pool" section documenting the
  `ceph osd pool migrate` command and its options. Document the
  `--show-all` flag for `ceph osd pool ls`, which shows hidden pools
  (including .migrate-<n> source pools). Document --enable-ec-optimizations
  and the `allow_ec_optimizations` pool flag.
- ceph.rst (man page): add the `ceph osd pool migrate` subcommand syntax
  and `--show-all` to the `osd pool ls` synopsis.
- ceph_test_rados.rst: document all five pool migration flags
  (--migrate-pool, --migration-enable-ec-optimizations,
  --initial-migration-delay, --migration-interval, --migration-pg-count)
  with a usage example.
- Update gen_state_diagram.py to deduplicate and sort state-transition
  edges so that multiple labels on the same edge are merged rather than
  appearing as separate arrows. Regenerate peering_graph.generated.svg
  to reflect the new pool migration peering states.

Signed-off-by: Jamie Pryde <[email protected]>
Co-authored-by: Connor Fawcett <[email protected]>
Assisted-by: Claude Opus 4.8
Assisted-by: IBM Bob 2.3.0
…ers when running ceph_test_rados

Signed-off-by: Adam Lyon-Jones <[email protected]>
@jamiepryde

Copy link
Copy Markdown
Contributor Author

I have rebased on main, squashed review comment commits, and added a fix for the one QA failure.

@rzarzynski

Copy link
Copy Markdown
Contributor

Thank you @ljflores and @jamiepryde! Let's retest.

@jamiepryde

Copy link
Copy Markdown
Contributor Author

jenkins test dashboard cephadm

Ensure the feature-gated field 'migration_watermark' survives encode/decode

Signed-off-by: Jamie Pryde <[email protected]>
Pool migration endpoints uses a mixed value type dict, so
use cmd_args: Dict[str, Any] = {}

Signed-off-by: Jamie Pryde <[email protected]>
@jamiepryde

Copy link
Copy Markdown
Contributor Author

Added 221f138 and c5ced79 to fix the make check failures

@jamiepryde

Copy link
Copy Markdown
Contributor Author

jenkins test rook e2e

@jamiepryde

Copy link
Copy Markdown
Contributor Author

jenkins test dashboard cephadm

@jamiepryde

Copy link
Copy Markdown
Contributor Author

/config check ok

A create of a pool that was still pending answered "already exists" at
once. A client that resent its create got that answer before the pool was
committed, and its next command did not find the pool.

Such a create now waits for the pending update and runs again, as on main.

Fixes: https://tracker.ceph.com/issues/82290
Assisted-by: Claude Code
(cherry picked from commit 9135682)

Signed-off-by: Jamie Pryde <[email protected]>
@Pegonzal

Copy link
Copy Markdown
Contributor

@jamiepryde cephadm e2e tests failures are unrelated to this changes.
Dashboard changes LGTM. Thanks.

Also, when is this PR expected to get merged?

@jamiepryde

Copy link
Copy Markdown
Contributor Author

@jamiepryde cephadm e2e tests failures are unrelated to this changes. Dashboard changes LGTM. Thanks.

Also, when is this PR expected to get merged?

@Pegonzal I think the rook e2e failures are unrelated too. Hopefully today if there are no issues raised in the teuthology run.

@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I found one or more Fixes: tags in the commit messages in

git log ed5a45c7331b6394afb93b163f6bbd42d603aefc^..ed5a45c7331b6394afb93b163f6bbd42d603aefc

The referenced tickets are:

Those tickets do not reference this merged Pull Request. If this Pull Request merge resolves any of those tickets, please update the "Pull Request ID" field on each ticket. A future run of this script will appropriately update them.

Update Log: https://github.com/ceph/ceph/actions/runs/43048411322

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.