@@ -285,7 +285,17 @@ func (r *KubevirtMachineReconciler) reconcileNormal(ctx *context.MachineContext)
285
285
ipAddress := externalMachine .Address ()
286
286
if ipAddress == "" {
287
287
ctx .Logger .Info (fmt .Sprintf ("KubevirtMachine %s: Got empty ipAddress, requeue" , ctx .KubevirtMachine .Name ))
288
- ctx .KubevirtMachine .Status .Ready = false
288
+ // Only set readiness to false if we have never detected an internal IP for this machine.
289
+ //
290
+ // The internal ipAddress is sometimes detected via the qemu guest agent,
291
+ // which will report an empty addr at some points when the guest is rebooting
292
+ // or updating.
293
+ //
294
+ // This check prevents us from marking the infrastructure as not ready
295
+ // when the internal guest might be rebooting or updating.
296
+ if ! machineHasKnownInternalIP (ctx .KubevirtMachine ) {
297
+ ctx .KubevirtMachine .Status .Ready = false
298
+ }
289
299
return ctrl.Result {RequeueAfter : 20 * time .Second }, nil
290
300
}
291
301
@@ -349,6 +359,15 @@ func (r *KubevirtMachineReconciler) reconcileNormal(ctx *context.MachineContext)
349
359
return ctrl.Result {}, nil
350
360
}
351
361
362
+ func machineHasKnownInternalIP (kubevirtMachine * infrav1.KubevirtMachine ) bool {
363
+ for _ , addr := range kubevirtMachine .Status .Addresses {
364
+ if addr .Type == clusterv1 .MachineInternalIP && addr .Address != "" {
365
+ return true
366
+ }
367
+ }
368
+ return false
369
+ }
370
+
352
371
func (r * KubevirtMachineReconciler ) updateNodeProviderID (ctx * context.MachineContext ) (ctrl.Result , error ) {
353
372
// If the provider ID is already updated on the Node, return
354
373
if ctx .KubevirtMachine .Status .NodeUpdated {
0 commit comments