c/s/e/manager: print hardware reservation stats
This also removes a lookup to check if the machine is managed by the shepherd. We can skip that since already know that the hardware reservation has a device attached.
Change-Id: Ic732a8152316cf5ba83e980451fd2a4b0f778d99
Reviewed-on: https://review.monogon.dev/c/monogon/+/1554
Reviewed-by: Serge Bazanski <serge@monogon.tech>
Tested-by: Jenkins CI
diff --git a/cloud/shepherd/equinix/manager/provisioner.go b/cloud/shepherd/equinix/manager/provisioner.go
index 3964334..2bd1e97 100644
--- a/cloud/shepherd/equinix/manager/provisioner.go
+++ b/cloud/shepherd/equinix/manager/provisioner.go
@@ -327,20 +327,23 @@
// Collect all reservations.
var toProvision []packngo.HardwareReservation
+ var inUse, notProvisionable, penalized int
for _, reservation := range reservations {
- if !reservation.Provisionable {
+ if reservation.Device != nil {
+ inUse++
continue
}
- if reservation.Device != nil {
- if managed[reservation.Device.ID] {
- continue
- }
+ if !reservation.Provisionable {
+ notProvisionable++
+ continue
}
if p.badReservations.Penalized(reservation.ID) {
+ penalized++
continue
}
toProvision = append(toProvision, reservation)
}
+ klog.Infof("Retrieved hardware reservations: %d (total), %d (available), %d (in use), %d (not provisionable), %d (penalized)", len(reservations), len(toProvision), inUse, notProvisionable, penalized)
// Limit them to MaxCount, if applicable.
if p.config.MaxCount != 0 {