From bc20956bcff12779c29067784754c9264140c244 Mon Sep 17 00:00:00 2001 From: Daniil Antoshin Date: Thu, 11 Sep 2025 15:02:54 +0200 Subject: [PATCH] fix missed reconcile Signed-off-by: Daniil Antoshin --- .../pkg/controller/vmop/snapshot/internal/watcher/vd.go | 5 +++-- .../pkg/controller/vmop/snapshot/internal/watcher/vmbda.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vd.go b/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vd.go index ef3d265f8b..4cc9c43792 100644 --- a/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vd.go +++ b/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vd.go @@ -45,9 +45,10 @@ func (w VirtualDiskWatcher) Watch(mgr manager.Manager, ctr controller.Controller if err := ctr.Watch( source.Kind(mgr.GetCache(), &v1alpha2.VirtualDisk{}, handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, vd *v1alpha2.VirtualDisk) []reconcile.Request { - restoreUID, hasRestoreAnnotation := vd.Annotations[annotations.AnnVMOPRestore] + // Use when we deleting VD before creating new one. Order is important because VD may have restore annotation from previous restore. + restoreUID, hasRestoreAnnotation := vd.Annotations[annotations.AnnVMOPRestoreDeleted] if !hasRestoreAnnotation { - restoreUID, hasRestoreAnnotation = vd.Annotations[annotations.AnnVMOPRestoreDeleted] + restoreUID, hasRestoreAnnotation = vd.Annotations[annotations.AnnVMOPRestore] } if !hasRestoreAnnotation { diff --git a/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vmbda.go b/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vmbda.go index 5510975512..a0427fadb6 100644 --- a/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vmbda.go +++ b/images/virtualization-artifact/pkg/controller/vmop/snapshot/internal/watcher/vmbda.go @@ -45,9 +45,10 @@ func (w VMBlockDeviceAttachmentWatcher) Watch(mgr manager.Manager, ctr controlle if err := ctr.Watch( source.Kind(mgr.GetCache(), &v1alpha2.VirtualMachineBlockDeviceAttachment{}, handler.TypedEnqueueRequestsFromMapFunc(func(ctx context.Context, vmbda *v1alpha2.VirtualMachineBlockDeviceAttachment) []reconcile.Request { - restoreUID, hasRestoreAnnotation := vmbda.Annotations[annotations.AnnVMOPRestore] + // Use when we deleting VMBDA before creating new one. Order is important because VMBDA may have restore annotation from previous restore. + restoreUID, hasRestoreAnnotation := vmbda.Annotations[annotations.AnnVMOPRestoreDeleted] if !hasRestoreAnnotation { - restoreUID, hasRestoreAnnotation = vmbda.Annotations[annotations.AnnVMOPRestoreDeleted] + restoreUID, hasRestoreAnnotation = vmbda.Annotations[annotations.AnnVMOPRestore] } if !hasRestoreAnnotation {