Skip to content
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
33 changes: 29 additions & 4 deletions pkg/provisioner/ironic/inspecthardware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,42 @@ func TestInspectHardware(t *testing.T) {
expectedResultError: "Canceled by operator",
},
{
name: "inspection-in-progress",
ironic: testserver.NewIronic(t).WithDefaultResponses(),
name: "inspection-in-progress (not yet finished)",
ironic: testserver.NewIronic(t).Ready().Node(nodes.Node{
UUID: nodeUUID,
ProvisionState: string(nodes.Manageable),
}),
inspector: testserver.NewInspector(t).Ready().WithIntrospection(nodeUUID, introspection.Introspection{
Finished: false,
}),
expectedDirty: true,
expectedRequestAfter: 15,
},
{
name: "inspection-completed",
ironic: testserver.NewIronic(t).WithDefaultResponses(),
name: "inspection-in-progress (but node still in InspectWait)",
ironic: testserver.NewIronic(t).Ready().Node(nodes.Node{
UUID: nodeUUID,
ProvisionState: string(nodes.InspectWait),
}),
inspector: testserver.NewInspector(t).Ready().
WithIntrospection(nodeUUID, introspection.Introspection{
Finished: true,
}).
WithIntrospectionData(nodeUUID, introspection.Data{
Inventory: introspection.InventoryType{
Hostname: "node-0",
},
}),

expectedDirty: true,
expectedRequestAfter: 15,
},
{
name: "inspection-complete",
ironic: testserver.NewIronic(t).Ready().Node(nodes.Node{
UUID: nodeUUID,
ProvisionState: string(nodes.Manageable),
}),
inspector: testserver.NewInspector(t).Ready().
WithIntrospection(nodeUUID, introspection.Introspection{
Finished: true,
Expand Down
10 changes: 5 additions & 5 deletions pkg/provisioner/ironic/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -696,16 +696,16 @@ func (p *ironicProvisioner) InspectHardware(force bool) (result provisioner.Resu
result, err = transientError(errors.Wrap(err, "failed to extract hardware inspection status"))
return
}
if !status.Finished {
p.log.Info("inspection in progress", "started_at", status.StartedAt)
result, err = operationContinuing(introspectionRequeueDelay)
return
}
if status.Error != "" {
p.log.Info("inspection failed", "error", status.Error)
result, err = operationFailed(status.Error)
return
}
if !status.Finished || nodes.ProvisionState(ironicNode.ProvisionState) == nodes.InspectWait {
p.log.Info("inspection in progress", "started_at", status.StartedAt)
result, err = operationContinuing(introspectionRequeueDelay)
return
}

// Introspection is done
p.log.Info("getting hardware details from inspection")
Expand Down