From ed7292ff9a79e9bd35298c790fc92b3010b4c205 Mon Sep 17 00:00:00 2001 From: Malte Viering Date: Wed, 25 Mar 2026 09:01:44 +0100 Subject: [PATCH 1/2] Set SchedulerHints in failover request --- .../reservations/failover/reservation_scheduling.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/scheduling/reservations/failover/reservation_scheduling.go b/internal/scheduling/reservations/failover/reservation_scheduling.go index 873e5dbca..14744a53e 100644 --- a/internal/scheduling/reservations/failover/reservation_scheduling.go +++ b/internal/scheduling/reservations/failover/reservation_scheduling.go @@ -78,8 +78,10 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex // Schedule the reservation using the SchedulerClient. // Note: We pass all hypervisors (from all AZs) in EligibleHosts. The scheduler pipeline's // filter_correct_az filter will exclude hosts that are not in the VM's availability zone. + // FIXME: Using "create" intent as a workaround to avoid ERROR logs for missing + // _nova_check_type hint. Consider adding a dedicated intent during pipeline refactoring. scheduleReq := reservations.ScheduleReservationRequest{ - InstanceUUID: "failover-" + vm.UUID, + InstanceUUID: vm.UUID, ProjectID: vm.ProjectID, FlavorName: vm.FlavorName, FlavorExtraSpecs: flavorExtraSpecs, @@ -89,6 +91,7 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex IgnoreHosts: ignoreHypervisors, Pipeline: pipeline, AvailabilityZone: vm.AvailabilityZone, + SchedulerHints: map[string]any{"_nova_check_type": "create"}, } logger.V(1).Info("scheduling failover reservation", From cd17719e35be8ac62f43a64b6d60b4289bd6eb88 Mon Sep 17 00:00:00 2001 From: Malte Viering Date: Wed, 25 Mar 2026 09:22:06 +0100 Subject: [PATCH 2/2] pr feedback --- api/external/nova/messages.go | 5 +++++ .../reservations/failover/reservation_scheduling.go | 6 ++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/api/external/nova/messages.go b/api/external/nova/messages.go index 15c652ba4..a0a5a8616 100644 --- a/api/external/nova/messages.go +++ b/api/external/nova/messages.go @@ -138,6 +138,8 @@ const ( EvacuateIntent v1alpha1.SchedulingIntent = "evacuate" // CreateIntent indicates that the request is intended for creating a new VM. CreateIntent v1alpha1.SchedulingIntent = "create" + // ReserveForFailoverIntent indicates that the request is for failover reservation scheduling. + ReserveForFailoverIntent v1alpha1.SchedulingIntent = "reserve_for_failover" ) // GetIntent analyzes the request spec and determines the intent of the scheduling request. @@ -160,6 +162,9 @@ func (req ExternalSchedulerRequest) GetIntent() (v1alpha1.SchedulingIntent, erro // See: https://github.com/sapcc/nova/blob/c88393/nova/compute/api.py#L5770 case "evacuate": return EvacuateIntent, nil + // Used by cortex failover reservation controller + case "reserve_for_failover": + return ReserveForFailoverIntent, nil default: return CreateIntent, nil } diff --git a/internal/scheduling/reservations/failover/reservation_scheduling.go b/internal/scheduling/reservations/failover/reservation_scheduling.go index 14744a53e..6859d2cc4 100644 --- a/internal/scheduling/reservations/failover/reservation_scheduling.go +++ b/internal/scheduling/reservations/failover/reservation_scheduling.go @@ -78,8 +78,6 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex // Schedule the reservation using the SchedulerClient. // Note: We pass all hypervisors (from all AZs) in EligibleHosts. The scheduler pipeline's // filter_correct_az filter will exclude hosts that are not in the VM's availability zone. - // FIXME: Using "create" intent as a workaround to avoid ERROR logs for missing - // _nova_check_type hint. Consider adding a dedicated intent during pipeline refactoring. scheduleReq := reservations.ScheduleReservationRequest{ InstanceUUID: vm.UUID, ProjectID: vm.ProjectID, @@ -91,7 +89,7 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex IgnoreHosts: ignoreHypervisors, Pipeline: pipeline, AvailabilityZone: vm.AvailabilityZone, - SchedulerHints: map[string]any{"_nova_check_type": "create"}, + SchedulerHints: map[string]any{"_nova_check_type": string(api.ReserveForFailoverIntent)}, } logger.V(1).Info("scheduling failover reservation", @@ -221,7 +219,7 @@ func (c *FailoverReservationController) validateVMViaSchedulerEvacuation( IgnoreHosts: []string{vm.CurrentHypervisor}, Pipeline: PipelineAcknowledgeFailoverReservation, AvailabilityZone: vm.AvailabilityZone, - SchedulerHints: map[string]any{"_nova_check_type": "evacuate"}, + SchedulerHints: map[string]any{"_nova_check_type": string(api.EvacuateIntent)}, } logger.V(1).Info("validating VM via scheduler evacuation",