@@ -923,13 +923,15 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
923
923
return false , nil
924
924
}
925
925
926
+ s .Info ("checking dedicated hosts" )
926
927
requeue := false
927
928
for _ , dHost := range s .IBMVPCCluster .Spec .DedicatedHosts {
928
929
var dHostDetails * vpcv1.DedicatedHost
929
930
var err error
930
931
switch {
931
932
// Attempt lookup of Dedicated Host by ID, if provided. A defined ID expects the Dedicated Host to exist.
932
933
case dHost .ID != nil :
934
+ s .Info ("checking host id" , "id" , * dHost .ID )
933
935
dHostDetails , _ , err = s .VPCClient .GetDedicatedHost (& vpcv1.GetDedicatedHostOptions {
934
936
ID : dHost .ID ,
935
937
})
@@ -941,11 +943,13 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
941
943
s .V (3 ).Info ("found dedicated host with id: %s" , * dHost .ID )
942
944
// Attempt lookup of Dedicated Host by Name, if provided. A defined name could be for an existing Dedicated Host, or if not found and a profile provided, create a new Dedicated Host.
943
945
case dHost .Name != nil :
946
+ s .Info ("checking host name" , "name" , * dHost .Name )
944
947
dHostDetails , err = s .VPCClient .GetDedicatedHostByName (* dHost .Name )
945
948
switch {
946
949
case err != nil :
947
950
return false , fmt .Errorf ("error looking up dedicated host by name %s: %w" , * dHost .Name , err )
948
951
case dHostDetails == nil && dHost .Profile != nil :
952
+ s .Info ("checking host profile" , "profile" , * dHost .Profile )
949
953
// If Dedicated Host not found by name and a profile is defined, try to create a new Dedicated Host.
950
954
dHostDetails , _ , err = s .createDedicatedHost (dHost )
951
955
if err != nil {
@@ -969,6 +973,7 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
969
973
default :
970
974
return false , fmt .Errorf ("error cannot reconcile dedicated host without id and name" )
971
975
}
976
+ s .Info ("found dedicated host" )
972
977
// Determine whether the Dedicated Host is ready and available for provisioning VSI's.
973
978
dHostReady := * dHostDetails .State == vpcv1 .DedicatedHostStateAvailableConst && * dHostDetails .Provisionable
974
979
// Update Dedicated Host Status.
@@ -979,15 +984,18 @@ func (s *VPCClusterScope) ReconcileDedicatedHosts() (bool, error) {
979
984
})
980
985
// If the Dedicated Host is not ready, flag for requeue.
981
986
if ! dHostReady {
987
+ s .Info ("requeue for unready dedicated host" )
982
988
requeue = true
983
989
}
984
990
}
985
991
992
+ s .Info ("returning" , "requeue" , requeue )
986
993
return requeue , nil
987
994
}
988
995
989
996
// createDedicatedHost will create a new Dedicated Host as defined by the VPCDedicatedHost.
990
997
func (s * VPCClusterScope ) createDedicatedHost (dHost infrav1beta2.VPCDedicatedHost ) (* vpcv1.DedicatedHost , * core.DetailedResponse , error ) {
998
+ s .Info ("created dedicated host" , "name" , * dHost .Name )
991
999
// Collect Resource Group ID for Dedicated Host creation options.
992
1000
resourceGroupID , err := s .GetResourceGroupID ()
993
1001
if err != nil {
0 commit comments