Skip to content
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
5 changes: 5 additions & 0 deletions api/external/nova/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change intentional? Seems unrelated

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but commit msg misleading changed

ProjectID: vm.ProjectID,
FlavorName: vm.FlavorName,
FlavorExtraSpecs: flavorExtraSpecs,
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading