Skip to content

DAOS-17659 control: Enable setting property value with multiple strings #16503

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tanabarr
Copy link
Contributor

@tanabarr tanabarr commented Jun 11, 2025

Fix issue where a property value containing multiple comma-separated
strings cannot be set e.g. self_heal:exclude,rebuild.

Features: control

Steps for the author:

  • Commit message follows the guidelines.
  • Appropriate Features or Test-tag pragmas were used.
  • Appropriate Functional Test Stages were run.
  • At least two positive code reviews including at least one code owner from each category referenced in the PR.
  • Testing is complete. If necessary, forced-landing label added and a reason added in a comment.

After all prior steps are complete:

  • Gatekeeper requested (daos-gatekeeper added as a reviewer).

Features: control
Signed-off-by: Tom Nabarro <thomas.nabarro@hpe.com>
@tanabarr tanabarr requested review from a team as code owners June 11, 2025 12:32
@tanabarr tanabarr self-assigned this Jun 11, 2025
Copy link

Ticket title is 'Unable to set pool property self_heal to exclude,rebuild'
Status is 'In Progress'
https://daosio.atlassian.net/browse/DAOS-17659

@tanabarr tanabarr added control-plane work on the management infrastructure of the DAOS Control Plane usability Changes specific to user facing tools or behaviour. labels Jun 11, 2025
@tanabarr tanabarr requested review from mjmac, liw, kjacque and knard38 June 11, 2025 12:33
@daosbuild3
Copy link
Collaborator

@daosbuild3
Copy link
Collaborator

@daosbuild3
Copy link
Collaborator

@daosbuild3
Copy link
Collaborator

@@ -159,6 +160,8 @@ func (f *SetPropertiesFlag) UnmarshalFlag(fv string) error {
return propError("value must not be empty")
}

value = strings.Trim(value, "\"")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
value = strings.Trim(value, "\"")
value = strings.Trim(value, `"`)

@liw
Copy link
Contributor

liw commented Jun 12, 2025

Thanks a lot for the quick responses, everyone.

This patch doesn't feel right---hope I'm not misleading:

  • The , does not require escaping as far as the shell is concerned.
  • The shell removes the escaping before our code sees the arguments. (See my Python experiment below. I also tried C just in case Python is too smart, but I got the same result.)
  • We need to document (in dmg help or man page?) what syntaxes are supported for setting pool property self_heal.
  • The unit test doesn't reflect the real inputs from the shell.
% python -c 'import sys; print(sys.argv)' a b=c d=e,f g='h i' j='k,l' n=o\,p 
['-c', 'a', 'b=c', 'd=e,f', 'g=h i', 'j=k,l', 'n=o,p']

@liw
Copy link
Contributor

liw commented Jun 12, 2025

Yeah, after applying this patch, I got the same errors when setting self_heal to exclude,rebuild:

bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude
pool set-prop succeeded
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude,rebuild
ERROR: dmg: invalid property "rebuild" (must be key:val)
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:'exclude,rebuild'
ERROR: dmg: invalid property "rebuild" (must be key:val)
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude\,rebuild
ERROR: dmg: invalid property "rebuild" (must be key:val)

This worked, however:

bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:\'exclude,rebuild\'
pool set-prop succeeded

Sounds like the set-prop syntax design [<key:val[,key:val...]>] doesn't work well with the self_heal value syntax design flag0[,flag1...].

@tanabarr
Copy link
Contributor Author

Yeah, after applying this patch, I got the same errors when setting self_heal to exclude,rebuild:

bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude
pool set-prop succeeded
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude,rebuild
ERROR: dmg: invalid property "rebuild" (must be key:val)
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:'exclude,rebuild'
ERROR: dmg: invalid property "rebuild" (must be key:val)
bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:exclude\,rebuild
ERROR: dmg: invalid property "rebuild" (must be key:val)

This worked, however:

bash-5.1$ ~/daos/install/bin/dmg -o ~/daos_control.yml -i pool set-prop p0 self_heal:\'exclude,rebuild\'
pool set-prop succeeded

Sounds like the set-prop syntax design [<key:val[,key:val...]>] doesn't work well with the self_heal value syntax design flag0[,flag1...].

If escaping single or double quotes isn't acceptable should the parser check if the option following the comma matches compatible flag name? try match keyval else try match flag? what do you think?

@kjacque
Copy link
Contributor

kjacque commented Jun 14, 2025

If escaping single or double quotes isn't acceptable should the parser check if the option following the comma matches compatible flag name? try match keyval else try match flag? what do you think?

Could we use some other set of characters to wrap the values (maybe [])? Otherwise, like @liw said, it feels like we made a design mistake somewhere along the line.

I'm not completely against users having to escape the quotes, but they may find it a bit annoying (and hard to figure out what they did wrong if they don't escape them).

@daosbuild3
Copy link
Collaborator

@daosbuild3
Copy link
Collaborator

@daosbuild3
Copy link
Collaborator

Test stage Functional Hardware Medium MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-16503/2/execution/node/1454/log

@daosbuild3
Copy link
Collaborator

Test stage Functional Hardware Medium Verbs Provider MD on SSD completed with status FAILURE. https://jenkins-3.daos.hpc.amslabs.hpecorp.net//job/daos-stack/job/daos/view/change-requests/job/PR-16503/2/execution/node/1544/log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
control-plane work on the management infrastructure of the DAOS Control Plane usability Changes specific to user facing tools or behaviour.
Development

Successfully merging this pull request may close these issues.

6 participants