Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't create DVM resource if no PVCs are present #1381

Merged
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
6 changes: 3 additions & 3 deletions pkg/controller/migmigration/dvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (t *Task) buildDirectVolumeMigration() *migapi.DirectVolumeMigration {
Spec: migapi.DirectVolumeMigrationSpec{
SrcMigClusterRef: t.PlanResources.SrcMigCluster.GetObjectReference(),
DestMigClusterRef: t.PlanResources.DestMigCluster.GetObjectReference(),
PersistentVolumeClaims: *pvcList,
PersistentVolumeClaims: pvcList,
CreateDestinationNamespaces: true,
},
}
Expand Down Expand Up @@ -202,7 +202,7 @@ func (t *Task) getDVMPodProgress(dvm migapi.DirectVolumeMigration) []string {
return progress
}

func (t *Task) getDirectVolumeClaimList() *[]migapi.PVCToMigrate {
func (t *Task) getDirectVolumeClaimList() []migapi.PVCToMigrate {
nsMapping := t.PlanResources.MigPlan.GetNamespaceMapping()
var pvcList []migapi.PVCToMigrate
for _, pv := range t.PlanResources.MigPlan.Spec.PersistentVolumes.List {
Expand All @@ -227,7 +227,7 @@ func (t *Task) getDirectVolumeClaimList() *[]migapi.PVCToMigrate {
Verify: pv.Selection.Verify,
})
}
return &pvcList
return pvcList
}

func (t *Task) deleteDirectVolumeMigrationResources() error {
Expand Down
16 changes: 7 additions & 9 deletions pkg/controller/migmigration/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,13 @@ func (t *Task) Run(ctx context.Context) error {
return liberr.Wrap(err)
}
case CreateDirectVolumeMigration:
err := t.createDirectVolumeMigration()
if err != nil {
return liberr.Wrap(err)
if t.hasDirectVolumes() {
err := t.createDirectVolumeMigration()
if err != nil {
return liberr.Wrap(err)
}
}
if err = t.next(); err != nil {
if err := t.next(); err != nil {
return liberr.Wrap(err)
}
case WaitForDirectVolumeMigrationToComplete:
Expand Down Expand Up @@ -1677,11 +1679,7 @@ func (t *Task) hasDirectVolumes() bool {
if t.PlanResources.MigPlan.Spec.IndirectVolumeMigration {
return false
}
pvcList := t.getDirectVolumeClaimList()
if pvcList != nil {
return true
}
return false
return t.getDirectVolumeClaimList() != nil
}

// Get whether the associated plan has imagestreams to be migrated
Expand Down
Loading