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 873e5dbca..6859d2cc4 100644 --- a/internal/scheduling/reservations/failover/reservation_scheduling.go +++ b/internal/scheduling/reservations/failover/reservation_scheduling.go @@ -79,7 +79,7 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex // 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. scheduleReq := reservations.ScheduleReservationRequest{ - InstanceUUID: "failover-" + vm.UUID, + InstanceUUID: vm.UUID, ProjectID: vm.ProjectID, FlavorName: vm.FlavorName, FlavorExtraSpecs: flavorExtraSpecs, @@ -89,6 +89,7 @@ func (c *FailoverReservationController) queryHypervisorsFromScheduler(ctx contex IgnoreHosts: ignoreHypervisors, Pipeline: pipeline, AvailabilityZone: vm.AvailabilityZone, + SchedulerHints: map[string]any{"_nova_check_type": string(api.ReserveForFailoverIntent)}, } logger.V(1).Info("scheduling failover reservation", @@ -218,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",