Skip to content

Commit

Permalink
Move some debug level messages to info level
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit committed Jul 10, 2023
1 parent a9d6289 commit caa35b4
Show file tree
Hide file tree
Showing 20 changed files with 59 additions and 59 deletions.
16 changes: 8 additions & 8 deletions app/recurring_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func (job *Job) doSnapshotCleanup(backupDone bool) (err error) {
}); err != nil {
return err
}
job.logger.Debugf("Cleaned up snapshot CR %v for %v", snapshotName, volumeName)
job.logger.Infof("Cleaned up snapshot CR %v for %v", snapshotName, volumeName)
}

if job.task == longhorn.RecurringJobTypeSnapshotCleanup {
Expand Down Expand Up @@ -471,7 +471,7 @@ func (job *Job) deleteSnapshots(names []string, volume *longhornclient.Volume, v
if err != nil {
return err
}
job.logger.WithField("volume", volume.Name).Debugf("Deleted snapshot %v", name)
job.logger.WithField("volume", volume.Name).Infof("Deleted snapshot %v", name)
}
return nil
}
Expand Down Expand Up @@ -626,9 +626,9 @@ func (job *Job) doRecurringBackup() (err error) {
switch info.State {
case string(longhorn.BackupStateCompleted):
complete = true
job.logger.Debugf("Complete creating backup %v", info.Id)
job.logger.Infof("Completed creating backup %v", info.Id)
case string(longhorn.BackupStateNew), string(longhorn.BackupStateInProgress):
job.logger.Debugf("Creating backup %v, current progress %v", info.Id, info.Progress)
job.logger.Infof("Creating backup %v, current progress %v", info.Id, info.Progress)
case string(longhorn.BackupStateError), string(longhorn.BackupStateUnknown):
return fmt.Errorf("failed to create backup %v: %v", info.Id, info.Error)
default:
Expand Down Expand Up @@ -663,7 +663,7 @@ func (job *Job) doRecurringBackup() (err error) {
}); err != nil {
return fmt.Errorf("cleaned up backup %v failed for %v: %v", backup, job.volumeName, err)
}
job.logger.Debugf("Cleaned up backup %v for %v", backup, job.volumeName)
job.logger.Infof("Cleaned up backup %v for %v", backup, job.volumeName)
}

if err := job.doSnapshotCleanup(true); err != nil {
Expand Down Expand Up @@ -865,7 +865,7 @@ func filterVolumesForJob(allowDetached bool, volumes []longhorn.Volume, filterNa
}

if volume.Status.RestoreRequired {
logger.Debugf("Bypassed to create job for %v volume during restoring from the backup", volume.Name)
logger.Infof("Bypassed to create job for %v volume during restoring from the backup", volume.Name)
continue
}

Expand All @@ -874,7 +874,7 @@ func filterVolumesForJob(allowDetached bool, volumes []longhorn.Volume, filterNa
*filterNames = append(*filterNames, volume.Name)
continue
}
logger.Debugf("Cannot create job for %v volume in state %v", volume.Name, volume.Status.State)
logger.Warnf("Cannot create job for %v volume in state %v", volume.Name, volume.Status.State)
}
}

Expand All @@ -883,7 +883,7 @@ func getVolumesBySelector(recurringJobType, recurringJobName, namespace string,

label := fmt.Sprintf("%s=%s",
types.GetRecurringJobLabelKey(recurringJobType, recurringJobName), types.LonghornLabelValueEnabled)
logger.Debugf("Get volumes from label %v", label)
logger.Infof("Got volumes from label %v", label)

volumes, err := client.LonghornV1beta2().Volumes(namespace).List(context.TODO(), metav1.ListOptions{
LabelSelector: label,
Expand Down
6 changes: 3 additions & 3 deletions controller/kubernetes_pod_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func (kc *KubernetesPodController) getAssociatedVolumes(pod *v1.Pod) ([]*longhor

pvc, err := kc.ds.GetPersistentVolumeClaimRO(pod.Namespace, v.VolumeSource.PersistentVolumeClaim.ClaimName)
if datastore.ErrorIsNotFound(err) {
log.WithError(err).Debugf("Cannot auto-delete Pod when the associated PersistentVolumeClaim is not found")
log.WithError(err).Warn("Cannot auto-delete Pod when the associated PersistentVolumeClaim is not found")
continue
}
if err != nil {
Expand All @@ -448,7 +448,7 @@ func (kc *KubernetesPodController) getAssociatedVolumes(pod *v1.Pod) ([]*longhor

pv, err := kc.getAssociatedPersistentVolume(pvc)
if datastore.ErrorIsNotFound(err) {
log.WithError(err).Debugf("Cannot auto-delete Pod when the associated PersistentVolume is not found")
log.WithError(err).Warn("Cannot auto-delete Pod when the associated PersistentVolume is not found")
continue
}
if err != nil {
Expand All @@ -458,7 +458,7 @@ func (kc *KubernetesPodController) getAssociatedVolumes(pod *v1.Pod) ([]*longhor
if pv.Spec.CSI != nil && pv.Spec.CSI.Driver == types.LonghornDriverName {
vol, err := kc.ds.GetVolume(pv.GetName())
if datastore.ErrorIsNotFound(err) {
log.WithError(err).Debugf("Cannot auto-delete Pod when the associated Volume is not found")
log.WithError(err).Warn("Cannot auto-delete Pod when the associated Volume is not found")
continue
}
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion controller/monitor/snapshot_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (m *SnapshotMonitor) shouldAddToInProgressSnapshotCheckTasks(snapshotName s

_, ok := m.inProgressSnapshotCheckTasks[snapshotName]
if ok {
m.logger.WithField("monitor", monitorName).Debugf("snapshot %s is being checked", snapshotName)
m.logger.WithField("monitor", monitorName).Infof("snapshot %s is being checked", snapshotName)
return false
}
m.inProgressSnapshotCheckTasks[snapshotName] = struct{}{}
Expand Down
12 changes: 6 additions & 6 deletions controller/setting_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1271,13 +1271,13 @@ func (info *ClusterInfo) collectResourceUsage() error {
MatchLabels: label,
})
if err != nil {
logrus.WithError(err).Debugf("Failed to get %v label for %v", label, component)
logrus.WithError(err).Warnf("Failed to get %v label for %v", label, component)
continue
}

pods, err := info.ds.ListPodsBySelector(selector)
if err != nil {
logrus.WithError(err).Debugf("Failed to list %v Pod by %v label", component, label)
logrus.WithError(err).Warnf("Failed to list %v Pod by %v label", component, label)
continue
}
podCount := len(pods)
Expand All @@ -1291,7 +1291,7 @@ func (info *ClusterInfo) collectResourceUsage() error {
for _, pod := range pods {
podMetrics, err := metricsClient.PodMetricses(info.namespace).Get(context.TODO(), pod.Name, metav1.GetOptions{})
if err != nil && !apierrors.IsNotFound(err) {
logrus.WithError(err).Debugf("Failed to get %v Pod", pod.Name)
logrus.WithError(err).Warnf("Failed to get %v Pod", pod.Name)
continue
}
for _, container := range podMetrics.Containers {
Expand Down Expand Up @@ -1393,7 +1393,7 @@ func (info *ClusterInfo) collectSettings() error {
case include[settingName]:
convertedValue, err := info.convertSettingValueType(setting)
if err != nil {
logrus.WithError(err).Debugf("failed to convert Setting %v value", setting.Name)
logrus.WithError(err).Warnf("Failed to convert Setting %v value", setting.Name)
continue
}
settingMap[setting.Name] = convertedValue
Expand Down Expand Up @@ -1549,7 +1549,7 @@ func (info *ClusterInfo) collectSettingInVolume(volumeSpecValue, ignoredValue st
if volumeSpecValue == ignoredValue {
globalSetting, err := info.ds.GetSetting(settingName)
if err != nil {
info.logger.WithError(err).Debugf("Failed to get Longhorn Setting %v", settingName)
info.logger.WithError(err).Warnf("Failed to get Longhorn Setting %v", settingName)
}
return globalSetting.Value
}
Expand Down Expand Up @@ -1612,7 +1612,7 @@ func (info *ClusterInfo) collectNodeDiskCount() error {
for _, disk := range node.Spec.Disks {
deviceType, err := types.GetDeviceTypeOf(disk.Path)
if err != nil {
info.logger.WithError(err).Debugf("Failed to get device type of %v", disk.Path)
info.logger.WithError(err).Warnf("Failed to get device type of %v", disk.Path)
deviceType = types.ValueUnknown
}
structMap[util.StructName(fmt.Sprintf(ClusterInfoNodeDiskCountFmt, strings.ToUpper(deviceType)))]++
Expand Down
4 changes: 2 additions & 2 deletions controller/volume_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,7 @@ func (c *VolumeController) replenishReplicas(v *longhorn.Volume, e *longhorn.Eng
rs[reusableFailedReplica.Name] = reusableFailedReplica
continue
}
log.Debugf("Failed to reuse failed replica %v immediately, backoff period is %v now",
log.Warnf("Failed to reuse failed replica %v immediately, backoff period is %v now",
reusableFailedReplica.Name, c.backoff.Get(reusableFailedReplica.Name).Seconds())
// Couldn't reuse the replica. Add the volume back to the workqueue to check it later
c.enqueueVolumeAfter(v, c.backoff.Get(reusableFailedReplica.Name))
Expand Down Expand Up @@ -2494,7 +2494,7 @@ func (c *VolumeController) getIsSchedulableToDiskNodes(v *longhorn.Volume, nodeN
// TODO: record the message to condition
log.Warn("Found 0 node has at least one schedulable disk")
} else {
log.Debugf("Found node %v has at least one schedulable disk", schedulableNodeNames)
log.Infof("Found node %v has at least one schedulable disk", schedulableNodeNames)
}
}()

Expand Down
4 changes: 2 additions & 2 deletions csi/crypto/crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func EncryptVolume(devicePath, passphrase string, cryptoParams *EncryptParams) e
// OpenVolume opens volume so that it can be used by the client.
func OpenVolume(volume, devicePath, passphrase string) error {
if isOpen, _ := IsDeviceOpen(VolumeMapper(volume)); isOpen {
logrus.Debugf("Device %s is already opened at %s", devicePath, VolumeMapper(volume))
logrus.Infof("Device %s is already opened at %s", devicePath, VolumeMapper(volume))
return nil
}

Expand Down Expand Up @@ -121,7 +121,7 @@ func DeviceEncryptionStatus(devicePath string) (mappedDevice, mapper string, err
volume := strings.TrimPrefix(devicePath, mapperFilePathPrefix+"/")
stdout, err := luksStatus(volume)
if err != nil {
logrus.WithError(err).Debugf("Device %s is not an active LUKS device", devicePath)
logrus.WithError(err).Warnf("Device %s is not an active LUKS device", devicePath)
return devicePath, "", nil
}
lines := strings.Split(string(stdout), "\n")
Expand Down
2 changes: 1 addition & 1 deletion csi/deployment_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ func deploy(kubeClient *clientset.Clientset, obj runtime.Object, resource string
existingMeta.GetDeletionTimestamp() == nil &&
!needToUpdateImage(existing, obj) {
// deployment of correct version already deployed
logrus.Debugf("Detected %v %v CSI Git commit %v version %v Kubernetes version %v has already been deployed",
logrus.Infof("Detected %v %v CSI Git commit %v version %v Kubernetes version %v has already been deployed",
resource, name, annos[AnnotationCSIGitCommit], annos[AnnotationCSIVersion], annos[AnnotationKubernetesVersion])
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions csi/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ func syncMountPointDirectory(targetPath string) error {
// in case where the mount point exists but is corrupt, the mount point will be cleaned up and a error is returned
// the underlying implementation utilizes mounter.IsLikelyNotMountPoint so it cannot detect bind mounts
func ensureMountPoint(targetPath string, mounter mount.Interface) (bool, error) {
logrus.Debugf("Trying to ensure mount point %v", targetPath)
logrus.Infof("Trying to ensure mount point %v", targetPath)
notMnt, err := mount.IsNotMountPoint(mounter, targetPath)
if os.IsNotExist(err) {
return false, os.MkdirAll(targetPath, 0750)
}

IsCorruptedMnt := mount.IsCorruptedMnt(err)
if !IsCorruptedMnt {
logrus.Debugf("Mount point %v try opening and syncing dir to make sure it's healthy", targetPath)
logrus.Infof("Mount point %v try opening and syncing dir to make sure it's healthy", targetPath)
if err := syncMountPointDirectory(targetPath); err != nil {
logrus.WithError(err).Warnf("Mount point %v was identified as corrupt by opening and syncing", targetPath)
IsCorruptedMnt = true
Expand All @@ -317,10 +317,10 @@ func unmount(targetPath string, mounter mount.Interface) error {

forceUnmounter, ok := mounter.(mount.MounterForceUnmounter)
if ok {
logrus.Debugf("Trying to force unmount potential mount point %v", targetPath)
logrus.Infof("Trying to force unmount potential mount point %v", targetPath)
err = forceUnmounter.UnmountWithForce(targetPath, defaultForceUmountTimeout)
} else {
logrus.Debugf("Trying to unmount potential mount point %v", targetPath)
logrus.Infof("Trying to unmount potential mount point %v", targetPath)
err = mounter.Unmount(targetPath)
}
if err == nil {
Expand Down
10 changes: 5 additions & 5 deletions datastore/longhorn.go
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ func (s *DataStore) AddRecurringJobLabelToVolume(volume *longhorn.Volume, labelK
if err != nil {
return nil, err
}
logrus.Debugf("Added volume %v recurring job label %v", volume.Name, labelKey)
logrus.Infof("Added volume %v recurring job label %v", volume.Name, labelKey)
}
return volume, nil
}
Expand All @@ -814,7 +814,7 @@ func (s *DataStore) RemoveRecurringJobLabelFromVolume(volume *longhorn.Volume, l
if err != nil {
return nil, err
}
logrus.Debugf("Removed volume %v recurring job label %v", volume.Name, labelKey)
logrus.Infof("Removed volume %v recurring job label %v", volume.Name, labelKey)
}
return volume, nil
}
Expand Down Expand Up @@ -1545,7 +1545,7 @@ func (s *DataStore) CheckEngineImageReadiness(image string, nodes ...string) (is
}
}
if len(undeployedNodes) > 0 {
logrus.Debugf("CheckEngineImageReadiness: nodes %v don't have the engine image %v", undeployedNodes, image)
logrus.Infof("CheckEngineImageReadiness: nodes %v don't have the engine image %v", undeployedNodes, image)
return false, nil
}
return true, nil
Expand Down Expand Up @@ -2336,7 +2336,7 @@ func (s *DataStore) ListReadyNodesWithEngineImage(image string) (map[string]*lon
// GetRandomReadyNode gets a list of all Node in the given namespace and
// returns the first Node marked with condition ready and allow scheduling
func (s *DataStore) GetRandomReadyNode() (*longhorn.Node, error) {
logrus.Debugf("Prepare to find a random ready node")
logrus.Infof("Prepare to find a random ready node")
nodesRO, err := s.ListNodesRO()
if err != nil {
return nil, errors.Wrapf(err, "failed to get random ready node")
Expand All @@ -2355,7 +2355,7 @@ func (s *DataStore) GetRandomReadyNode() (*longhorn.Node, error) {
// GetRandomReadyNodeDisk a list of all Node the in the given namespace and
// returns the first Node && the first Disk of the Node marked with condition ready and allow scheduling
func (s *DataStore) GetRandomReadyNodeDisk() (*longhorn.Node, string, error) {
logrus.Debugf("Preparing to find a random ready node disk")
logrus.Infof("Preparing to find a random ready node disk")
nodesRO, err := s.ListNodesRO()
if err != nil {
return nil, "", errors.Wrapf(err, "failed to get random ready node disk")
Expand Down
6 changes: 3 additions & 3 deletions engineapi/snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (e *EngineBinary) SnapshotPurge(*longhorn.Engine) error {
if _, err := e.ExecuteEngineBinaryWithoutTimeout([]string{}, "snapshot", "purge", "--skip-if-in-progress"); err != nil {
return errors.Wrapf(err, "error starting snapshot purge")
}
logrus.Debugf("Volume %v snapshot purge started", e.Name())
logrus.Infof("Volume %v snapshot purge started", e.Name())
return nil
}

Expand All @@ -110,7 +110,7 @@ func (e *EngineBinary) SnapshotClone(engine *longhorn.Engine, snapshotName, from
if _, err := e.ExecuteEngineBinaryWithoutTimeout([]string{}, args...); err != nil {
return errors.Wrapf(err, "error starting snapshot clone")
}
logrus.Debugf("Cloned snapshot %v from volume %v to volume %v", snapshotName, fromControllerAddress, e.cURL)
logrus.Infof("Cloned snapshot %v from volume %v to volume %v", snapshotName, fromControllerAddress, e.cURL)
return nil
}

Expand Down Expand Up @@ -144,7 +144,7 @@ func (e *EngineBinary) SnapshotHash(engine *longhorn.Engine, snapshotName string
return errors.Wrapf(err, "error starting hashing snapshot")
}

logrus.Debugf("Volume %v snapshot hashing started", e.Name())
logrus.Infof("Volume %v snapshot hashing started", e.Name())
return nil
}

Expand Down
8 changes: 4 additions & 4 deletions manager/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (m *VolumeManager) CreateSnapshot(snapshotName string, labels map[string]st
return nil, fmt.Errorf("cannot found just created snapshot '%s', for volume '%s'", snapshotName, volumeName)
}

logrus.Debugf("Created snapshot %v with labels %+v for volume %v", snapshotName, labels, volumeName)
logrus.Infof("Created snapshot %v with labels %+v for volume %v", snapshotName, labels, volumeName)
return snap, nil
}

Expand Down Expand Up @@ -152,7 +152,7 @@ func (m *VolumeManager) DeleteSnapshot(snapshotName, volumeName string) error {
return err
}

logrus.Debugf("Deleted snapshot %v for volume %v", snapshotName, volumeName)
logrus.Infof("Deleted snapshot %v for volume %v", snapshotName, volumeName)
return nil
}

Expand Down Expand Up @@ -198,7 +198,7 @@ func (m *VolumeManager) RevertSnapshot(snapshotName, volumeName string) error {
return err
}

logrus.Debugf("Revert to snapshot %v for volume %v", snapshotName, volumeName)
logrus.Infof("Reverted to snapshot %v for volume %v", snapshotName, volumeName)
return nil
}

Expand Down Expand Up @@ -231,7 +231,7 @@ func (m *VolumeManager) PurgeSnapshot(volumeName string) error {
return err
}

logrus.Debugf("Started snapshot purge for volume %v", volumeName)
logrus.Infof("Started snapshot purge for volume %v", volumeName)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions manager/engineimage.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (m *VolumeManager) CreateEngineImage(image string) (*longhorn.EngineImage,
if err != nil {
return nil, err
}
logrus.Debugf("Created engine image %v (%v)", ei.Name, ei.Spec.Image)
logrus.Infof("Created engine image %v (%v)", ei.Name, ei.Spec.Image)
return ei, nil
}

Expand All @@ -92,7 +92,7 @@ func (m *VolumeManager) DeleteEngineImageByName(name string) error {
if err := m.ds.DeleteEngineImage(name); err != nil {
return err
}
logrus.Debugf("Deleted engine image %v (%v)", ei.Name, ei.Spec.Image)
logrus.Infof("Deleted engine image %v (%v)", ei.Name, ei.Spec.Image)
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions manager/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (m *VolumeManager) PVCreate(name, pvName, fsType, secretNamespace, secretNa
return nil, err
}

logrus.Debugf("Created PV for volume %v: %+v", v.Name, v.Spec)
logrus.Infof("Created PV for volume %v: %+v", v.Name, v.Spec)
return v, nil
}

Expand Down Expand Up @@ -136,7 +136,7 @@ func (m *VolumeManager) PVCCreate(name, namespace, pvcName string) (v *longhorn.
return nil, err
}

logrus.Debugf("Created PVC for volume %v: %+v", v.Name, v.Spec)
logrus.Infof("Created PVC for volume %v: %+v", v.Name, v.Spec)
return v, nil
}

Expand Down
6 changes: 3 additions & 3 deletions manager/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (m *VolumeManager) UpdateNode(n *longhorn.Node) (*longhorn.Node, error) {
if err != nil {
return nil, err
}
logrus.Debugf("Updated node %v to %+v", node.Spec.Name, node.Spec)
logrus.Infof("Updated node %v to %+v", node.Spec.Name, node.Spec)
return node, nil
}

Expand Down Expand Up @@ -113,7 +113,7 @@ func (m *VolumeManager) DiskUpdate(name string, updateDisks map[string]longhorn.
if err != nil {
return nil, err
}
logrus.Debugf("Updated node disks of %v to %+v", name, node.Spec.Disks)
logrus.Infof("Updated node disks of %v to %+v", name, node.Spec.Disks)
return node, nil
}

Expand Down Expand Up @@ -143,6 +143,6 @@ func (m *VolumeManager) DeleteNode(name string) error {
if err := m.ds.DeleteNode(name); err != nil {
return err
}
logrus.Debugf("Deleted node %v", name)
logrus.Infof("Deleted node %v", name)
return nil
}
Loading

0 comments on commit caa35b4

Please sign in to comment.