Skip to content

Commit f29d138

Browse files
committed
fix types
Signed-off-by: Daniil Antoshin <[email protected]>
1 parent 7dd81ed commit f29d138

File tree

1 file changed

+7
-7
lines changed
  • images/virtualization-artifact/pkg/controller/service/restorer/restorers

1 file changed

+7
-7
lines changed

images/virtualization-artifact/pkg/controller/service/restorer/restorers/vm_restorer.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ func (v *VirtualMachineHandler) ProcessRestore(ctx context.Context) error {
147147
}
148148

149149
// // Always clean up VMBDAs first, regardless of VM state
150-
// err = v.deleteCurrentVirtualMachineBlockDeviceAttachments(ctx, vm.Name, vm.Namespace, v.restoreUID)
151-
// if err != nil {
152-
// return err
153-
// }
150+
err = v.deleteCurrentVirtualMachineBlockDeviceAttachments(ctx)
151+
if err != nil {
152+
return err
153+
}
154154

155155
// Early return if VM is already fully processed by this restore operation
156156
if value, ok := vm.Annotations[annotations.AnnVMRestore]; ok && value == v.restoreUID {
@@ -262,9 +262,9 @@ func (v *VirtualMachineHandler) Object() client.Object {
262262
return v.vm
263263
}
264264

265-
func (v *VirtualMachineHandler) deleteCurrentVirtualMachineBlockDeviceAttachments(ctx context.Context, vmName, vmNamespace, vmRestoreUID string) error {
265+
func (v *VirtualMachineHandler) deleteCurrentVirtualMachineBlockDeviceAttachments(ctx context.Context) error {
266266
vmbdas := &v1alpha2.VirtualMachineBlockDeviceAttachmentList{}
267-
err := v.client.List(ctx, vmbdas, &client.ListOptions{Namespace: vmNamespace})
267+
err := v.client.List(ctx, vmbdas, &client.ListOptions{Namespace: v.vm.Namespace})
268268
if err != nil {
269269
return fmt.Errorf("failed to list the `VirtualMachineBlockDeviceAttachment`: %w", err)
270270
}
@@ -277,7 +277,7 @@ func (v *VirtualMachineHandler) deleteCurrentVirtualMachineBlockDeviceAttachment
277277

278278
vmbdasToDelete := make([]*v1alpha2.VirtualMachineBlockDeviceAttachment, 0, len(vmbdas.Items))
279279
for _, vmbda := range vmbdas.Items {
280-
if vmbda.Spec.VirtualMachineName != vmName {
280+
if vmbda.Spec.VirtualMachineName != v.vm.Name {
281281
continue
282282
}
283283

0 commit comments

Comments
 (0)