-
Notifications
You must be signed in to change notification settings - Fork 217
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
MGMT-3026 - invoke fio from installcmd #806
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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, " ")) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,7 @@ type InstructionConfig struct { | |
DhcpLeaseAllocatorImage string `envconfig:"DHCP_LEASE_ALLOCATOR_IMAGE" default:"quay.io/ocpmetal/assisted-installer-agent:latest"` | ||
APIVIPConnectivityCheckImage string `envconfig:"API_VIP_CONNECTIVITY_CHECK_IMAGE" default:"quay.io/ocpmetal/assisted-installer-agent:latest"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to add to openshift/template.yaml There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
NtpSynchronizerImage string `envconfig:"NTP_SYNCHRONIZER_IMAGE" default:"quay.io/ocpmetal/assisted-installer-agent:latest"` | ||
FioPerfCheckImage string `envconfig:"FIO_PERF_CHECK_IMAGE" default:"quay.io/ocpmetal/assisted-installer-agent:latest"` | ||
SkipCertVerification bool `envconfig:"SKIP_CERT_VERIFICATION" default:"false"` | ||
SupportL2 bool `envconfig:"SUPPORT_L2" default:"true"` | ||
InstallationTimeout uint `envconfig:"INSTALLATION_TIMEOUT" default:"0"` | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it the same as
HandleInstallationFailure
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It adds the reason string.