#[derive(Clone, Debug, Eq, PartialEq)]
pub struct Disk {
+ pub index: String,
pub path: String,
pub model: Option<String>,
pub size: u64,
impl cmp::PartialOrd for Disk {
fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> {
- self.path.partial_cmp(&other.path)
+ self.index.partial_cmp(&other.index)
}
}
impl cmp::Ord for Disk {
fn cmp(&self, other: &Self) -> cmp::Ordering {
- self.path.cmp(&other.path)
+ self.index.cmp(&other.index)
}
}
config.zfs_opts = Some(zfs.clone().into());
for disk in &options.bootdisk.disks {
- config.disk_selection.insert(disk.path.clone(), 1);
+ config.disk_selection.insert(disk.index.clone(), 1);
}
}
AdvancedBootdiskOptions::Btrfs(btrfs) => {
config.hdsize = btrfs.disk_size;
for disk in &options.bootdisk.disks {
- config.disk_selection.insert(disk.path.clone(), 1);
+ config.disk_selection.insert(disk.index.clone(), 1);
}
}
}
Ok(disks
.into_iter()
.map(
- |(_index, device, size_mb, model, logical_bsize, _syspath)| Disk {
+ |(index, device, size_mb, model, logical_bsize, _syspath)| Disk {
+ index: index.to_string(),
size: size_mb * logical_bsize,
path: device,
model: (!model.is_empty()).then_some(model),