Skip to content

mdraid: Add 'auto' and multiple devices support to parameter md_dev #2037

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2025

Conversation

Damenly
Copy link
Contributor

@Damenly Damenly commented Apr 7, 2025

This commit allows the value 'auto' or multiple devices separated by space are set in parameter md_dev.

When 'auto' is assigned, mdraid RA will try to get all md arrays from mdraid_conf then assemble them automatically.
If multiple devices are assigned e.g. '/dev/md2 /dev/md3', the RA will try to assemble them.

The single device syntax is same as the original.

To keep the code and logic simple, global varaiable RAIDDEVS is introduced to record md devices. All entry functions mdraid_(stop|start|mintor) are renamed to mdraid_(stop|start|mintor)one which are called by new function forall(). In forall(), md_dev and devs are used by mdraid(stop|start|mintor)_one during iterating RAIDDEVS.
The original mdraid_stop_one is renamed to mdraid_stop_array for naming consistency.

Related: #1800

@Damenly
Copy link
Contributor Author

Damenly commented Apr 7, 2025

Hmmm. It seems Jenkins is broken.

This commit allows the value 'auto' or multiple devices separated by space are
set in parameter md_dev.

When 'auto' is assigned, mdraid RA will try to get all md arrays from mdraid_conf
then assemble them automatically.
If multiple devices are assigned e.g. '/dev/md2 /dev/md3', the RA will try to
assemble them.

The single device syntax is same as the original.

To keep the code and logic simple, global varaiable RAIDDEVS is introduced to record
md devices. All entry functions mdraid_(stop|start|mintor) are renamed to
mdraid_(stop|start|mintor)_one which are called by new function forall().
In forall(), md_dev and devs are used by mdraid_(stop|start|mintor)_one during
iterating RAIDDEVS.
The original mdraid_stop_one is renamed to mdraid_stop_array for naming consistency.

Signed-off-by: Su Yue <glass.su@suse.com>
@Damenly Damenly force-pushed the mdraid_multi_devices branch from 6e9fa49 to c0648ba Compare April 7, 2025 10:06
@oalbrigt
Copy link
Contributor

oalbrigt commented Apr 7, 2025

We might need some more checks, so I will leave this open for 1-2 weeks to let the developer of the agent review it.

@Damenly
Copy link
Contributor Author

Damenly commented Apr 15, 2025

Hi. Any comment from the developers of the agent?

@varkoly
Copy link
Contributor

varkoly commented Apr 17, 2025

Can someone fix jenkins?

@varkoly
Copy link
Contributor

varkoly commented Apr 22, 2025

Hi. Any comment from the developers of the agent?

Sure. The change is pretty straightforward, and I've tested the following cases based on SLE 16 Beta3:

  1. Set md_dev to 'auto'
    1.1 If some of the md arrays listed in $mdadm_conf are not cluster-md, unless force_clones is true, the start of the RA will return $OCF_ERR_CONFIGURED
    1.2 If all of the md arrays are in cluster-md type, they will be assembled one by one
    1.3 If some of the md arrays listed in $mdadm_conf are not able to be assembled, $OCF_ERR_GENERIC will be returned, like how single device parameter behaves
  2. Set md_dev to multi deivces like '/dev/md3 /dev/md127', mostly like 'auto' is given :
    2.1 If some of these md arrays listed in $mdadm_conf are not cluster-md, unless force_clones is true, the start of the RA will return $OCF_ERR_CONFIGURED
    2.2 If all of these md arrays are in cluster-md type, they will be assembled one by one
    2.3 If some of the md arrays listed in $mdadm_conf are not able to be assembled, $OCF_ERR_GENERIC will be returned, like how single device parameter behaves
    2.4 If some of given md devices are not in $mdadm_conf, the RA will fail to start as $OCF_ERR_GENERIC.
  3. Set md_dev to single device. It works as before the change.
  4. Set md_dev to other meaningless strings, the start returns $OCF_ERR_ARGS as the original.

@mauelsha
Copy link

Ok with me, as it's optionally configurable (keyword 'auto') and doesn't change single array RA semantics.

@oalbrigt
Copy link
Contributor

retest this please

@Damenly
Copy link
Contributor Author

Damenly commented May 6, 2025

Ping. Can this PR be merged?

@oalbrigt oalbrigt merged commit d38c7ca into ClusterLabs:main May 6, 2025
1 check passed
@oalbrigt
Copy link
Contributor

oalbrigt commented May 6, 2025

Thanks.

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.

4 participants