diff --git a/pkg/common/cns-lib/vsphere/utils.go b/pkg/common/cns-lib/vsphere/utils.go index 673a3a210c..c9180d14d3 100644 --- a/pkg/common/cns-lib/vsphere/utils.go +++ b/pkg/common/cns-lib/vsphere/utils.go @@ -455,7 +455,7 @@ func GetCandidateDatastoresInCluster(ctx context.Context, vc *VirtualCenter, clu if len(sharedDatastores) == 0 && len(vsanDirectDatastores) == 0 { return nil, nil, fmt.Errorf("no candidates datastores found in the Kubernetes cluster") } - log.Infof("Found shared datastores: %+v and vSAN Direct datastores: %+v", sharedDatastores, + log.Debugf("Found shared datastores: %+v and vSAN Direct datastores: %+v", sharedDatastores, vsanDirectDatastores) return sharedDatastores, vsanDirectDatastores, nil } diff --git a/pkg/kubernetes/kubernetes.go b/pkg/kubernetes/kubernetes.go index 5a8805f0be..a27671edea 100644 --- a/pkg/kubernetes/kubernetes.go +++ b/pkg/kubernetes/kubernetes.go @@ -72,14 +72,14 @@ func GetKubeConfig(ctx context.Context) (*restclient.Config, error) { var err error kubecfgPath := getKubeConfigPath(ctx) if kubecfgPath != "" { - log.Infof("k8s client using kubeconfig from %s", kubecfgPath) + log.Debugf("k8s client using kubeconfig from %s", kubecfgPath) config, err = clientcmd.BuildConfigFromFlags("", kubecfgPath) if err != nil { log.Errorf("BuildConfigFromFlags failed %v", err) return nil, err } } else { - log.Info("k8s client using in-cluster config") + log.Debug("k8s client using in-cluster config") config, err = restclient.InClusterConfig() if err != nil { log.Errorf("InClusterConfig failed %v", err) @@ -102,24 +102,24 @@ func getKubeConfigPath(ctx context.Context) string { flagValue := kubecfgFlag.Value.String() if flagValue != "" { kubecfgPath = flagValue - log.Infof("Kubeconfig path obtained from kubeconfig flag: %q", kubecfgPath) + log.Debugf("Kubeconfig path obtained from kubeconfig flag: %q", kubecfgPath) } else { - log.Info("Kubeconfig flag is set but empty, checking environment variable value") + log.Debug("Kubeconfig flag is set but empty, checking environment variable value") } } else { - log.Info("Kubeconfig flag not set, checking environment variable value") + log.Debug("Kubeconfig flag not set, checking environment variable value") } if kubecfgPath == "" { // Get the Kubeconfig path from the environment variable kubecfgPath = os.Getenv(clientcmd.RecommendedConfigPathEnvVar) - log.Infof("Kubeconfig path obtained from environment variable %q: %q", + log.Debugf("Kubeconfig path obtained from environment variable %q: %q", clientcmd.RecommendedConfigPathEnvVar, kubecfgPath) } // Final logging of the Kubeconfig path used if kubecfgPath == "" { - log.Info("No Kubeconfig path found, either from environment variable or flag") + log.Debug("No Kubeconfig path found, either from environment variable or flag") } else { - log.Infof("Final Kubeconfig path used: %q", kubecfgPath) + log.Debugf("Final Kubeconfig path used: %q", kubecfgPath) } return kubecfgPath } @@ -431,7 +431,7 @@ func getClientThroughput(ctx context.Context, isSupervisorClient bool) (float32, burst = value } } - log.Infof("Setting client QPS to %f and Burst to %d.", qps, burst) + log.Debugf("Setting client QPS to %f and Burst to %d.", qps, burst) return qps, burst } diff --git a/pkg/syncer/fullsync.go b/pkg/syncer/fullsync.go index 871f6623ab..3de3108930 100644 --- a/pkg/syncer/fullsync.go +++ b/pkg/syncer/fullsync.go @@ -779,7 +779,7 @@ func validateAndCorrectVolumeInfoSnapshotDetails(ctx context.Context, continue } if cnsVol, ok := cnsVolumeMap[cnsvolumeinfo.Spec.VolumeID]; ok { - log.Infof("validate volume info for storage details for volume %s", cnsVol.VolumeId.Id) + log.Debugf("validate volume info for storage details for volume %s", cnsVol.VolumeId.Id) var aggregatedSnapshotCapacity int64 if cnsVol.BackingObjectDetails != nil && cnsVol.BackingObjectDetails.(*cnstypes.CnsBlockBackingDetails) != nil { @@ -787,12 +787,16 @@ func validateAndCorrectVolumeInfoSnapshotDetails(ctx context.Context, if ok { aggregatedSnapshotCapacity = val.AggregatedSnapshotCapacityInMb } - log.Infof("Received aggregatedSnapshotCapacity %d for volume %q", - aggregatedSnapshotCapacity, cnsVol.VolumeId.Id) + if aggregatedSnapshotCapacity > 0 { + log.Infof("Received aggregatedSnapshotCapacity %d for volume %q", + aggregatedSnapshotCapacity, cnsVol.VolumeId.Id) + } if cnsvolumeinfo.Spec.AggregatedSnapshotSize == nil || aggregatedSnapshotCapacity != cnsvolumeinfo.Spec.AggregatedSnapshotSize.Value() { // use current time as snapshot completion time is not available in fullsync. - log.Infof("Update aggregatedSnapshotCapacity for volume %q", cnsVol.VolumeId.Id) + log.Infof("Update aggregatedSnapshotCapacity for volume %q from %d to %d", + cnsVol.VolumeId.Id, cnsvolumeinfo.Spec.AggregatedSnapshotSize.Value(), + aggregatedSnapshotCapacity) currentTime := time.Now() cnsSnapInfo := &volumes.CnsSnapshotInfo{ SourceVolumeID: cnsvolumeinfo.Spec.VolumeID, @@ -1214,7 +1218,7 @@ func fullSyncGetVolumeSpecs(ctx context.Context, vCenterVersion string, pvList [ log.Infof("FullSync for VC %s: update is required for volume: %q", vc, volumeHandle) operationType = "updateVolume" } else { - log.Infof("FullSync for VC %s: update is not required for volume: %q", vc, volumeHandle) + log.Debugf("FullSync for VC %s: update is not required for volume: %q", vc, volumeHandle) } } switch operationType { diff --git a/pkg/syncer/storagepool/intended_state.go b/pkg/syncer/storagepool/intended_state.go index 7c7759f4b1..f5e7931bc3 100644 --- a/pkg/syncer/storagepool/intended_state.go +++ b/pkg/syncer/storagepool/intended_state.go @@ -217,7 +217,7 @@ func isRemoteVsan(ctx context.Context, dsprops *dsProps, return false, nil } - log.Infof("vSAN Datastore %s is remote to this cluster", dsprops.dsName) + log.Debugf("vSAN Datastore %s is remote to this cluster", dsprops.dsName) return true, nil } @@ -228,7 +228,7 @@ func newIntendedVsanSNAState(ctx context.Context, scWatchCntlr *StorageClassWatc nodes := make([]string, 0) nodes = append(nodes, node) - log.Infof("creating vsan sna sp %q", node) + log.Debugf("creating vsan sna sp %q", node) compatSC := make([]string, 0) for _, scName := range vsan.compatSC { if scWatchCntlr.isHostLocal(scName) { @@ -356,7 +356,7 @@ func (c *SpController) applyIntendedState(ctx context.Context, state *intendedSt } else { // StoragePool already exists, so Update it. We don't expect // ConflictErrors since updates are synchronized with a lock. - log.Infof("Updating StoragePool instance for %s", state.spName) + log.Debugf("Updating StoragePool instance for %s", state.spName) sp := state.updateUnstructuredStoragePool(ctx, sp) newSp, err := spClient.Resource(*spResource).Update(ctx, sp, metav1.UpdateOptions{}) if err != nil { diff --git a/pkg/syncer/storagepool/listener.go b/pkg/syncer/storagepool/listener.go index ec3d5c5efc..c3265635f3 100644 --- a/pkg/syncer/storagepool/listener.go +++ b/pkg/syncer/storagepool/listener.go @@ -122,7 +122,7 @@ func initListener(ctx context.Context, scWatchCntlr *StorageClassWatch, err := property.WaitForUpdatesEx(ctx, p, filter, func(updates []types.ObjectUpdate) bool { ctx := logger.NewContextWithLogger(ctx) log = logger.GetLogger(ctx) - log.Infof("Got %d property collector update(s)", len(updates)) + log.Debugf("Got %d property collector update(s)", len(updates)) reconcileAllScheduled := false for _, update := range updates { propChange := update.ChangeSet diff --git a/pkg/syncer/storagepool/util.go b/pkg/syncer/storagepool/util.go index f4f0c54e4d..6f1ff3fcb1 100644 --- a/pkg/syncer/storagepool/util.go +++ b/pkg/syncer/storagepool/util.go @@ -90,7 +90,7 @@ func getDatastoreProperties(ctx context.Context, d *cnsvsphere.DatastoreInfo) *d freeSpace: resource.NewQuantity(ds.Summary.FreeSpace, resource.DecimalSI), } - log.Infof("Datastore %s properties: %v", d.Info.Name, p) + log.Debugf("Datastore %s properties: %v", d.Info.Name, p) return &p }