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

Minor cleanup #604

Merged
merged 1 commit into from
Sep 26, 2023
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
4 changes: 1 addition & 3 deletions pkg/controller/plan/adapter/openstack/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -1039,9 +1039,7 @@ func (r *Builder) getStorageClassName(workload *model.Workload, volumeTypeName s
return
}
for _, storageMap := range r.Context.Map.Storage.Spec.Map {
if storageMap.Source.ID == volumeTypeID {
storageClassName = storageMap.Destination.StorageClass
} else if storageMap.Source.Name == volumeTypeName {
if storageMap.Source.ID == volumeTypeID || storageMap.Source.Name == volumeTypeName {
storageClassName = storageMap.Destination.StorageClass
}
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/controller/plan/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ func (r *Migration) Archive() {
}

for _, vm := range r.Plan.Status.Migration.VMs {
err = r.CleanUp(vm)
err = r.cleanup(vm)
if err != nil {
r.Log.Error(err,
"Couldn't clean up VM while archiving plan.",
Expand Down Expand Up @@ -384,7 +384,7 @@ func (r *Migration) Cancel() (err error) {

for _, vm := range r.Plan.Status.Migration.VMs {
if vm.HasCondition(Canceled) {
err = r.CleanUp(vm)
err = r.cleanup(vm)
if err != nil {
r.Log.Error(err,
"Couldn't clean up after canceled VM migration.",
Expand Down Expand Up @@ -415,7 +415,7 @@ func (r *Migration) Cancel() (err error) {
}

// Delete left over migration resources associated with a VM.
func (r *Migration) CleanUp(vm *plan.VMStatus) (err error) {
func (r *Migration) cleanup(vm *plan.VMStatus) (err error) {
if !vm.HasCondition(Succeeded) {
err = r.kubevirt.DeleteVM(vm)
if err != nil {
Expand Down Expand Up @@ -609,7 +609,7 @@ func (r *Migration) execute(vm *plan.VMStatus) (err error) {
vm.MarkStarted()
step.MarkStarted()
step.Phase = Running
err = r.CleanUp(vm)
err = r.cleanup(vm)
if err != nil {
step.AddError(err.Error())
err = nil
Expand Down
Loading