Skip to content

Commit 4a4baaf

Browse files
committed
++ linter
++ cleanup additional logging Signed-off-by: Ivan Mikheykin <ivan.mikheykin@flant.com>
1 parent a11079d commit 4a4baaf

2 files changed

Lines changed: 1 addition & 20 deletions

File tree

images/virtualization-artifact/pkg/controller/vm/internal/sync_kvvm.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -259,24 +259,16 @@ func (h *SyncKvvmHandler) isWaiting(vm *v1alpha2.VirtualMachine) bool {
259259
}
260260

261261
func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineState, allChanges vmchange.SpecChanges) (bool, error) {
262-
log := logger.FromContext(ctx)
263-
264-
log.Info("syncKVVM: start")
265262
if s.VirtualMachine().IsEmpty() {
266-
log.Info("syncKVVM: got empty VM, return")
267263
return false, fmt.Errorf("the virtual machine is empty, please report a bug")
268264
}
269265

270-
log.Info("syncKVVM: vm non-empty")
271-
272266
kvvm, err := s.KVVM(ctx)
273267
if err != nil {
274268
return false, fmt.Errorf("find the internal virtual machine: %w", err)
275269
}
276270

277271
if kvvm == nil {
278-
log.Info("syncKVVM: got empty KVVM, create a new one")
279-
280272
err = h.createKVVM(ctx, s)
281273
if err != nil {
282274
return false, fmt.Errorf("create the internal virtual machine: %w", err)
@@ -285,8 +277,6 @@ func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineSt
285277
return true, nil
286278
}
287279

288-
log.Info("syncKVVM: got non-empty KVVM, synchronize")
289-
290280
kvvmi, err := s.KVVMI(ctx)
291281
if err != nil {
292282
return false, fmt.Errorf("find the internal virtual machine instance: %w", err)
@@ -301,8 +291,6 @@ func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineSt
301291
// When a KVVM is created with conflicting placement rules and cannot be scheduled,
302292
// it remains unschedulable even if these rules are changed or removed.
303293
case h.isVMUnschedulable(s.VirtualMachine().Current(), kvvm) && h.isPlacementPolicyChanged(allChanges):
304-
log.Info("syncKVVM: detect KVVM is Unschedulable, update KVVM")
305-
306294
err := h.updateKVVM(ctx, s)
307295
if err != nil {
308296
return false, fmt.Errorf("failed to update internal virtual machine: %w", err)
@@ -313,8 +301,6 @@ func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineSt
313301
}
314302
return true, nil
315303
case h.isVMStopped(s.VirtualMachine().Current(), kvvm, pod):
316-
log.Info("syncKVVM: detect KVVM is Stopped, update KVVM")
317-
318304
// KVVM should be updated when VM become stopped.
319305
// It is safe to update KVVM at this point in general and also all related resources
320306
// can be changed during the restoration process: e.g. VirtualDisks, VMIPs, etc.
@@ -326,8 +312,6 @@ func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineSt
326312
}
327313
return true, nil
328314
case h.hasNoneDisruptiveChanges(s.VirtualMachine().Current(), kvvm, kvvmi, allChanges):
329-
log.Info("syncKVVM: detect no disruptive changes, apply them to KVVM")
330-
331315
// No need to wait, apply changes to KVVM immediately.
332316
err = h.applyVMChangesToKVVM(ctx, s, allChanges)
333317
if err != nil {
@@ -336,11 +320,8 @@ func (h *SyncKvvmHandler) syncKVVM(ctx context.Context, s state.VirtualMachineSt
336320

337321
return true, nil
338322
case allChanges.IsEmpty():
339-
log.Info("syncKVVM: detect no changes, stop sync")
340-
341323
return true, nil
342324
default:
343-
log.Info("syncKVVM: detect disruptive changes: wait for reboot")
344325
// Delay changes propagation to KVVM until user restarts VM.
345326
return false, nil
346327
}

images/virtualization-artifact/pkg/controller/workload-updater/workload_updater_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ import (
2020
"context"
2121
"time"
2222

23-
"github.com/deckhouse/virtualization-controller/pkg/featuregates"
2423
"k8s.io/utils/ptr"
2524
"sigs.k8s.io/controller-runtime/pkg/controller"
2625
"sigs.k8s.io/controller-runtime/pkg/manager"
2726

2827
"github.com/deckhouse/deckhouse/pkg/log"
2928
"github.com/deckhouse/virtualization-controller/pkg/controller/workload-updater/internal/handler"
3029
"github.com/deckhouse/virtualization-controller/pkg/controller/workload-updater/internal/service"
30+
"github.com/deckhouse/virtualization-controller/pkg/featuregates"
3131
"github.com/deckhouse/virtualization-controller/pkg/logger"
3232
)
3333

0 commit comments

Comments
 (0)