Skip to content

Commit

Permalink
setting: set v2-data-engine-log-flags to "all" if not assigned
Browse files Browse the repository at this point in the history
Set v2-data-engine-log-flags to "all" (enable all component logs) if
it is not assigned.

Longhorn 7939

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit authored and innobead committed Mar 11, 2024
1 parent b3887a9 commit dc32122
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions controller/instance_manager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1246,24 +1246,21 @@ func (imc *InstanceManagerController) createInstanceManagerPodSpec(im *longhorn.
podSpec.Spec.Containers[0].Name = "instance-manager"

if datastore.IsDataEngineV2(dataEngine) {
logLevelSetting, err := imc.ds.GetSettingWithAutoFillingRO(types.SettingNameV2DataEngineLogLevel)
if err != nil {
return nil, err
}

// spdk_tgt doesn't support log level option, so we don't need to pass the log level to the instance manager.
// The log level will be applied in the reconciliation of instance manager controller.
logFlagsSetting, err := imc.ds.GetSettingWithAutoFillingRO(types.SettingNameV2DataEngineLogFlags)
if err != nil {
return nil, err
}

logLevel := strings.ToLower(logLevelSetting.Value)
logFlags := strings.ToLower(logFlagsSetting.Value)

args := []string{"instance-manager"}
if logLevel == "debug" {
args = append(args, "--spdk-log", logFlags)
logFlags := "all"
if logFlagsSetting.Value != "" {
logFlags = strings.ToLower(logFlagsSetting.Value)
}
args = append(args, "--enable-spdk", "--debug", "daemon", "--spdk-enabled", "--listen", fmt.Sprintf("0.0.0.0:%d", engineapi.InstanceManagerProcessManagerServiceDefaultPort))

args := []string{
"instance-manager", "--spdk-log", logFlags, "--enable-spdk", "--debug",
"daemon", "--spdk-enabled", "--listen", fmt.Sprintf("0.0.0.0:%d", engineapi.InstanceManagerProcessManagerServiceDefaultPort)}

podSpec.Spec.Containers[0].Args = args

Expand Down

0 comments on commit dc32122

Please sign in to comment.