Skip to content

Commit

Permalink
Add a list of alternate disk names to HardwareDetails
Browse files Browse the repository at this point in the history
Give users a way of seeing all of the alternate names for the disk that
we have discovered, even if they are not stable across reboots.
  • Loading branch information
zaneb committed May 9, 2023
1 parent 15d9c73 commit 505781a
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 1 deletion.
5 changes: 5 additions & 0 deletions apis/metal3.io/v1alpha1/baremetalhost_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ type Storage struct {
// that is stable across reboots if one is available.
Name string `json:"name,omitempty"`

// A list of alternate Linux device names of the disk, e.g. "/dev/sda".
// Note that this list is not exhaustive, and names may not be stable
// across reboots.
AlternateNames []string `json:"alternateNames,omitempty"`

// Whether this disk represents rotational storage.
// This field is not recommended for usage, please
// prefer using 'Type' field instead, this field
Expand Down
9 changes: 8 additions & 1 deletion apis/metal3.io/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions config/crd/bases/metal3.io_baremetalhosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ spec:
description: Storage describes one storage device (disk, SSD,
etc.) on the host.
properties:
alternateNames:
description: A list of alternate Linux device names of the
disk, e.g. "/dev/sda". Note that this list is not exhaustive,
and names may not be stable across reboots.
items:
type: string
type: array
hctl:
description: The SCSI location of the device
type: string
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/metal3.io_hardwaredata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,13 @@ spec:
description: Storage describes one storage device (disk, SSD,
etc.) on the host.
properties:
alternateNames:
description: A list of alternate Linux device names of the
disk, e.g. "/dev/sda". Note that this list is not exhaustive,
and names may not be stable across reboots.
items:
type: string
type: array
hctl:
description: The SCSI location of the device
type: string
Expand Down
14 changes: 14 additions & 0 deletions config/render/capm3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,13 @@ spec:
description: Storage describes one storage device (disk, SSD,
etc.) on the host.
properties:
alternateNames:
description: A list of alternate Linux device names of the
disk, e.g. "/dev/sda". Note that this list is not exhaustive,
and names may not be stable across reboots.
items:
type: string
type: array
hctl:
description: The SCSI location of the device
type: string
Expand Down Expand Up @@ -1438,6 +1445,13 @@ spec:
description: Storage describes one storage device (disk, SSD,
etc.) on the host.
properties:
alternateNames:
description: A list of alternate Linux device names of the
disk, e.g. "/dev/sda". Note that this list is not exhaustive,
and names may not be stable across reboots.
items:
type: string
type: array
hctl:
description: The SCSI location of the device
type: string
Expand Down
3 changes: 3 additions & 0 deletions pkg/provisioner/ironic/hardwaredetails/hardwaredetails.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,14 @@ func getStorageDetails(diskdata []introspection.RootDiskType) []metal3v1alpha1.S
storage := make([]metal3v1alpha1.Storage, len(diskdata))
for i, disk := range diskdata {
device := disk.Name
allNames := []string{device}
if disk.ByPath != "" {
device = disk.ByPath
allNames = append(allNames, device)
}
storage[i] = metal3v1alpha1.Storage{
Name: device,
AlternateNames: allNames,
Rotational: disk.Rotational,
Type: getDiskType(disk),
SizeBytes: metal3v1alpha1.Capacity(disk.Size),
Expand Down

0 comments on commit 505781a

Please sign in to comment.