Skip to content

Commit 7e434a7

Browse files
committed
Eviction: Do not try to migrate terminating instances
It just spams the logs, and we just need to wait.
1 parent 5249590 commit 7e434a7

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

internal/controller/eviction_controller.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,21 @@ func (r *EvictionReconciler) evictNext(ctx context.Context, eviction *kvmv1.Evic
293293
return reconcile.Result{}, r.Status().Update(ctx, eviction)
294294
}
295295

296-
if vm.Status == "ACTIVE" || vm.PowerState == 1 {
296+
if vm.TaskState == "deleting" {
297+
// We just have to wait for it to be gone. Try the next one.
298+
copy((*instances)[1:], (*instances)[:len(*instances)-1])
299+
(*instances)[0] = uuid
300+
301+
meta.SetStatusCondition(&eviction.Status.Conditions, metav1.Condition{
302+
Type: kvmv1.ConditionTypeMigration,
303+
Status: metav1.ConditionFalse,
304+
Message: fmt.Sprintf("Live migration of terminating instance %s skipped", vm.ID),
305+
Reason: kvmv1.ConditionReasonFailed,
306+
})
307+
if err2 := r.Status().Update(ctx, eviction); err2 != nil {
308+
return ctrl.Result{}, fmt.Errorf("could update status due to %w", err2)
309+
}
310+
} else if vm.Status == "ACTIVE" || vm.PowerState == 1 {
297311
log.Info("trigger live-migration")
298312
if err = r.liveMigrate(ctx, vm.ID, eviction); err != nil {
299313
if gophercloud.ResponseCodeIs(err, http.StatusNotFound) {

0 commit comments

Comments
 (0)