Skip to content
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

DAOS-16487 control: Only use hostlist from cfg on cfg-aware dmg cmds #15087

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

Conversation

tanabarr
Copy link
Contributor

@tanabarr tanabarr commented Sep 6, 2024

During dmg command initialisation, load ctl config from file to
preload cert data but in the case that the command does not embed
cfgCmd (and therefore doesn't intend to use config settings), strip
hostlist before setting config on invoker, this will prevent
inadvertent use of hostlist from a config file on commands that are
supposed not to.

Required-githooks: true

Before requesting gatekeeper:

  • Two review approvals and any prior change requests have been resolved.
  • Testing is complete and all tests passed or there is a reason documented in the PR why it should be force landed and forced-landing tag is set.
  • Features: (or Test-tag*) commit pragma was used or there is a reason documented that there are no appropriate tags for this PR.
  • Commit messages follows the guidelines outlined here.
  • Any tests skipped by the ticket being addressed have been run and passed in the PR.

Gatekeeper:

  • You are the appropriate gatekeeper to be landing the patch.
  • The PR has 2 reviews by people familiar with the code, including appropriate owners.
  • Githooks were used. If not, request that user install them and check copyright dates.
  • Checkpatch issues are resolved. Pay particular attention to ones that will show up on future PRs.
  • All builds have passed. Check non-required builds for any new compiler warnings.
  • Sufficient testing is done. Check feature pragmas and test tags and that tests skipped for the ticket are run and now pass with the changes.
  • If applicable, the PR has addressed any potential version compatibility issues.
  • Check the target branch. If it is master branch, should the PR go to a feature branch? If it is a release branch, does it have merge approval in the JIRA ticket.
  • Extra checks if forced landing is requested
    • Review comments are sufficiently resolved, particularly by prior reviewers that requested changes.
    • No new NLT or valgrind warnings. Check the classic view.
    • Quick-build or Quick-functional is not used.
  • Fix the commit message upon landing. Check the standard here. Edit it to create a single commit. If necessary, ask submitter for a new summary.

Copy link

github-actions bot commented Sep 6, 2024

Ticket title is 'dmg storage must precisely identify NVMe device(s)'
Status is 'In Review'
Labels: 'lrz,usability'
https://daosio.atlassian.net/browse/DAOS-16487

@tanabarr tanabarr requested review from mjmac and kjacque September 6, 2024 14:03
@daosbuild1
Copy link
Collaborator

Test stage Test RPMs on EL 8.6 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15087/1/execution/node/1162/log

@daosbuild1
Copy link
Collaborator

Test stage Functional on EL 8.8 completed with status FAILURE. https://build.hpdd.intel.com//job/daos-stack/job/daos/view/change-requests/job/PR-15087/1/execution/node/1183/log

Copy link
Contributor

@kjacque kjacque left a comment

Choose a reason for hiding this comment

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

Based on the test failures, it looks like some commands that should implement cmdConfigSetter currently aren't (i.e. the config isn't being loaded for them, but should have been). But I think your basic premise is correct, we shouldn't load a config unless the command implements a specific interface.

@tanabarr tanabarr requested a review from kjacque September 9, 2024 12:03
@tanabarr tanabarr changed the title DAOS-16487 control: Only load cfg for dmg commands that need it DAOS-16487 control: Only use hostlist from cfg on cfg-aware dmg cmds Sep 9, 2024
@tanabarr
Copy link
Contributor Author

tanabarr commented Sep 9, 2024

Gatekeeper please use the PR description and title as the commit message when landing, TIA

Feature: control
Required-githooks: true
Signed-off-by: Tom Nabarro <tom.nabarro@intel.com>
@tanabarr tanabarr force-pushed the tanabarr/control-dmg-cfg-load-dependent branch from b248cbc to 45246ef Compare September 9, 2024 13:06
Comment on lines +299 to +305
if cfgCmd, ok := cmd.(cmdConfigSetter); ok {
// Override hostlist with cli value if provided.
if hlCmd, ok := cmd.(hostListGetter); ok {
hl := hlCmd.getHostList()
if len(hl) > 0 {
ctlCfg.HostList = hl
}
Copy link
Contributor

@mjmac mjmac Sep 9, 2024

Choose a reason for hiding this comment

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

This seems pretty hard to understand to me. I would imagine that it will be even more perplexing in a few months. We already have the singleHostCmd type which could probably be reworked a little to make this use case clearer. For example, the type could have a new getHost() method and then you could define a singleHostGetter interface that could be used to drive the logic for setting the request's hostlist to that single host.

I think I understand the motivation behind maintaining the hostlist stuff in the implementation of the singleHostCmd (who knows, maybe I even advocated for it at the time), but with the benefit of hindsight and context, it just seems overly complicated and kind of confusing now. I wouldn't be opposed to refactoring it so that it is clearly the thing to be used for commands that only accept a single host.

Another change that I would recommend as part of that refactoring is to get rid of the logic in singleHostCmd.getHostList() that picks a default from either a hard-coded "localhost" or the first host in the hostlist. That kind of implicit behavior requires a lot of knowledge about the implementation in order to use it correctly, IMO. Instead, I'd suggest that if there is to be a default host, it should be explicitly set by the code that is using the type.

@kjacque: It looks like you added this type in #11815 ... What do you think about reworking it a bit to make the behavior and usage clearer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree that currently the implementation is not very clean, and I'm happy to take another pass based on this feedback and anything @kjacque has to add.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this isn't quite resolved by #15074 , updating singleHostCmd doesn't resolve the issue where hostlist can be pulled by the config in commands that don't explicitly require config usage

Copy link
Contributor

@kjacque kjacque left a comment

Choose a reason for hiding this comment

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

I don't have much further to add to Mike's comments, just one item below. I like how you handled the changes to singleHostCommand in your other PR.

if ctlCmd, ok := cmd.(ctlInvoker); ok {
ctlCmd.setInvoker(invoker)
}

// Handle the deprecated global hostlist flag
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like this is a bit out of order now -- should happen after the dealings with the config so it can override if necessary. Maybe it would be helpful to create a helper function that uses either of the command line flags, so they're processed together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants