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-16312 control: Always use --force for dmg system stop #15799

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/control/cmd/dmg/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (cmd *systemEraseCmd) Execute(_ []string) error {
// systemStopCmd is the struct representing the command to shutdown DAOS system.
type systemStopCmd struct {
baseRankListCmd
Force bool `long:"force" description:"Force stop DAOS system members"`
Force bool `long:"force" description:"Currently ignored"`
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO this changed line isn't helpful. It will have to be changed back, and it doesn't really tell the admin anything useful. "Oh, it's ignored? So then force stop doesn't work? Well then, how do I forcibly stop the system?"

You can see how this change may have the opposite effect to what you intended... I think the description should be the same and the flag should just be a no-op so that everyone doesn't have to change their scripts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will revert the change

}

// Execute is run when systemStopCmd activates.
Expand All @@ -191,7 +191,8 @@ func (cmd *systemStopCmd) Execute(_ []string) (errOut error) {
if err := cmd.validateHostsRanks(); err != nil {
return err
}
req := &control.SystemStopReq{Force: cmd.Force}
// DAOS-16312: Always use force when stopping ranks.
req := &control.SystemStopReq{Force: true}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not the best place to make this change. It means that only dmg users will benefit from it. Control API users will not. Better to just set it in the SystemStop RPC invoker. As an added benefit, changing it there will minimize the blast radius of this change, so that you don't have to modify the dmg tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, done

req.Hosts.Replace(&cmd.Hosts.HostSet)
req.Ranks.Replace(&cmd.Ranks.RankSet)

Expand Down
11 changes: 7 additions & 4 deletions src/control/cmd/dmg/system_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestDmg_SystemCommands(t *testing.T) {
"system stop with no arguments",
"system stop",
strings.Join([]string{
printRequest(t, &control.SystemStopReq{}),
printRequest(t, &control.SystemStopReq{Force: true}),
}, " "),
nil,
},
Expand All @@ -169,23 +169,26 @@ func TestDmg_SystemCommands(t *testing.T) {
"system stop with single rank",
"system stop --ranks 0",
strings.Join([]string{
printRequest(t, withRanks(&control.SystemStopReq{}, 0)),
printRequest(t, withRanks(&control.SystemStopReq{Force: true}, 0)),
}, " "),
nil,
},
{
"system stop with multiple ranks",
"system stop --ranks 0,1,4",
strings.Join([]string{
printRequest(t, withRanks(&control.SystemStopReq{}, 0, 1, 4)),
printRequest(t,
withRanks(&control.SystemStopReq{Force: true}, 0, 1, 4)),
}, " "),
nil,
},
{
"system stop with multiple hosts",
"system stop --rank-hosts bar9,foo-[0-100]",
strings.Join([]string{
printRequest(t, withHosts(&control.SystemStopReq{}, "foo-[0-100]", "bar9")),
printRequest(t,
withHosts(&control.SystemStopReq{Force: true},
"foo-[0-100]", "bar9")),
}, " "),
nil,
},
Expand Down
6 changes: 4 additions & 2 deletions src/control/server/mgmt_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -902,8 +902,10 @@ func (svc *mgmtSvc) SystemStop(ctx context.Context, req *mgmtpb.SystemStopReq) (
return nil, err
}

// First phase: Prepare the ranks for shutdown, but only if the request
// is for an unforced full system stop.
// First phase: Prepare the ranks for shutdown, but only if the request is for an unforced
// full system stop.
// DAOS-16312: Note that if force is always specified in request, PrepShutdown will never
// be called.
if fReq.FullSystem && !fReq.Force {
fReq.Method = control.PrepShutdownRanks
fResp, _, err = svc.rpcFanout(ctx, fReq, fResp, true)
Expand Down
Loading