Skip to content
Open
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
7 changes: 7 additions & 0 deletions api/external/nova/messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ const (
ReserveForCommittedResourceIntent v1alpha1.SchedulingIntent = "reserve_for_committed_resource"
// CapacityProbeIntent indicates that the request is a synthetic capacity probe (not a real VM placement).
CapacityProbeIntent v1alpha1.SchedulingIntent = "capacity_probe"
// ValidateFailoverReservationIntent indicates that cortex is validating whether a VM
// can use a specific failover reservation host. Uses EvacuateIntent semantics in
// filter_has_enough_capacity to unlock reservation resources for the VM.
ValidateFailoverReservationIntent v1alpha1.SchedulingIntent = "validate_failover_reservation"

// HintKeyResourceGroup is the scheduler hint key used to pass the resource group
// (e.g., flavor group name) for failover reservation scheduling.
Expand Down Expand Up @@ -289,6 +293,9 @@ func (req ExternalSchedulerRequest) GetIntent() (v1alpha1.SchedulingIntent, erro
// Used by cortex capacity probe controller
case "capacity_probe":
return CapacityProbeIntent, nil
// Used by cortex failover reservation controller (host validation check)
case "validate_failover_reservation":
return ValidateFailoverReservationIntent, nil
default:
return CreateIntent, nil
}
Expand Down
20 changes: 20 additions & 0 deletions internal/scheduling/nova/e2e_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,26 @@ func randomRequest(dc datacenter, seed int) api.ExternalSchedulerRequest {
Hosts: hosts,
Weights: weights,
}
// Synthesize image properties from flavor extra specs so filter_image_properties
// can determine the hypervisor type. Mirrors imagePropertiesFromFlavor in reservation_scheduling.go.
switch strings.ToLower(extraSpecs["capabilities:hypervisor_type"]) {
case "qemu", "ch":
request.Spec.Data.Image = api.NovaObject[api.NovaImageMeta]{
Data: api.NovaImageMeta{
Properties: api.NovaObject[map[string]any]{
Data: map[string]any{"img_hv_type": string(api.NovaImageMetaHVTypeKVM)},
},
},
}
case "vmware vcenter server":
request.Spec.Data.Image = api.NovaObject[api.NovaImageMeta]{
Data: api.NovaImageMeta{
Properties: api.NovaObject[map[string]any]{
Data: map[string]any{"hypervisor_type": string(api.NovaImageMetaHVTypeVMware)},
},
},
}
}
// Force to use the pipeline with all filters enabled for kvm flavors.
hvType, err := request.GetHypervisorType()
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (s *FilterExternalCustomerStep) Run(traceLog logr.Logger, request api.Exter
if intent, err := request.GetIntent(); err == nil && slices.Contains([]v1alpha1.SchedulingIntent{
api.ReserveForFailoverIntent,
api.ReuseFailoverReservationIntent,
api.ValidateFailoverReservationIntent,
api.CapacityProbeIntent,
}, intent) {
traceLog.V(1).Info("skipping external customer filter for non-placement intent", "intent", intent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,27 @@ func TestFilterExternalCustomerStep_Run(t *testing.T) {
expectedHosts: []string{"host1", "host3"},
filteredHosts: []string{},
},
{
name: "ValidateFailoverReservationIntent - skips filter, all hosts pass (no domain_name hint)",
opts: FilterExternalCustomerStepOpts{
CustomerDomainNamePrefixes: []string{"ext-"},
},
request: api.ExternalSchedulerRequest{
Spec: api.NovaObject[api.NovaSpec]{
Data: api.NovaSpec{
SchedulerHints: map[string]any{
"_nova_check_type": string(api.ValidateFailoverReservationIntent),
},
},
},
Hosts: []api.ExternalSchedulerHost{
{ComputeHost: "host1"},
{ComputeHost: "host3"},
},
},
expectedHosts: []string{"host1", "host3"},
filteredHosts: []string{},
},
{
name: "ReserveForCommittedResourceIntent - domain filter applies (no domain_name hint → all hosts pass)",
opts: FilterExternalCustomerStepOpts{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (s *FilterHasEnoughCapacity) Run(traceLog logr.Logger, request api.External
intent, err := request.GetIntent()
if err == nil {
switch intent {
case api.EvacuateIntent:
case api.EvacuateIntent, api.ValidateFailoverReservationIntent:
if reservation.Status.FailoverReservation != nil {
if _, contained := reservation.Status.FailoverReservation.Allocations[request.Spec.Data.InstanceUUID]; contained {
traceLog.V(1).Info("unlocking resources reserved by failover reservation for VM in allocations (evacuation)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func (s *FilterQuotaEnforcement) Run(traceLog logr.Logger, request api.ExternalS
traceLog.V(1).Info("skipping quota enforcement for non-consuming intent", "intent", intent)
QuotaEnforcementMetricsSingleton.RecordDecision(mode, "accept_skipped_intent_migration", "", "", "")
return result, nil
case api.ReserveForFailoverIntent, api.ReuseFailoverReservationIntent:
case api.ReserveForFailoverIntent, api.ReuseFailoverReservationIntent, api.ValidateFailoverReservationIntent:
traceLog.V(1).Info("skipping quota enforcement for failover reservation intent")
QuotaEnforcementMetricsSingleton.RecordDecision(mode, "accept_skipped_intent_internal", "", "", "")
return result, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (c *FailoverReservationController) validateVMViaSchedulerEvacuation(
IgnoreHosts: []string{vm.CurrentHypervisor},
Pipeline: inferFailoverPipeline(flavorExtraSpecs),
AvailabilityZone: vm.AvailabilityZone,
SchedulerHints: map[string]any{"_nova_check_type": string(api.EvacuateIntent)},
SchedulerHints: map[string]any{"_nova_check_type": string(api.ValidateFailoverReservationIntent)},
ImageProperties: imagePropertiesFromFlavor(flavorExtraSpecs),
}

Expand Down
Loading