Skip to content

storage: add dynamic managed storage dispatcher#442

Merged
dupondje merged 2 commits intooVirt:masterfrom
sp-viktori:managed-storage-dispatcher
Apr 16, 2026
Merged

storage: add dynamic managed storage dispatcher#442
dupondje merged 2 commits intooVirt:masterfrom
sp-viktori:managed-storage-dispatcher

Conversation

@sp-viktori
Copy link
Copy Markdown
Contributor

Dispatch mechanism that third-party storage vendors can use to redirect managed storage operations.

  • Add an optional adapter field in the ManagedVolumeConnection struct.

  • If there is an adapter field, direct storage requests to managedvolume-helper-{adapter}, otherwise use the default (os-brick) implementation.

Works together with a simplar PR in ovirt-engine that allows redirection of the rest of the managed storage operations.

@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch from 90d1601 to 394fa30 Compare October 16, 2025 15:08
@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch 2 times, most recently from 5cc41fc to d0a34b5 Compare November 21, 2025 09:35
@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch from d0a34b5 to b026231 Compare January 12, 2026 12:05
Comment thread lib/vdsm/api/vdsm-api.yml Outdated
description: Adapter vendor
name: adapter
type: string
added: '4.5.6'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

4.5.8 it would be if merged now

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.

thanks for catching this, updated

Comment thread doc/managed-volume-adapters.md Outdated
the default `cinderlib-client.py` helper.

The vendor packaging is expected to install a symlink in
`/usr/share/ovirt-engine/cinderlib/` named `{adapter}-adapter`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just in doubt if this is the right directory to put this in.
/usr/share/ovirt-engine/managedvolume/ perhaps and move cinderlib into it?

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.

Right, I've changed this to reflect the oVirt Engine PR (the updated proposal indeed uses a managedblock directory instead of cinderlib).

Comment thread lib/vdsm/storage/managedvolume.py Outdated

try:
attachment = run_helper("attach", connection_info)
attachment = run_helper("attach", connection_info, connection_info.get("adapter"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is useless? As you pass connection_info, you can also get the adapter in the run_helper function then.

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.

In this case, yes, but the run_helper function has a union type: in this case it is connection_info but when calling for detach it is vol_info. Good news is that vol_info has connection_info as a field (which has adapter) but it becomes very convoluted to figure it out.

I'll think on simplifying the whole thing while keeping it robust, and push an update soon.

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've pushed a different approach, and also split it in two:

  1. A change in how managedvolume-helper is called that makes the protocol a bit stricter (so there is no ambiguity what is sent as input: it is always volume_info struct).
  2. The adapter dispatch which now knows exactly where to look for the adapter field.

@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch 2 times, most recently from 25159ca to ce5b7f0 Compare February 4, 2026 15:11
@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch from ce5b7f0 to a87042d Compare March 24, 2026 13:06
Comment thread doc/managed-volume-adapters.md Outdated
@@ -0,0 +1,48 @@
<!--
SPDX-FileCopyrightText: Red Hat, Inc.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can change this to 'oVirt Developers'.

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.

Done

Comment thread doc/managed-volume-adapters.md
Comment thread lib/vdsm/storage/managedvolume.py Outdated
helper = HELPER
if adapter:
helper = f"{HELPER}-{adapter}"
if not os.path.exists(helper):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What if the file exists but is non-executable?

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.

Added executable check as well, works with symlinks in my tests.

Comment thread lib/vdsm/storage/managedvolume.py Outdated
f"Helper for adapter '{adapter}' not found"
f" at '{helper}'")
# This is the only sane way to run python scripts that work with both
# python2 and python3 in the tests.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Perhaps unrelated to this PR, but we dropped python2 support.
So if the execution can be improved, feel free :)

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.

Oof this is actually related now that you've pointed it out. My assumption (and the documentation) say that this helper can be anything but the way it's been run (for Python2 compatibility) is to hand it over to the Python executable as a script ($python helper basically). This means that it must have been a python script with the same version of python as Vdsm.

I'll remove the Python2 workaround and execute it directly, also checking for the executable bit. Need to run tests locally again to make sure it works (and the legacy cinderlib helper also). Will push when ready.

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.

Alright, did some more test this time and also ran OST locally with the RPMs from my Vdsm branch as well as the RPMs from my oVirt engine branch.

Removing the Python 2 workaround is OK and allows vendors to use non-Python adapters/helpers as well.

@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch 2 times, most recently from bec847e to 70a4280 Compare April 15, 2026 14:23
Make the protocol used to communicate with the managed volume helper
scripts stricter.

Previously, the input could be:
- when attaching: connection_info struct;
- when detaching: volume_info struct which contains connection_info,
  attachment, path, etc.).

Now it is always a volume_info struct, and in the case when we're
attaching the struct only has the connection_info field populated.

Signed-off-by: Viktor Ivanov <viktor.ivanov@storpool.com>
Add an optional "adapter" field in the ManagedVolumeConnection struct,
allowing dispatching to vendor managedvolume-helper adapters.

Drop the Python 2 workaround when running the helper, also dropping the
requirement for it (and thus the vendor-provided adapters) to be a
Python script.

Signed-off-by: Viktor Ivanov <viktor.ivanov@storpool.com>
@sp-viktori sp-viktori force-pushed the managed-storage-dispatcher branch from 70a4280 to e6c7c1e Compare April 16, 2026 11:58
@dupondje
Copy link
Copy Markdown
Member

/ost

@github-actions
Copy link
Copy Markdown

⏳ Running ost suite 'basic-suite-master' on distro 'centos9'.

Follow the progress here.

@github-actions
Copy link
Copy Markdown

😎💪 ost suite 'basic-suite-master' on distro 'centos9' finished successfully. (details)

@dupondje dupondje merged commit cc9eca5 into oVirt:master Apr 16, 2026
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants