Skip to content

Commit

Permalink
fix(logging): make RPC call to instance-manager to set log level
Browse files Browse the repository at this point in the history
Signed-off-by: James Munson <[email protected]>
  • Loading branch information
james-munson committed Nov 19, 2024
1 parent 4864291 commit 5215c8d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions controller/instance_manager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,10 +521,6 @@ func (imc *InstanceManagerController) isDateEngineCPUMaskApplied(im *longhorn.In
}

func (imc *InstanceManagerController) syncLogSettingsToInstanceManagerPod(im *longhorn.InstanceManager) error {
if types.IsDataEngineV1(im.Spec.DataEngine) {
return nil
}

if im.Status.CurrentState != longhorn.InstanceManagerStateRunning {
return nil
}
Expand All @@ -535,6 +531,21 @@ func (imc *InstanceManagerController) syncLogSettingsToInstanceManagerPod(im *lo
}
defer client.Close()

if types.IsDataEngineV1(im.Spec.DataEngine) {
settingName := types.SettingNameLogLevel
setting, err := imc.ds.GetSettingWithAutoFillingRO(settingName)
if err != nil {
return err
}

err = client.LogSetLevel(longhorn.DataEngineTypeV1, "", setting.Value)
if err != nil {
return errors.Wrapf(err, "failed to set instance-manager log level from %v", settingName)
}

return nil
}

settingNames := []types.SettingName{
types.SettingNameV2DataEngineLogLevel,
types.SettingNameV2DataEngineLogFlags,
Expand Down

0 comments on commit 5215c8d

Please sign in to comment.