Skip to content

Commit

Permalink
Always update image details
Browse files Browse the repository at this point in the history
Always update the image data within ValidateManagementAccess()
regardless of Ironic node existence or not. Currently, image data
update is happening only if Ironic node doesn't exist. That means, if
we failed to write image data, we won't be able to update it again in
the next retries since node already exists.
  • Loading branch information
fmuyassarov committed Apr 6, 2021
1 parent c347b81 commit c0373bb
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions pkg/provisioner/ironic/ironic.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,18 +492,6 @@ func (p *ironicProvisioner) ValidateManagementAccess(data provisioner.Management
return
}
}

if data.CurrentImage != nil {
updatesImage, optsErr := p.getImageUpdateOptsForNode(ironicNode, data.CurrentImage, data.BootMode)
if optsErr != nil {
result, err = transientError(errors.Wrap(optsErr, "Could not get Image options for node"))
return
}
if len(updatesImage) != 0 {
updates = append(updates, updatesImage...)

}
}
} else {
// FIXME(dhellmann): At this point we have found an existing
// node in ironic by looking it up. We need to check its
Expand Down Expand Up @@ -538,6 +526,16 @@ func (p *ironicProvisioner) ValidateManagementAccess(data provisioner.Management
// below.
}
}
if data.CurrentImage != nil {
updatesImage, optsErr := p.getImageUpdateOptsForNode(ironicNode, data.CurrentImage, data.BootMode)
if optsErr != nil {
result, err = transientError(errors.Wrap(optsErr, "Could not get Image options for node"))
return
}
if len(updatesImage) != 0 {
updates = append(updates, updatesImage...)
}
}
if ironicNode.AutomatedClean == nil ||
(data.AutomatedCleaningMode == metal3v1alpha1.CleaningModeDisabled && *ironicNode.AutomatedClean) ||
(data.AutomatedCleaningMode == metal3v1alpha1.CleaningModeMetadata && !*ironicNode.AutomatedClean) {
Expand Down

0 comments on commit c0373bb

Please sign in to comment.