Skip to content

snapm: implement plugin configuration and snapshot limits#324

Merged
bmr-cymru merged 7 commits intomainfrom
bmr-config-files-and-limits
Jun 9, 2025
Merged

snapm: implement plugin configuration and snapshot limits#324
bmr-cymru merged 7 commits intomainfrom
bmr-config-files-and-limits

Conversation

@bmr-cymru
Copy link
Copy Markdown
Contributor

@bmr-cymru bmr-cymru commented Jun 8, 2025

Add support for a configuration file for snapm, and for individual plugins.

@bmr-cymru bmr-cymru force-pushed the bmr-config-files-and-limits branch 2 times, most recently from 1cdd394 to a03e4f8 Compare June 8, 2025 18:27
@packit-as-a-service
Copy link
Copy Markdown

Congratulations! One of the builds has completed. 🍾

You can install the built RPMs by following these steps:

  • sudo yum install -y dnf-plugins-core on RHEL 8
  • sudo dnf install -y dnf-plugins-core on Fedora
  • dnf copr enable packit/snapshotmanager-snapm-324
  • And now you can install the packages.

Please note that the RPMs should be used only in a testing environment.

@bmr-cymru bmr-cymru force-pushed the bmr-config-files-and-limits branch from a03e4f8 to ed83866 Compare June 8, 2025 19:11
bmr-cymru added 4 commits June 8, 2025 20:13
Add support for an optional configuration file, /etc/snapm/snapm.conf,
to allow users to disable plugins by name.

Resolves: #318
A SyntaxError in a plugin should not terminate the snapm process:

    # snapm -vv --debug=all plugin list
    DEBUG - Blocking termination signals {<Signals.SIGINT: 2>, <Signals.SIGTERM: 15>}
    DEBUG - Loading configuration from '/etc/snapm/snapm.conf'
    DEBUG - Initialised boot entry cache with 0 entries
    DEBUG - Initialised revert boot entry cache with 0 entries
    DEBUG - Importing plugin module snapm.manager.plugins.stratis
    DEBUG - Importing plugin module snapm.manager.plugins.lvm2
    DEBUG - Unblocking termination signals {<Signals.SIGINT: 2>, <Signals.SIGTERM: 15>}
    Traceback (most recent call last):
      File "/root/src/git/snapm/bin/snapm", line 7, in <module>
        r = main(sys.argv)
      File "/root/src/git/snapm/snapm/command.py", line 1677, in main
        status = cmd_args.func(cmd_args)
      File "/root/src/git/snapm/snapm/command.py", line 1148, in _plugin_list_cmd
        manager = Manager()
      File "/root/src/git/snapm/snapm/manager/_signals.py", line 46, in wrapper
        ret = func(*args, **kwargs)
      File "/root/src/git/snapm/snapm/manager/_manager.py", line 322, in __init__
        plugin_classes = load_plugins()
      File "/root/src/git/snapm/snapm/manager/_loader.py", line 69, in load_plugins
        module = _import_plugin_module(fqname)
      File "/root/src/git/snapm/snapm/manager/_loader.py", line 38, in _import_plugin_module
        return importlib.import_module(fqname)
               ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
      File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
               ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
      File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
      File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
      File "<frozen importlib._bootstrap_external>", line 1022, in exec_module
      File "<frozen importlib._bootstrap_external>", line 1160, in get_code
      File "<frozen importlib._bootstrap_external>", line 1090, in source_to_code
      File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
      File "/root/src/git/snapm/snapm/manager/plugins/lvm2.py", line 1222
        else
            ^
    SyntaxError: expected ':'

Resolves: #320
Support an optional per-plugin configuration file for setting plugin
limits to avoid performance degredation.

Resolves: #319
Add a generic PluginLimits class and SnapmLimitsError to represent
configurable limits on plugin behaviour.

Resolves: #321
@bmr-cymru bmr-cymru force-pushed the bmr-config-files-and-limits branch from ed83866 to 6d7b064 Compare June 8, 2025 19:13
bmr-cymru added 3 commits June 8, 2025 20:21
Keep track of snapshots-per-origin (lvm2-cow) and snapshots-per-pool
(lvm2-thin), and enforce the limits defined in /etc/snapm/plugins.d.

Resolves: #322
Keep track of snapshots-per-pool and enforce the limits defined in
/etc/snapm/plugins.d.

Resolves: #323
Resolves: #317
@bmr-cymru bmr-cymru force-pushed the bmr-config-files-and-limits branch from 6d7b064 to 35eea7b Compare June 8, 2025 19:21
@bmr-cymru bmr-cymru merged commit 35eea7b into main Jun 9, 2025
16 checks passed
@bmr-cymru bmr-cymru deleted the bmr-config-files-and-limits branch December 21, 2025 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant