Repository navigation
mgr/DaemonServer: Implement ok-to-upgrade command - #66108
Conversation
Config Diff Tool Output+ added: mgr_osd_upgrade_check_reduction_factor (mgr.yaml.in)
The above configuration changes are found in the PR. Please update the relevant release documentation if necessary. |
|
Note to reviewers: Please provide feedback on the following, Right now there's no check to restrict the type of CRUSH bucket type to consider. This can impact how long the command will take to run if the bucket type specified is higher up the tree. In such a case, the command may take a long time to return depending on the number of OSDs in the subtree. I guess the question is, should we limit the bucket types to a small subset like for e.g., "host", "chassis", "rack" and so on? This obviously needs thorough testing on scaled cluster for correctness, performance and other bugs before merging. |
9322d17 to
1c9b959
Compare
1c9b959 to
bf8da07
Compare
bf8da07 to
f095082
Compare
Update: |
f095082 to
a76f2bb
Compare
cafd354 to
25bca93
Compare
|
/config check ok |
|
@rzarzynski @NitzanMordhai @kamoltat Can you please review this from Mgr perspective? Thanks! |
NitzanMordhai
left a comment
There was a problem hiding this comment.
@sseshasa please see my comments
25bca93 to
24201bc
Compare
|
jenkins test make check arm64 |
d59b7a3 to
142dd4b
Compare
|
jenkins test make check |
142dd4b to
b1932d8
Compare
|
jenkins test make check |
kamoltat
left a comment
There was a problem hiding this comment.
LGTM just one small change, maybe add an empty string test to your standalone.
b1932d8 to
d0ccd8a
Compare
|
jenkins test make check |
d0ccd8a to
db3848d
Compare
|
@rzarzynski @kamoltat ,The latest push today(Feb 19, 2026) has a minor fix for issue described here that was hit during testing on a larger cluster. I think the PR is in good shape now. |
|
jenkins test make check arm64 |
The offline_pg_report structure to be used by both the 'ok-to-stop' and 'ok-to-upgrade' commands is modified to handle either std::set or std::vector type containers. This is necessitated due to the differences in the way both commands work. For the 'ok-to-upgrade' command logic to work optimally, the items in the specified crush bucket including items found in the subtree must be strictly ordered. The earlier std::set container re-orders the items upon insertion by sorting the items which results in the offline pg check to report sub-optimal results. Therefore, the offline_pg_report struct is modified to use std::variant<std::vector<int>, std::set<int>> as a ContainerType and handled accordingly in dump() using std::visit(). This ensures backward compatibility with the existing 'ok-to-stop' command while catering to the requirements of the new 'ok-to-upgrade' command. Signed-off-by: Sridhar Seshasayee <[email protected]>
Implement a new Mgr command called 'ok-to-upgrade' that returns a set of OSDs
within the provided CRUSH bucket that are safe to upgrade without reducing
immediate data availability.
The command accepts the following as input:
- CRUSH bucket name (required)
- The CRUSH bucket type is limited to 'rack', 'chassis', 'host' and 'osd'.
This is to prevent users from specifying a bucket type higher up the tree
which could result in performance issues if the number of OSDs in the
bucket is very high.
- The new Ceph version to check against. The format accepted is the short
form of the Ceph version, for e.g. 20.3.0-3803-g63ca1ffb5a2. (required)
- The maximum number of OSDs to consider if specified. (optional)
Implementation Details:
After sanity checks on the provided parameters, the following steps are
performed:
1. The set of OSDs within the CRUSH bucket is first determined.
2. From the main set of OSDs, a filtered set of OSDs not yet running the new
Ceph version is created.
- For this purpose, the OSD's 'ceph_version_short' string is read from
the metadata. For this purpose a new method called
DaemonServer::get_osd_metadata() is used. The information is determined
from the DaemonStatePtr maintained within the DaemonServer.
3. If all OSDs are already running the new Ceph version, a success report is
generated and returned.
4. If OSDs are not running the new Ceph version, a new set (to_upgrade) is
created.
5. If the current version cannot be determined, an error is logged and the
output report with 'bad_no_version' field populated with the OSD in question
is generated.
6. On the new set (to_upgrade), the existing logic in _check_offline_pgs() is
executed to see if stopping any or all OSDs in the set as part of the upgrade
can reduce immediate data availability.
- If data availability is impacted, then the number of OSDs in the filtered
set is reduced by a factor defined by a new config option called
'mgr_osd_upgrade_check_convergence_factor' which is set to 0.8 by default.
- The logic in _check_offline_pgs() is repeated for the new set.
- The above is repeated until a safe subset of OSDs that can be stopped for
upgrade is found. Each iteration reduces the number of OSDs to check by
the convergence factor mentioned above.
7. It must be noted that the default value of
'mgr_osd_upgrade_check_convergence_factor' is on the higher side in order to
help determine an optimal set of OSDs to upgrade. In other words, a higher
convergence factor would help maximize the number of OSDs to upgrade. In this
case, the number of iterations and therefore the time taken to determine the
OSDs to upgrade is proportional to the number of OSDs in the CRUSH bucket.
The converse is true if a lower convergence factor is used.
8. If the number of OSDs determined is lower than the 'max' specified, then an
additional loop is executed to determine if other children of the CRUSH
bucket can be added to the existing set.
9. Once a viable set is determined, an output report similar to the following is
generated:
A standalone test is introduced that exercises the logic for both replicated
and erasure-coded pools by manipulating the min_size for a pool and check for
upgradability. The tests also performs other basic sanity checks and error
conditions.
The output shown below is for a cluster running on a single node with 10 OSDs
and with replicated pool configuration:
$ ceph osd ok-to-upgrade incerta06 01.00.00-gversion-test --format=json
{"ok_to_upgrade":true,"all_osds_upgraded":false,\
"osds_in_crush_bucket":[0,1,2,3,4,5,6,7,8,9],\
"osds_ok_to_upgrade":[0],"osds_upgraded":[],"bad_no_version":[]}
The following report is shown if all OSDs are running the desired Ceph version:
$ ceph osd ok-to-upgrade --crush_bucket localrack \
--ceph_version 20.3.0-3803-g63ca1ffb5a2
{"ok_to_upgrade":false,"all_osds_upgraded":true,\
"osds_in_crush_bucket":[0,1,2,3,4,5,6,7,8,9],"osds_ok_to_upgrade":[],\
"osds_upgraded":[0,1,2,3,4,5,6,7,8,9],"bad_no_version":[]}'
Fixes: https://tracker.ceph.com/issues/73031
Signed-off-by: Sridhar Seshasayee <[email protected]>
…upgrade DaemonServer::_maximize_ok_to_upgrade_set() attempts to find which OSDs from the initial set found as part of _populate_crush_bucket_osds() can be upgraded as part of the initial phase. If the initial set results in failure, the convergence logic trims the 'to_upgrade' vector from the end until a safe set is found. Therefore, it would be advantageous to sort the OSDs by the ascending number of PGs hosted by the OSDs. By placing OSDs with smallest (or no PGs) at the beginning of the vector, the trim logic along with _check_offlines_pgs() will have the best chance of finding OSDs to upgrade as it approaches a grouping of OSDs that have the smallest or no PGs. To achieve the above, a temporary vector of struct pgs_per_osd is created and sorted for a given crush bucket. The sorted OSDs are pushed to the main crush_bucket_osds that is eventually used to run the _check_offlines_pgs() logic to find a safe set of OSDs to upgrade. pgmap is passed to _populate_crush_bucket_osds() to utilize get_num_pg_by_osd() for the above logic to work. Signed-off-by: Sridhar Seshasayee <[email protected]>
db3848d to
8177e48
Compare
|
The latest push today(Feb 23, 2026) is after a general rebase and to re-trigger unrelated failed checks. It also potentially has a fix for a minor issue described here that was hit during testing on a larger cluster. |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
|
This is an automated message by src/script/redmine-upkeep.py. I have resolved the following tracker ticket due to the merge of this PR: No backports are pending for the ticket. If this is incorrect, please update the tracker |
Implement a new Mgr command called 'ok-to-upgrade' that returns a set of OSDs within the provided CRUSH bucket that are safe to upgrade without reducing immediate data availability.
The command accepts the following as input:
Implementation Details:
After sanity checks on the provided parameters, the following steps are performed:
mgr_osd_upgrade_check_convergence_factorwhich is set to 0.8 by default.mgr_osd_upgrade_check_convergence_factoris on the higher side in order to help determine an optimal set of OSDs to upgrade. In other words, a higher convergence factor would help maximize the number of OSDs to upgrade. In this case the number of iterations and therefore the time taken to determine the OSDs to upgrade is proportional to the number of OSDs in the CRUSH bucket. The converse is true if a lower convergence factor is used.The output shown below is for a cluster running on a single node with 10 OSDs
and with replicated pool configuration:
The following report is shown if all OSDs are running the desired Ceph version:
The following report is shown if an incompatible CRUSH bucket type is specified:
A qa/standalone test is introduced that runs basic sanity test and exercises the logic on both replicated and erasure-coded pools by manipulating the min_size for a pool and check for upgradability.
Fixes: https://tracker.ceph.com/issues/73031
Signed-off-by: Sridhar Seshasayee [email protected]
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
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.