From 1eff6cbe9259b84f172baa28b0571d5c1b3ed649 Mon Sep 17 00:00:00 2001 From: Yannick Struyf Date: Fri, 1 Dec 2023 11:58:52 +0100 Subject: [PATCH] Add comments to the new function definitions and rename cUUID to peUUID parameter --- api/v1beta1/conditions.go | 1 + controllers/helpers.go | 1 + controllers/nutanixmachine_controller.go | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/v1beta1/conditions.go b/api/v1beta1/conditions.go index 54ab2183db..a089099ffa 100644 --- a/api/v1beta1/conditions.go +++ b/api/v1beta1/conditions.go @@ -29,6 +29,7 @@ const ( // NoFailureDomainsReconciled indicates no failure domains have been defined NoFailureDomainsReconciled capiv1.ConditionType = "NoFailureDomainsReconciled" + // FailureDomainsReconciliationFailed indicates the failure domain reconciliation failed FailureDomainsReconciliationFailed = "FailureDomainsReconciliationFailed" ) diff --git a/controllers/helpers.go b/controllers/helpers.go index 7f335ce82b..8ec4331f22 100644 --- a/controllers/helpers.go +++ b/controllers/helpers.go @@ -748,6 +748,7 @@ func GetGPUsForPE(ctx context.Context, client *nutanixClientV3.Client, peUUID st return gpus, nil } +// GetFailureDomain gets the failure domain with a given name from a NutanixCluster object. func GetFailureDomain(failureDomainName string, nutanixCluster *infrav1.NutanixCluster) (*infrav1.NutanixFailureDomain, error) { if failureDomainName == "" { return nil, fmt.Errorf("failure domain name must be set when searching for failure domains on a Nutanix cluster object") diff --git a/controllers/nutanixmachine_controller.go b/controllers/nutanixmachine_controller.go index 68c588ed07..7a17878dda 100644 --- a/controllers/nutanixmachine_controller.go +++ b/controllers/nutanixmachine_controller.go @@ -929,14 +929,14 @@ func (r *NutanixMachineReconciler) GetSubnetAndPEUUIDs(rctx *nctx.MachineContext if err != nil { return "", nil, fmt.Errorf("failed to find failure domain %s", failureDomainName) } - cUUID, err := GetPEUUID(rctx.Context, rctx.NutanixClient, failureDomain.Cluster.Name, failureDomain.Cluster.UUID) + peUUID, err := GetPEUUID(rctx.Context, rctx.NutanixClient, failureDomain.Cluster.Name, failureDomain.Cluster.UUID) if err != nil { return "", nil, fmt.Errorf("failed to find prism element uuid for failure domain %s", failureDomainName) } - subnetUUIDs, err := GetSubnetUUIDList(rctx.Context, rctx.NutanixClient, failureDomain.Subnets, cUUID) + subnetUUIDs, err := GetSubnetUUIDList(rctx.Context, rctx.NutanixClient, failureDomain.Subnets, peUUID) if err != nil { return "", nil, fmt.Errorf("failed to find subnet uuids for failure domain %s", failureDomainName) } - return cUUID, subnetUUIDs, nil + return peUUID, subnetUUIDs, nil }