@@ -400,6 +400,7 @@ be automatically processed. Example:
400400
401401 .. _`Rule of Silence` : http://www.linfo.org/rule_of_silence.html
402402
403+ .. _mgr module dev configuration options :
403404
404405Configuration options
405406---------------------
@@ -412,15 +413,71 @@ Modules can load and store configuration options using the
412413 certificates). If you want to persist module-internal data or
413414 binary configuration data consider using the `KV store `_.
414415
415- You must declare your available configuration options in the
416- ``MODULE_OPTIONS `` class attribute, like this:
416+ Configuration options must be declared in the ``MODULE_OPTIONS `` class attribute:
417417
418418.. code-block :: python
419419
420420 MODULE_OPTIONS = [
421- Option(name = " my_option" )
421+ Option(name = " check_interval" ,
422+ level = OptionLevel.ADVANCED ,
423+ default = 60 ,
424+ type = " secs" ,
425+ desc = " The interval in seconds to check the inbox" ,
426+ long_desc = " The interval in seconds to check the inbox. Set to 0 to disable the check" ,
427+ min = 0 ,
428+ runtime = True )
422429 ]
423430
431+ The example above demonstrates most supported properties, though typically only
432+ a subset is needed. The following properties are supported:
433+
434+ **name **
435+ The option's name. This is the only required property.
436+
437+ **type ** (optional, default: ``str ``)
438+ The option's data type. Supported types:
439+
440+ * ``uint `` - unsigned 64-bit integer
441+ * ``int `` - signed 64-bit integer
442+ * ``str `` - string
443+ * ``float `` - double-precision floating point
444+ * ``bool `` - boolean
445+ * ``addr `` - Ceph messenger address for peer communication
446+ * ``addrvec `` - comma-separated list of Ceph messenger addresses
447+ * ``uuid `` - UUID as defined by `RFC 4122 <https://www.ietf.org/rfc/rfc4122.txt >`_
448+ * ``size `` - size value (stored as uint64_t)
449+ * ``secs `` - timespan in format ``"<number><unit>..." ``, e.g., ``"3h 2m 1s" `` or ``"3weeks" ``
450+
451+ Supported units: ``s ``, ``sec ``, ``second(s) ``, ``m ``, ``min ``, ``minute(s) ``,
452+ ``h ``, ``hr ``, ``hour(s) ``, ``d ``, ``day(s) ``, ``w ``, ``wk ``, ``week(s) ``,
453+ ``mo ``, ``month(s) ``, ``y ``, ``yr ``, ``year(s) ``
454+
455+ * ``millisecs `` - timespan in milliseconds
456+
457+ **desc **
458+ Short description (can be a sentence fragment).
459+
460+ **long_desc **
461+ Detailed description using complete sentences or paragraphs.
462+
463+ **default **
464+ Default value for the option.
465+
466+ **min ** / **max **
467+ Minimum and maximum allowed values.
468+
469+ **enum_allowed **
470+ For ``str `` type options, a list of allowed string values. Values outside this set are rejected.
471+
472+ **see_also **
473+ List of related option names (used in documentation only).
474+
475+ **tags **
476+ List of tags for categorizing the option (used in documentation only).
477+
478+ **runtime ** (default: ``False ``)
479+ Whether the option can be updated after module loading.
480+
424481If you try to use ``set_module_option `` or ``get_module_option `` on options
425482not declared in ``MODULE_OPTIONS ``, an exception will be raised.
426483
0 commit comments