Skip to content

Commit 21a3bf2

Browse files
author
Valeriy Khorunzhin
committed
fix failed
Signed-off-by: Valeriy Khorunzhin <valeriy.khorunzhin@flant.com>
1 parent 0d462e1 commit 21a3bf2

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

images/virtualization-artifact/pkg/controller/vdsnapshot/internal/life_cycle.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ func (h LifeCycleHandler) unfreezeFilesystemIfFailed(ctx context.Context, vdSnap
521521
return err
522522
}
523523

524-
return nil
524+
return h.snapshotter.SyncFSFreezeRequest(ctx, kvvmi)
525525
}
526526

527527
func (h LifeCycleHandler) unfreezeFilesystem(ctx context.Context, vdSnapshotName string, vm *v1alpha2.VirtualMachine, kvvmi *virtv1.VirtualMachineInstance) error {

images/virtualization-artifact/pkg/controller/vmsnapshot/internal/life_cycle.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *v1alpha2.Virtu
147147
Status(readyCondition.Status).
148148
Reason(conditions.CommonReason(readyCondition.Reason)).
149149
Message(readyCondition.Message)
150+
151+
_, err = h.unfreezeVirtualMachineIfCan(ctx, vmSnapshot, vm, kvvmi)
152+
if err != nil {
153+
if errors.Is(err, service.ErrUntrustedFilesystemFrozenCondition) {
154+
log.Debug(err.Error())
155+
return reconcile.Result{}, nil
156+
}
157+
if k8serrors.IsConflict(err) {
158+
log.Debug(fmt.Sprintf("failed to unfreeze filesystem; resource update conflict error: %s", err))
159+
return reconcile.Result{RequeueAfter: 5 * time.Second}, nil
160+
}
161+
cb.Message(fmt.Sprintf("%s, %s", err.Error(), cb.Condition().Message))
162+
return reconcile.Result{}, fmt.Errorf("failed to unfreeze filesystem: %w", err)
163+
}
150164
return reconcile.Result{}, nil
151165
case v1alpha2.VirtualMachineSnapshotPhaseReady:
152166
// Ensure vd snapshots aren't lost.

0 commit comments

Comments
 (0)