Skip to content

Commit 5862089

Browse files
committed
fix: print IM pod log when state is error
Signed-off-by: Shuo Wu <shuo.wu@suse.com>
1 parent 769fb2b commit 5862089

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

controller/instance_manager_controller.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,12 @@ func (imc *InstanceManagerController) syncStatusWithPod(im *longhorn.InstanceMan
491491
}
492492
default:
493493
imc.logger.Warnf("Instance manager pod %v is in phase %s, updating the instance manager state from %s to error", im.Name, pod.Status.Phase, im.Status.CurrentState)
494+
495+
if podLog, err := imc.ds.GetPodContainerLog(im.Name, "instance-manager"); err != nil {
496+
log.WithError(err).Warnf("Failed to get pod log for instance manager %v", im.Name)
497+
} else {
498+
log.Warnf("Instance manager pod %v is in phase %s, pod log: %s", im.Name, pod.Status.Phase, string(podLog))
499+
}
494500
im.Status.CurrentState = longhorn.InstanceManagerStateError
495501
}
496502

0 commit comments

Comments
 (0)