diff --git a/images/virt-artifact/werf.inc.yaml b/images/virt-artifact/werf.inc.yaml index 45e1112e8d..09f61dbfb3 100644 --- a/images/virt-artifact/werf.inc.yaml +++ b/images/virt-artifact/werf.inc.yaml @@ -16,7 +16,8 @@ shell: install: - | echo "Git clone {{ $gitRepoName }} repository..." - git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch {{ $tag }} /src/kubevirt + echo kekdtt1223451trf1кadff12345 + git clone --depth=1 $(cat /run/secrets/SOURCE_REPO)/{{ $gitRepoUrl }} --branch v1.6.2-virtualization-fix-thawning /src/kubevirt rm -rf /src/kubevirt/.git diff --git a/images/virtualization-artifact/pkg/controller/vmsnapshot/internal/life_cycle.go b/images/virtualization-artifact/pkg/controller/vmsnapshot/internal/life_cycle.go index 87d7dfe763..e7adac4e5d 100644 --- a/images/virtualization-artifact/pkg/controller/vmsnapshot/internal/life_cycle.go +++ b/images/virtualization-artifact/pkg/controller/vmsnapshot/internal/life_cycle.go @@ -76,6 +76,12 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *v1alpha2.Virtu return reconcile.Result{}, err } + var frozen bool + if vm != nil { + frozenCondition, ok := conditions.GetCondition(vmcondition.TypeFilesystemFrozen, vm.Status.Conditions) + frozen = ok && frozenCondition.Status == metav1.ConditionTrue + } + kvvmi, err := h.snapshotter.GetVirtualMachineInstance(ctx, vm) if err != nil { h.setPhaseConditionToFailed(cb, vmSnapshot, err) @@ -113,7 +119,11 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *v1alpha2.Virtu Reason(conditions.ReasonUnknown). Message("") - _, err = h.unfreezeVirtualMachineIfCan(ctx, vmSnapshot, vm, kvvmi) + if !frozen { + return reconcile.Result{}, nil + } + + canUnfreeze, err := h.unfreezeVirtualMachineIfCan(ctx, vmSnapshot, vm, kvvmi) if err != nil { if errors.Is(err, service.ErrUntrustedFilesystemFrozenCondition) { log.Debug(err.Error()) @@ -135,6 +145,10 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *v1alpha2.Virtu return reconcile.Result{}, err } + if !canUnfreeze { + return reconcile.Result{RequeueAfter: 5 * time.Second}, nil + } + return reconcile.Result{}, nil } @@ -147,6 +161,27 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmSnapshot *v1alpha2.Virtu Status(readyCondition.Status). Reason(conditions.CommonReason(readyCondition.Reason)). Message(readyCondition.Message) + + if !frozen { + return reconcile.Result{}, nil + } + + canUnfreeze, err := h.unfreezeVirtualMachineIfCan(ctx, vmSnapshot, vm, kvvmi) + if err != nil { + if errors.Is(err, service.ErrUntrustedFilesystemFrozenCondition) { + log.Debug(err.Error()) + return reconcile.Result{}, nil + } + if k8serrors.IsConflict(err) { + log.Debug(fmt.Sprintf("failed to unfreeze filesystem; resource update conflict error: %s", err)) + return reconcile.Result{RequeueAfter: 5 * time.Second}, nil + } + cb.Message(fmt.Sprintf("%s, %s", err.Error(), cb.Condition().Message)) + return reconcile.Result{}, fmt.Errorf("failed to unfreeze filesystem: %w", err) + } + if !canUnfreeze { + return reconcile.Result{RequeueAfter: 5 * time.Second}, nil + } return reconcile.Result{}, nil case v1alpha2.VirtualMachineSnapshotPhaseReady: // Ensure vd snapshots aren't lost.