Skip to content

Commit a306bf7

Browse files
committed
Don't error out if VMI is not found, instead
report not found and handle that appropriately. Signed-off-by: Alexander Wels <awels@redhat.com>
1 parent 8cbfe85 commit a306bf7

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

pkg/controller/directvolumemigration/rsync.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,6 +1704,9 @@ func (t *Task) updateVolumeLiveMigrationProgressStatus(volumeName, namespace str
17041704
return err
17051705
}
17061706
liveMigrationProgress.VMName = vmName
1707+
if message == "not found" {
1708+
return nil
1709+
}
17071710
if message != "" {
17081711
vmMatchString := fmt.Sprintf("%s/%s", namespace, vmName)
17091712
liveMigrationProgress.Message = message

pkg/controller/directvolumemigration/vm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ func virtualMachineMigrationStatus(client k8sclient.Client, vmName, namespace st
438438
if !k8serrors.IsNotFound(err) {
439439
return err.Error(), err
440440
}
441-
return fmt.Sprintf("VMI %s not found in namespace %s", vmName, namespace), err
441+
return "not found", nil
442442
}
443443
volumeChange := false
444444
liveMigrateable := false

pkg/controller/directvolumemigration/vm_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,14 +445,14 @@ func TestVirtualMachineMigrationStatus(t *testing.T) {
445445
{
446446
name: "In progress VMIM",
447447
client: getFakeClientWithObjs(createInProgressVirtualMachineMigration("vmim", testNamespace, "vm")),
448-
expectedStatus: fmt.Sprintf("VMI %s not found in namespace %s", "vm", testNamespace),
449-
wantErr: true,
448+
expectedStatus: "not found",
449+
wantErr: false,
450450
},
451451
{
452452
name: "No VMIM or VMI",
453453
client: getFakeClientWithObjs(),
454-
expectedStatus: fmt.Sprintf("VMI %s not found in namespace %s", "vm", testNamespace),
455-
wantErr: true,
454+
expectedStatus: "not found",
455+
wantErr: false,
456456
},
457457
{
458458
name: "Failed VMIM with message",

0 commit comments

Comments
 (0)