Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading