diff --git a/apis/metal3.io/v1alpha1/baremetalhost_types.go b/apis/metal3.io/v1alpha1/baremetalhost_types.go index 634a625498..b059c031ec 100644 --- a/apis/metal3.io/v1alpha1/baremetalhost_types.go +++ b/apis/metal3.io/v1alpha1/baremetalhost_types.go @@ -118,6 +118,8 @@ const ( // has any sort of error. OperationalStatusError OperationalStatus = "error" + // OperationalStatusDelayed is the status value for when the host + // deployment needs to be delayed to limit simultaneous hosts provisioning OperationalStatusDelayed = "delayed" ) @@ -546,10 +548,13 @@ type CredentialsStatus struct { type RebootMode string const ( + // RebootModeHard defined for hard reset of a node RebootModeHard RebootMode = "hard" + // RebootModeSoft defined for soft reset of a node RebootModeSoft RebootMode = "soft" ) +// RebootAnnotationArguments defines the arguments of the RebootAnnotation type type RebootAnnotationArguments struct { Mode RebootMode `json:"mode"` } @@ -896,6 +901,7 @@ func (host *BareMetalHost) GetImageChecksum() (string, string, bool) { return host.Spec.Image.GetChecksum() } +// GetChecksum method returns the checksum of an image func (image *Image) GetChecksum() (checksum, checksumType string, ok bool) { if image == nil { return diff --git a/pkg/provisioner/fixture/fixture.go b/pkg/provisioner/fixture/fixture.go index 109150adff..cb1e0d570f 100644 --- a/pkg/provisioner/fixture/fixture.go +++ b/pkg/provisioner/fixture/fixture.go @@ -57,6 +57,7 @@ type fixtureProvisioner struct { state *Fixture } +// Fixture contains persistent state for a particular host type Fixture struct { // counter to set the provisioner as ready BecomeReadyCounter int diff --git a/pkg/provisioner/ironic/ironic.go b/pkg/provisioner/ironic/ironic.go index f93368b2be..3fa5b55afd 100644 --- a/pkg/provisioner/ironic/ironic.go +++ b/pkg/provisioner/ironic/ironic.go @@ -72,6 +72,7 @@ func (e macAddressConflictError) Error() string { return fmt.Sprintf("MAC address %s conflicts with existing node %s", e.Address, e.ExistingNode) } +// NewMacAddressConflictError is a wrap for macAddressConflictError error func NewMacAddressConflictError(address, node string) error { return macAddressConflictError{Address: address, ExistingNode: node} } @@ -1198,10 +1199,9 @@ func (p *ironicProvisioner) Adopt(force bool) (result provisioner.Result, err er Target: nodes.TargetAdopt, }, ) - } else { - return operationFailed(fmt.Sprintf("Host adoption failed: %s", - ironicNode.LastError)) } + return operationFailed(fmt.Sprintf("Host adoption failed: %s", + ironicNode.LastError)) case nodes.Active: default: } diff --git a/pkg/provisioner/ironic/testserver/ironic.go b/pkg/provisioner/ironic/testserver/ironic.go index 56e7f2de76..8c8c3e94d5 100644 --- a/pkg/provisioner/ironic/testserver/ironic.go +++ b/pkg/provisioner/ironic/testserver/ironic.go @@ -168,6 +168,7 @@ func (m *IronicMock) NodeError(name string, errorCode int) *IronicMock { return m } +// NodeCreateCallback type is the callback mock for CreateNodes type NodeCreateCallback func(node nodes.Node) // CreateNodes configures the server so POSTing to /v1/nodes saves the data