Skip to content
This repository was archived by the owner on Aug 15, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/management/metal3.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,12 @@ func (m *Metal3Client) IsRestartComplete(ctx context.Context, hostID string) (bo
return false, err
}

// Restart is complete when the reboot annotation is no longer present
// Restart is complete when the reboot annotation has been processed and
// the host is back online. Checking only the annotation is insufficient
// because the BMH controller removes it as soon as the reboot command is
// sent to Ironic, before the host finishes rebooting.
_, hasRebootAnnotation := bmh.Annotations[metal3api.RebootAnnotationPrefix]
return !hasRebootAnnotation, nil
return !hasRebootAnnotation && bmh.Status.PoweredOn, nil
}

func (m *Metal3Client) getBMH(ctx context.Context, hostID string) (*metal3api.BareMetalHost, error) {
Expand Down
9 changes: 9 additions & 0 deletions internal/management/metal3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,15 @@ var _ = Describe("Metal3 Management Backend", func() {
Expect(complete).To(BeTrue())
})

It("returns false when annotation is gone but host is not powered on", func() {
bmh := newBMHForManagement("host-rebooting", true, false)
m := newMetal3ManagementClient(bmh)

complete, err := m.IsRestartComplete(ctx, metal3TestNamespace+"/host-rebooting")
Expect(err).NotTo(HaveOccurred())
Expect(complete).To(BeFalse())
})

It("returns false when reboot annotation is present", func() {
annotations := map[string]string{
metal3api.RebootAnnotationPrefix: "",
Expand Down
Loading