Skip to content

Commit

Permalink
fix panic
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Jul 17, 2024
1 parent 0d4d8bb commit 2b4283f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ func (ds BlankDataSource) Sync(ctx context.Context, vd *virtv2.VirtualDisk) (boo

vd.Status.Progress = "0%"

return true, nil
case pvc == nil:
vd.Status.Phase = virtv2.DiskProvisioning
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.Provisioning
condition.Message = "PVC not found: waiting for creation."
return true, nil
case ds.diskService.IsImportDone(dv, pvc):
logger.Info("Import has completed", "dvProgress", dv.Status.Progress, "dvPhase", dv.Status.Phase, "pvcPhase", pvc.Status.Phase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ func (ds HTTPDataSource) Sync(ctx context.Context, vd *virtv2.VirtualDisk) (bool
vd.Status.Progress = "50%"
vd.Status.DownloadSpeed = ds.statService.GetDownloadSpeed(vd.GetUID(), pod)

return true, nil
case pvc == nil:
vd.Status.Phase = virtv2.DiskProvisioning
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.Provisioning
condition.Message = "PVC not found: waiting for creation."
return true, nil
case ds.diskService.IsImportDone(dv, pvc):
logger.Info("Import has completed", "dvProgress", dv.Status.Progress, "dvPhase", dv.Status.Phase, "pvcPhase", pvc.Status.Phase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,12 @@ func (ds ObjectRefDataSource) Sync(ctx context.Context, vd *virtv2.VirtualDisk)
vd.Status.Progress = "0%"
vd.Status.SourceUID = util.GetPointer(dvcrDataSource.GetUID())

return true, nil
case pvc == nil:
vd.Status.Phase = virtv2.DiskProvisioning
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.Provisioning
condition.Message = "PVC not found: waiting for creation."
return true, nil
case ds.diskService.IsImportDone(dv, pvc):
logger.Info("Import has completed", "dvProgress", dv.Status.Progress, "dvPhase", dv.Status.Phase, "pvcPhase", pvc.Status.Phase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,12 @@ func (ds RegistryDataSource) Sync(ctx context.Context, vd *virtv2.VirtualDisk) (

vd.Status.Progress = "50%"

return true, nil
case pvc == nil:
vd.Status.Phase = virtv2.DiskProvisioning
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.Provisioning
condition.Message = "PVC not found: waiting for creation."
return true, nil
case ds.diskService.IsImportDone(dv, pvc):
logger.Info("Import has completed", "dvProgress", dv.Status.Progress, "dvPhase", dv.Status.Phase, "pvcPhase", pvc.Status.Phase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ func (ds UploadDataSource) Sync(ctx context.Context, vd *virtv2.VirtualDisk) (bo
vd.Status.Progress = "50%"
vd.Status.DownloadSpeed = ds.statService.GetDownloadSpeed(vd.GetUID(), pod)

return true, nil
case pvc == nil:
vd.Status.Phase = virtv2.DiskProvisioning
condition.Status = metav1.ConditionFalse
condition.Reason = vdcondition.Provisioning
condition.Message = "PVC not found: waiting for creation."
return true, nil
case ds.diskService.IsImportDone(dv, pvc):
logger.Info("Import has completed", "dvProgress", dv.Status.Progress, "dvPhase", dv.Status.Phase, "pvcPhase", pvc.Status.Phase)
Expand Down

0 comments on commit 2b4283f

Please sign in to comment.