Conversation
| setattr( | ||
| klass, | ||
| f'_cli_{name}', | ||
| CLICommand(**CephCommander(func).to_ceph_signature())( |
There was a problem hiding this comment.
I don't like CLICommand, as it has global side effects that prevents me from using it. I had to build my own wrapper to work around the problems:
https://github.com/ceph/ceph/search?q=CLICommandMeta&unscoped_q=CLICommandMeta
There was a problem hiding this comment.
Yeah, I don't like it either, but it was there and wanted to reuse as much code as possible for this module.
| class CephCommander: | ||
| """ | ||
| Utility class to inspect Python functions and generate corresponding | ||
| CephCommand signatures (see src/mon/MonCommand.h for details) | ||
| """ |
There was a problem hiding this comment.
Like forever, I wanted to have this class to automatically convert python signatures to mon commands.
Would be great to have this also work standalone and directly usable for me.
There was a problem hiding this comment.
Probably we could take this one and came up with an alternative to @CLICommand that auto-guesses the signature (when Ricardo wrote CLICommand we couldn't use yet type annotations).
| class CLI(MgrModule, metaclass=MgrAPIReflector): | ||
| def __init__(self, *args, **kwargs): | ||
| super().__init__(*args, **kwargs) | ||
| self.stop = Event() | ||
|
|
||
| def serve(self): | ||
| logger.info("Starting") | ||
| while not self.stop.wait(self.get_ceph_option('mgr_tick_period')): | ||
| pass | ||
|
|
||
| def shutdown(self): | ||
| """ | ||
| This method is called by the mgr when the module needs to shut | ||
| down (i.e., when the serve() function needs to exit). | ||
| """ | ||
| logger.info('Stopping') | ||
| self.stop.set() |
There was a problem hiding this comment.
I'm a against introducing a huge bunch of complexity and a whole new module for just printing some documentation. We've already plenty of modules already.
This seems redundant to https://docs.ceph.com/docs/master/mgr/modules/ .
There was a problem hiding this comment.
Do you mean about this module? This module is not for documenting anything (while it may provide docs, and more updated than that page), but to allow usage of the internal Ceph-mgr Python API from the CLI: either for development purposes (new module PoC or extension) or for debugging.
For example, we may explore the undocumented get('modified_config_options'):
# ceph cli get modified_config_options
{
"options": [
"admin_socket",
"auth_client_required",
"auth_cluster_required",
"auth_service_required",
"bluestore_block_create",
"bluestore_block_db_create",
"bluestore_block_db_path",
"bluestore_block_db_size",
"bluestore_block_wal_create",
"bluestore_block_wal_path",
"bluestore_block_wal_size",
"bluestore_fsck_on_mount",
"cephadm_path",
"chdir",
"crash_dir",
"debug_asok_assert_abort",
"debug_mon",
"debug_ms",
"enable_experimental_unrecoverable_data_corrupting_features",
"erasure_code_dir",
"filestore_fd_cache_size",
"filestore_wbthrottle_btrfs_inodes_hard_limit",
"filestore_wbthrottle_btrfs_ios_hard_limit",
"filestore_wbthrottle_btrfs_ios_start_flusher",
"filestore_wbthrottle_xfs_inodes_hard_limit",
"filestore_wbthrottle_xfs_ios_hard_limit",
"filestore_wbthrottle_xfs_ios_start_flusher",
"heartbeat_file",
"keyring",
"kstore_fsck_on_mount",
"leveldb_block_size",
"leveldb_cache_size",
"leveldb_compression",
"leveldb_log",
"leveldb_write_buffer_size",
"lockdep",
"log_file",
"mgr_data",
"mgr_initial_modules",
"mgr_module_path",
"mon_allow_pool_delete",
"mon_allow_pool_size_one",
"mon_cluster_log_file",
"mon_data",
"mon_data_avail_crit",
"mon_data_avail_warn",
"mon_host",
"mon_max_pg_per_osd",
"mon_osd_backfillfull_ratio",
"mon_osd_full_ratio",
"mon_osd_nearfull_ratio",
"mon_osd_reporter_subtree_level",
"ms_bind_msgr1",
"ms_bind_msgr2",
"no_config_file",
"osd_check_max_object_name_len_on_startup",
"osd_class_default_list",
"osd_class_dir",
"osd_class_load_list",
"osd_copyfrom_max_chunk",
"osd_crush_chooseleaf_type",
"osd_data",
"osd_debug_misdirected_ops",
"osd_debug_op_order",
"osd_failsafe_full_ratio",
"osd_fast_shutdown",
"osd_journal",
"osd_journal_size",
"osd_objectstore",
"osd_pool_default_erasure_code_profile",
"osd_pool_default_min_size",
"osd_pool_default_size",
"osd_scrub_load_threshold",
"pid_file",
"plugin_dir",
"rbd_default_features",
"run_dir"
]
}
Fixes: https://tracker.ceph.com/issues/45264 Signed-off-by: Ernesto Puerta <epuertat@redhat.com>
13af22a to
c353fea
Compare
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
|
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
Fixes: https://tracker.ceph.com/issues/45264
Sample output:
Signed-off-by: Ernesto Puerta epuertat@redhat.com
Checklist
Show available Jenkins commands
jenkins retest this pleasejenkins test classic perfjenkins test crimson perfjenkins test signedjenkins test make checkjenkins test make check arm64jenkins test submodulesjenkins test dashboardjenkins test dashboard backendjenkins test docsjenkins render docsjenkins test ceph-volume alljenkins test ceph-volume tox