-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MGMT-3026 - invoke fio from installcmd
- Invoke fio_perf_check agent command as part of installcmd flow. - Handled error in inventory (handleReplyError) by looking for a specific fio exit code (FioPerfCheckCmdExitCode).
- Loading branch information
1 parent
cd1bd81
commit cde25bb
Showing
17 changed files
with
492 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package host | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/openshift/assisted-service/models" | ||
"github.com/sirupsen/logrus" | ||
) | ||
|
||
const ( | ||
FioPerfCheckCmdExitCode int64 = 222 | ||
FioDurationThreshold int64 = 20 | ||
) | ||
|
||
type fioPerfCheckCmd struct { | ||
baseCmd | ||
fioPerfCheckImage string | ||
path string | ||
durationThreshold int64 | ||
} | ||
|
||
func NewFioPerfCheckCmd(log logrus.FieldLogger, fioPerfCheckImage string, path string, durationThreshold int64) *fioPerfCheckCmd { | ||
return &fioPerfCheckCmd{ | ||
baseCmd: baseCmd{log: log}, | ||
fioPerfCheckImage: fioPerfCheckImage, | ||
path: path, | ||
durationThreshold: durationThreshold, | ||
} | ||
} | ||
|
||
func (c *fioPerfCheckCmd) GetSteps(ctx context.Context, host *models.Host) ([]*models.Step, error) { | ||
args, err := c.GetArgs() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
step := &models.Step{ | ||
StepType: models.StepTypeFioPerfCheck, | ||
Command: "podman", | ||
Args: args, | ||
} | ||
return []*models.Step{step}, nil | ||
} | ||
|
||
func (c *fioPerfCheckCmd) GetArgs() ([]string, error) { | ||
exitCode := FioPerfCheckCmdExitCode | ||
request := models.FioPerfCheckRequest{ | ||
Path: &c.path, | ||
DurationThreshold: &c.durationThreshold, | ||
ExitCode: &exitCode, | ||
} | ||
requestBytes, err := json.Marshal(request) | ||
if err != nil { | ||
c.log.WithError(err).Errorf("failed to marshal FioPerfCheckRequest") | ||
return nil, err | ||
} | ||
|
||
return []string{ | ||
"run", "--privileged", "--net=host", "--rm", "--quiet", | ||
"-v", "/dev:/dev:rw", | ||
"-v", "/var/log:/var/log", | ||
"-v", "/run/systemd/journal/socket:/run/systemd/journal/socket", | ||
c.fioPerfCheckImage, | ||
"fio_perf_check", | ||
strconv.Quote(string(requestBytes)), | ||
}, nil | ||
} | ||
|
||
func (c *fioPerfCheckCmd) GetCommandString() string { | ||
args, err := c.GetArgs() | ||
if err != nil { | ||
return "" | ||
} | ||
|
||
return fmt.Sprintf("podman %s && ", strings.Join(args, " ")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.