From 5215c8d49033afac9cd59b28d8407b44dc9609c0 Mon Sep 17 00:00:00 2001 From: James Munson Date: Tue, 19 Nov 2024 13:37:56 -0700 Subject: [PATCH] fix(logging): make RPC call to instance-manager to set log level Signed-off-by: James Munson --- controller/instance_manager_controller.go | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/controller/instance_manager_controller.go b/controller/instance_manager_controller.go index 7ad59550cc..c5391bff64 100644 --- a/controller/instance_manager_controller.go +++ b/controller/instance_manager_controller.go @@ -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 } @@ -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,