From f1633c20df296abd49d2691f9539cb408d4de485 Mon Sep 17 00:00:00 2001 From: "haijian.yang" Date: Wed, 18 Dec 2024 15:28:58 +0800 Subject: [PATCH] Replace WaitingForAvailableHostWithSufficientMemory with WaitingForELFClusterWithSufficientMemory --- api/v1beta1/conditions_consts.go | 4 ---- controllers/elfmachine_controller_gpu.go | 2 +- controllers/elfmachine_controller_gpu_test.go | 2 +- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/api/v1beta1/conditions_consts.go b/api/v1beta1/conditions_consts.go index 10f5efc..b0c50b7 100644 --- a/api/v1beta1/conditions_consts.go +++ b/api/v1beta1/conditions_consts.go @@ -123,10 +123,6 @@ const ( // are automatically re-tried by the controller. SelectingGPUFailedReason = "SelectingGPUFailed" - // WaitingForAvailableHostWithSufficientMemoryReason (Severity=Info) documents an ElfMachine - // waiting for an available host with sufficient memory to create VM. - WaitingForAvailableHostWithSufficientMemoryReason = "WaitingForAvailableHostWithSufficientMemory" - // WaitingForAvailableHostWithEnoughGPUsReason (Severity=Info) documents an ElfMachine // waiting for an available host with enough GPUs to create VM. WaitingForAvailableHostWithEnoughGPUsReason = "WaitingForAvailableHostWithEnoughGPUs" diff --git a/controllers/elfmachine_controller_gpu.go b/controllers/elfmachine_controller_gpu.go index 963c21e..318c17a 100644 --- a/controllers/elfmachine_controller_gpu.go +++ b/controllers/elfmachine_controller_gpu.go @@ -59,7 +59,7 @@ func (r *ElfMachineReconciler) selectHostAndGPUsForVM(ctx goctx.Context, machine conditions.MarkFalse(machineCtx.ElfMachine, infrav1.VMProvisionedCondition, infrav1.SelectingGPUFailedReason, clusterv1.ConditionSeverityError, reterr.Error()) } else if rethost == nil { if availableHosts.Len() == 0 { - conditions.MarkFalse(machineCtx.ElfMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForAvailableHostWithSufficientMemoryReason, clusterv1.ConditionSeverityWarning, "") + conditions.MarkFalse(machineCtx.ElfMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForELFClusterWithSufficientMemoryReason, clusterv1.ConditionSeverityWarning, "") log.V(1).Info("Waiting for enough available hosts") } else { conditions.MarkFalse(machineCtx.ElfMachine, infrav1.VMProvisionedCondition, infrav1.WaitingForAvailableHostWithEnoughGPUsReason, clusterv1.ConditionSeverityInfo, "") diff --git a/controllers/elfmachine_controller_gpu_test.go b/controllers/elfmachine_controller_gpu_test.go index 52fed91..7048c34 100644 --- a/controllers/elfmachine_controller_gpu_test.go +++ b/controllers/elfmachine_controller_gpu_test.go @@ -289,7 +289,7 @@ var _ = Describe("ElfMachineReconciler-GPU", func() { ok, err = reconciler.reconcileGPUDevices(ctx, machineContext, vm) Expect(err).NotTo(HaveOccurred()) Expect(ok).To(BeFalse()) - expectConditions(elfMachine, []conditionAssertion{{infrav1.VMProvisionedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1.WaitingForAvailableHostWithSufficientMemoryReason}}) + expectConditions(elfMachine, []conditionAssertion{{infrav1.VMProvisionedCondition, corev1.ConditionFalse, clusterv1.ConditionSeverityWarning, infrav1.WaitingForELFClusterWithSufficientMemoryReason}}) }) It("should remove GPU devices to VM when detect host are not sufficient", func() {