Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Add a list of alternate disk names to HardwareDetails #1269

Merged
merged 2 commits into from
Sep 20, 2023
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
10 changes: 8 additions & 2 deletions apis/metal3.io/v1alpha1/baremetalhost_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,10 +519,16 @@ type CPU struct {

// Storage describes one storage device (disk, SSD, etc.) on the host.
type Storage struct {
// The Linux device name of the disk, e.g. "/dev/sda". Note that this
// may not be stable across reboots.
// A Linux device name of the disk, e.g.
// "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0". This will be a name
// 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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify this will be a list of known device names from Inspection excluding the one in Name field?

Also maybe we should sort | uniq this list somewhere?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the proposed implementation it includes the name in the name field, and entries are unique. Also, the true kernel device (e.g. /dev/sda) always appears first.


// 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.

12 changes: 10 additions & 2 deletions config/crd/bases/metal3.io_baremetalhosts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -663,15 +663,23 @@ 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
model:
description: Hardware model
type: string
name:
description: The Linux device name of the disk, e.g. "/dev/sda".
Note that this may not be stable across reboots.
description: A Linux device name of the disk, e.g. "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0".
This will be a name that is stable across reboots if one
is available.
type: string
rotational:
description: Whether this disk represents rotational storage.
Expand Down
12 changes: 10 additions & 2 deletions config/crd/bases/metal3.io_hardwaredata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,23 @@ 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
model:
description: Hardware model
type: string
name:
description: The Linux device name of the disk, e.g. "/dev/sda".
Note that this may not be stable across reboots.
description: A Linux device name of the disk, e.g. "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0".
This will be a name that is stable across reboots if one
is available.
type: string
rotational:
description: Whether this disk represents rotational storage.
Expand Down
24 changes: 20 additions & 4 deletions config/render/capm3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -662,15 +662,23 @@ 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
model:
description: Hardware model
type: string
name:
description: The Linux device name of the disk, e.g. "/dev/sda".
Note that this may not be stable across reboots.
description: A Linux device name of the disk, e.g. "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0".
This will be a name that is stable across reboots if one
is available.
type: string
rotational:
description: Whether this disk represents rotational storage.
Expand Down Expand Up @@ -1437,15 +1445,23 @@ 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
model:
description: Hardware model
type: string
name:
description: The Linux device name of the disk, e.g. "/dev/sda".
Note that this may not be stable across reboots.
description: A Linux device name of the disk, e.g. "/dev/disk/by-path/pci-0000:01:00.0-scsi-0:2:0:0".
This will be a name that is stable across reboots if one
is available.
type: string
rotational:
description: Whether this disk represents rotational storage.
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
zaneb marked this conversation as resolved.
Show resolved Hide resolved
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