Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
31d6f09
A typo in the comment for WithNodeStatesProvisionUpdate
zouy414 Nov 23, 2020
ad1bc39
Rename misleading startProvisioning() function
zaneb Dec 3, 2020
daa0b21
Handle cleaning failure during provisioning
zaneb Dec 3, 2020
256eedf
Add console=ttyS0 to kernel params
derekhiggins Dec 4, 2020
c75c0a3
Add kubebuilder validation for ClockSpeed
Dec 5, 2020
4c78685
Merge pull request #735 from zaneb/provisioning-tweaks
metal3-io-bot Dec 7, 2020
bab0725
Merge pull request #738 from s3rj1k/master
metal3-io-bot Dec 7, 2020
9b3dbf7
Filter out status updates from the reconcile loop
andfasano Dec 9, 2020
0fde063
Merge pull request #747 from andfasano/fix-status-updates
metal3-io-bot Dec 11, 2020
f62d238
Merge pull request #736 from derekhiggins/ttyS0-console
metal3-io-bot Dec 14, 2020
095bf63
remove Available() method from BareMetalHost
dhellmann Dec 7, 2020
29c784b
remove HasError method from host type
dhellmann Dec 8, 2020
b0c8c58
move error handling methods from host to private functions
dhellmann Dec 8, 2020
b54c2c9
Bug 1907612: Update kubernetes deps to 1.20
kirankt Dec 14, 2020
e743aa4
Merge pull request #751 from kirankt/bz-1907612
metal3-io-bot Dec 15, 2020
b4600fe
Fix a typo in doc/dev-setup.md
fmuyassarov Dec 15, 2020
4024604
Merge pull request #752 from Nordix/fix-doc/feruz
metal3-io-bot Dec 15, 2020
cadeb28
Add an empty provisioner and a new way to select the provisioner
asalkeld Dec 8, 2020
5c9ff7d
Fix manager namespace in docs
fmuyassarov Dec 18, 2020
35423c0
Merge pull request #748 from asalkeld/no-bmc
metal3-io-bot Jan 5, 2021
85cacba
Handle dual-stack configuration in inspection data
Jan 5, 2021
515da0f
Clarify BMH nic hardware status for dual-stack
Jan 6, 2021
b9b8cba
Merge pull request #758 from hardys/dualstack_fix
metal3-io-bot Jan 6, 2021
71eb0b2
Merge pull request #756 from Nordix/ns-bmo-docs/feruz
metal3-io-bot Jan 7, 2021
93a6fd2
Merge pull request #741 from dhellmann/drop-available-method
metal3-io-bot Jan 11, 2021
562b6ac
Clear ErrorCount independently of ErrorType/Message
zaneb Dec 11, 2020
84ca573
Add force flag to ValidateManagementAccess()
zaneb Dec 10, 2020
2d02462
Delay retry on inspect failed
zaneb Dec 4, 2020
7791d21
Ironic: Handle Error state correctly
zaneb Dec 11, 2020
d7d38ee
Delay retry on deprovision failed
zaneb Dec 11, 2020
7c3daef
provisioner: Fix copy-paste error in docs
zaneb Dec 11, 2020
087f5f4
Rename column of 'get bmh' short
Jan 12, 2021
9d5e8d3
Merge pull request #749 from zaneb/retries-with-backoff
metal3-io-bot Jan 13, 2021
177d9ef
ironic provisioner de-duplicate image options
Dec 14, 2020
ba4222d
Merge pull request #750 from hardys/image_dedup
metal3-io-bot Jan 13, 2021
0e1acfe
Ironic: Add result functions
zaneb Jan 5, 2021
ac23a91
Ironic: Use retryAfterDelay() to handle conflicts
zaneb Jan 5, 2021
5faf361
Ironic: Use retryAfterDelay() for other retries
zaneb Jan 5, 2021
aa1b485
Add andfasano to reviewers list
zaneb Jan 14, 2021
0f07962
Merge pull request #764 from zaneb/andfasano-reviewer
metal3-io-bot Jan 14, 2021
c1e13c5
Ironic: Use operationComplete() when complete
zaneb Jan 7, 2021
54c8028
Ironic: Return operationContinuing() for delays
zaneb Jan 5, 2021
6857a7f
Ironic: Use transientError() to return errors
zaneb Jan 7, 2021
1e6fd34
Ironic: Use operationFailed() to handle failures
zaneb Jan 7, 2021
4b4c29d
Ironic: Use hostUpdated() to handle Status updates
zaneb Jan 5, 2021
50f97a7
Return provisioner ID from ValidateManagementAccess()
zaneb Jan 8, 2021
cd60f7d
Return power status from UpdateHardwareState()
zaneb Jan 8, 2021
1279a47
Fixture: store state separately to provisioner
zaneb Jan 9, 2021
0656b7e
Prevent provisioners modifying the Host
zaneb Jan 8, 2021
cbaa73d
Make actionRegistering() logs less chatty
zaneb Jan 12, 2021
3102c74
Don't write Status on every actionContinue
zaneb Jan 9, 2021
98d7131
Stop treating actionRegistering() like a state action
zaneb Jan 14, 2021
2fdae0d
Merge pull request #760 from Nordix/fix-state-bote
metal3-io-bot Jan 15, 2021
ea587bb
Merge pull request #761 from zaneb/semantic-return
metal3-io-bot Jan 15, 2021
a308ddf
Handle deploy failed state when deprovisioning
zaneb Dec 8, 2020
24ba8a0
Don't adopt in deprovisioning if provisioning didn't complete
zaneb Dec 8, 2020
0253aa5
Get correct image checksum in getImageUpdateOptsForNode()
zaneb Jan 18, 2021
50a08ad
Merge pull request #768 from zaneb/getImageUpdateOpts-checksum
metal3-io-bot Jan 18, 2021
167711f
Add test coverage of Spec vs Status Image
Jan 19, 2021
5228638
Remove root_gb workaround
Jan 13, 2021
d519c19
Merge pull request #771 from hardys/rm_root_gb
metal3-io-bot Jan 19, 2021
1b56112
Merge pull request #745 from zaneb/deprov-fixes
metal3-io-bot Jan 20, 2021
1328a89
Merge pull request #727 from Hellcatlk/master
metal3-io-bot Jan 20, 2021
aac441c
Add live-iso option to DiskFormat
Jan 7, 2021
a10a2ad
Ensure adoption is retried upon failure
stbenjam Jan 18, 2021
0f12bb2
Add live-iso support to ironic provisioner
Dec 15, 2020
78fa25a
Add api docs for live-iso
Jan 14, 2021
d921a06
Merge pull request #759 from hardys/liveimage2
metal3-io-bot Jan 20, 2021
625678a
Merge pull request #762 from stbenjam/fix-adoption
metal3-io-bot Jan 20, 2021
ba38688
Ironic: Don't adopt after clean failure during deprovisioning
zaneb Jan 20, 2021
7410cef
Merge pull request #770 from hardys/image_tests
metal3-io-bot Jan 20, 2021
c7fc5dd
Use errorType intead of errorMessage
fmuyassarov Jan 20, 2021
1a9bba9
Limit hosts simultaneously provisioned
andfasano Jan 15, 2021
2f6b99b
Review ErrorCount tests
andfasano Jan 18, 2021
c34562a
Merge pull request #774 from Nordix/error-message-bmo/feruz
metal3-io-bot Jan 22, 2021
a425eed
Add missing newline in console log
s3rj1k Jan 26, 2021
51c157d
Ask Ironic to include NodeUUID when querying ports
honza Jan 22, 2021
cb1564d
Merge pull request #778 from s3rj1k/newline
metal3-io-bot Jan 26, 2021
5cac40c
Merge pull request #772 from zaneb/deprov-fixes
metal3-io-bot Jan 26, 2021
1ccc746
Merge pull request #776 from honza/port-details
metal3-io-bot Jan 26, 2021
1dc7f4c
Fail registration when boot MAC conflicts
honza Jan 26, 2021
5a1153d
Add "NET_RAW" to ironic-endpoint-keepalived
Jan 28, 2021
20d4da5
Merge pull request #780 from honza/mac-address-error
metal3-io-bot Jan 29, 2021
3f79aae
Merge pull request #725 from andfasano/limit-hosts
metal3-io-bot Jan 29, 2021
aa9b416
Merge pull request #782 from Nordix/fix-add-cap-bote
metal3-io-bot Feb 1, 2021
ec18e6e
Merge upstream
honza Feb 1, 2021
1cbb1cd
Update vendor
honza Feb 1, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
79 changes: 23 additions & 56 deletions apis/metal3.io/v1alpha1/baremetalhost_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,18 @@ const (
// OperationalStatusError is the status value for when the host
// has any sort of error.
OperationalStatusError OperationalStatus = "error"

OperationalStatusDelayed = "delayed"
)

// ErrorType indicates the class of problem that has caused the Host resource
// to enter an error state.
type ErrorType string

const (
// ProvisionedRegistrationError is an error condition occurring when the controller
// is unable to re-register an already provisioned host.
ProvisionedRegistrationError ErrorType = "provisioned registration error"
// RegistrationError is an error condition occurring when the
// controller is unable to connect to the Host's baseboard management
// controller.
Expand Down Expand Up @@ -297,22 +302,26 @@ type Image struct {
URL string `json:"url"`

// Checksum is the checksum for the image.
Checksum string `json:"checksum"`
Checksum string `json:"checksum,omitempty"`

// ChecksumType is the checksum algorithm for the image.
// e.g md5, sha256, sha512
ChecksumType ChecksumType `json:"checksumType,omitempty"`

// DiskFormat contains the format of the image (raw, qcow2, ...)
// Needs to be set to raw for raw images streaming
// +kubebuilder:validation:Enum=raw;qcow2;vdi;vmdk
// DiskFormat contains the format of the image (raw, qcow2, ...).
// Needs to be set to raw for raw images streaming.
// Note live-iso means an iso referenced by the url will be live-booted
// and not deployed to disk, and in this case the checksum options
// are not required and if specified will be ignored.
// +kubebuilder:validation:Enum=raw;qcow2;vdi;vmdk;live-iso
DiskFormat *string `json:"format,omitempty"`
}

// FIXME(dhellmann): We probably want some other module to own these
// data structures.

// ClockSpeed is a clock speed in MHz
// +kubebuilder:validation:Format=double
type ClockSpeed float64

// ClockSpeed multipliers
Expand Down Expand Up @@ -516,12 +525,12 @@ type BareMetalHostStatus struct {
// after modifying this file

// OperationalStatus holds the status of the host
// +kubebuilder:validation:Enum="";OK;discovered;error
// +kubebuilder:validation:Enum="";OK;discovered;error;delayed
OperationalStatus OperationalStatus `json:"operationalStatus"`

// ErrorType indicates the type of failure encountered when the
// OperationalStatus is OperationalStatusError
// +kubebuilder:validation:Enum=registration error;inspection error;provisioning error;power management error
// +kubebuilder:validation:Enum=provisioned registration error;registration error;inspection error;provisioning error;power management error
ErrorType ErrorType `json:"errorType,omitempty"`

// LastUpdated identifies when this status was last observed.
Expand Down Expand Up @@ -584,12 +593,12 @@ type ProvisionStatus struct {
// +kubebuilder:resource:shortName=bmh;bmhost
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.operationalStatus",description="Operational status",priority=1
// +kubebuilder:printcolumn:name="Provisioning_Status",type="string",JSONPath=".status.provisioning.state",description="Provisioning status"
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.provisioning.state",description="Provisioning status"
// +kubebuilder:printcolumn:name="Consumer",type="string",JSONPath=".spec.consumerRef.name",description="Consumer using this host"
// +kubebuilder:printcolumn:name="BMC",type="string",JSONPath=".spec.bmc.address",description="Address of management controller",priority=1
// +kubebuilder:printcolumn:name="Hardware_Profile",type="string",JSONPath=".status.hardwareProfile",description="The type of hardware detected",priority=1
// +kubebuilder:printcolumn:name="Online",type="string",JSONPath=".spec.online",description="Whether the host is online or not"
// +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.errorMessage",description="Most recent error"
// +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.errorType",description="Type of the most recent error"
// +kubebuilder:object:root=true
type BareMetalHost struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -608,48 +617,6 @@ func (host *BareMetalHost) BootMode() BootMode {
return mode
}

// Available returns true if the host is available to be provisioned.
func (host *BareMetalHost) Available() bool {
if host.Spec.ConsumerRef != nil {
return false
}
if host.GetDeletionTimestamp() != nil {
return false
}
if host.HasError() {
return false
}
return true
}

// SetErrorMessage updates the ErrorMessage in the host Status struct
// and increases the ErrorCount
func (host *BareMetalHost) SetErrorMessage(errType ErrorType, message string) {
host.Status.OperationalStatus = OperationalStatusError
host.Status.ErrorType = errType
host.Status.ErrorMessage = message
host.Status.ErrorCount++
}

// ClearError removes any existing error message.
func (host *BareMetalHost) ClearError() (dirty bool) {
dirty = host.SetOperationalStatus(OperationalStatusOK)
var emptyErrType ErrorType = ""
if host.Status.ErrorType != emptyErrType {
host.Status.ErrorType = emptyErrType
dirty = true
}
if host.Status.ErrorMessage != "" {
host.Status.ErrorMessage = ""
dirty = true
}
if host.Status.ErrorCount != 0 {
host.Status.ErrorCount = 0
dirty = true
}
return dirty
}

// setLabel updates the given label when necessary and returns true
// when a change is made or false when no change is made.
func (host *BareMetalHost) setLabel(name, value string) bool {
Expand Down Expand Up @@ -713,12 +680,6 @@ func (host *BareMetalHost) OperationalStatus() OperationalStatus {
return host.Status.OperationalStatus
}

// HasError returns a boolean indicating whether there is an error
// set for the host.
func (host *BareMetalHost) HasError() bool {
return host.Status.ErrorMessage != ""
}

// CredentialsKey returns a NamespacedName suitable for loading the
// Secret containing the credentials associated with the host.
func (host *BareMetalHost) CredentialsKey() types.NamespacedName {
Expand Down Expand Up @@ -859,6 +820,12 @@ func (image *Image) GetChecksum() (checksum, checksumType string, ok bool) {
return
}

if image.DiskFormat != nil && *image.DiskFormat == "live-iso" {
// Checksum is not required for live-iso
ok = true
return
}

if image.Checksum == "" {
// Return empty if checksum is not provided
return
Expand Down
102 changes: 0 additions & 102 deletions apis/metal3.io/v1alpha1/baremetalhost_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,13 @@ package v1alpha1

import (
"testing"
"time"

"github.com/stretchr/testify/assert"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestHostAvailable(t *testing.T) {
hostWithError := BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
}
hostWithError.SetErrorMessage(RegistrationError, "oops something went wrong")

testCases := []struct {
Host BareMetalHost
Expected bool
FailMessage string
}{
{
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
},
Expected: true,
FailMessage: "available host returned not available",
},
{
Host: hostWithError,
Expected: false,
FailMessage: "host with error returned as available",
},
{
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
},
Spec: BareMetalHostSpec{
ConsumerRef: &corev1.ObjectReference{
Name: "mymachine",
Namespace: "myns",
},
},
},
Expected: false,
FailMessage: "host with consumerref returned as available",
},
{
Host: BareMetalHost{
ObjectMeta: metav1.ObjectMeta{
Name: "myhost",
Namespace: "myns",
DeletionTimestamp: &metav1.Time{Time: time.Now()},
},
},
Expected: false,
FailMessage: "deleted host returned as available",
},
}

for _, tc := range testCases {
if tc.Host.Available() != tc.Expected {
t.Error(tc.FailMessage)
}
}
}

func TestHostNeedsHardwareInspection(t *testing.T) {

testCases := []struct {
Expand Down Expand Up @@ -554,39 +488,3 @@ func TestBootMode(t *testing.T) {
})
}
}

func TestErrorCountIncrementsAlways(t *testing.T) {

b := &BareMetalHost{}
assert.Equal(t, b.Status.ErrorCount, 0)

b.SetErrorMessage(RegistrationError, "An error message")
assert.Equal(t, b.Status.ErrorCount, 1)

b.SetErrorMessage(InspectionError, "Another error message")
assert.Equal(t, b.Status.ErrorCount, 2)
}

func TestClearErrorCount(t *testing.T) {

b := &BareMetalHost{
Status: BareMetalHostStatus{
ErrorCount: 5,
},
}

assert.True(t, b.ClearError())
assert.Equal(t, 0, b.Status.ErrorCount)
}

func TestClearErrorCountOnlyIfNotZero(t *testing.T) {

b := &BareMetalHost{
Status: BareMetalHostStatus{
ErrorCount: 5,
},
}

assert.True(t, b.ClearError())
assert.False(t, b.ClearError())
}
17 changes: 10 additions & 7 deletions config/crd/bases/metal3.io_baremetalhosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
type: string
- description: Provisioning status
jsonPath: .status.provisioning.state
name: Provisioning_Status
name: State
type: string
- description: Consumer using this host
jsonPath: .spec.consumerRef.name
Expand All @@ -47,8 +47,8 @@ spec:
jsonPath: .spec.online
name: Online
type: string
- description: Most recent error
jsonPath: .status.errorMessage
- description: Type of the most recent error
jsonPath: .status.errorType
name: Error
type: string
name: v1alpha1
Expand Down Expand Up @@ -141,18 +141,18 @@ spec:
- sha512
type: string
format:
description: DiskFormat contains the format of the image (raw, qcow2, ...) Needs to be set to raw for raw images streaming
description: DiskFormat contains the format of the image (raw, qcow2, ...). Needs to be set to raw for raw images streaming. Note live-iso means an iso referenced by the url will be live-booted and not deployed to disk, and in this case the checksum options are not required and if specified will be ignored.
enum:
- raw
- qcow2
- vdi
- vmdk
- live-iso
type: string
url:
description: URL is a location of an image to deploy.
type: string
required:
- checksum
- url
type: object
metaData:
Expand Down Expand Up @@ -262,6 +262,7 @@ spec:
errorType:
description: ErrorType indicates the type of failure encountered when the OperationalStatus is OperationalStatusError
enum:
- provisioned registration error
- registration error
- inspection error
- provisioning error
Expand Down Expand Up @@ -293,6 +294,7 @@ spec:
type: string
clockMegahertz:
description: ClockSpeed is a clock speed in MHz
format: double
type: number
count:
type: integer
Expand Down Expand Up @@ -523,6 +525,7 @@ spec:
- OK
- discovered
- error
- delayed
type: string
poweredOn:
description: indicator for whether or not the host is powered on
Expand Down Expand Up @@ -553,18 +556,18 @@ spec:
- sha512
type: string
format:
description: DiskFormat contains the format of the image (raw, qcow2, ...) Needs to be set to raw for raw images streaming
description: DiskFormat contains the format of the image (raw, qcow2, ...). Needs to be set to raw for raw images streaming. Note live-iso means an iso referenced by the url will be live-booted and not deployed to disk, and in this case the checksum options are not required and if specified will be ignored.
enum:
- raw
- qcow2
- vdi
- vmdk
- live-iso
type: string
url:
description: URL is a location of an image to deploy.
type: string
required:
- checksum
- url
type: object
rootDeviceHints:
Expand Down
Loading