Skip to content

Commit 0fe2273

Browse files
authored
fix: dynamically assign raid type when creating a storage volume for Dells (#40)
This PR dynamically finds the RAID type based on the amount of drives present in the BOSS controller instead of taking it as input in `create_storage_volume()`. - 1 drive = `RAID0` - 2 drives = `RAID1` - else, throw an error Signed-off-by: Krish Dandiwala <kdandiwala@nvidia.com>
1 parent 637ed19 commit 0fe2273

File tree

13 files changed

+23
-23
lines changed

13 files changed

+23
-23
lines changed

src/ami.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,10 +825,9 @@ impl Redfish for Bmc {
825825
&self,
826826
controller_id: &str,
827827
volume_name: &str,
828-
raid_type: &str,
829828
) -> Result<Option<String>, RedfishError> {
830829
self.s
831-
.create_storage_volume(controller_id, volume_name, raid_type)
830+
.create_storage_volume(controller_id, volume_name)
832831
.await
833832
}
834833

src/dell.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,9 +1011,21 @@ impl Redfish for Bmc {
10111011
&self,
10121012
controller_id: &str,
10131013
volume_name: &str,
1014-
raid_type: &str,
10151014
) -> Result<Option<String>, RedfishError> {
10161015
let drives = self.get_storage_drives(controller_id).await?;
1016+
1017+
let raid_type = match drives.as_array().map(|a| a.len()).unwrap_or(0) {
1018+
1 => "RAID0",
1019+
2 => "RAID1",
1020+
n => {
1021+
return Err(RedfishError::GenericError {
1022+
error: format!(
1023+
"Expected 1 or 2 drives for BOSS controller {controller_id}, found {n}"
1024+
),
1025+
});
1026+
}
1027+
};
1028+
10171029
Ok(Some(
10181030
self.create_storage_volume(controller_id, volume_name, raid_type, drives)
10191031
.await?,

src/hpe.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,10 +881,9 @@ impl Redfish for Bmc {
881881
&self,
882882
controller_id: &str,
883883
volume_name: &str,
884-
raid_type: &str,
885884
) -> Result<Option<String>, RedfishError> {
886885
self.s
887-
.create_storage_volume(controller_id, volume_name, raid_type)
886+
.create_storage_volume(controller_id, volume_name)
888887
.await
889888
}
890889

src/lenovo.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,9 @@ impl Redfish for Bmc {
935935
&self,
936936
controller_id: &str,
937937
volume_name: &str,
938-
raid_type: &str,
939938
) -> Result<Option<String>, RedfishError> {
940939
self.s
941-
.create_storage_volume(controller_id, volume_name, raid_type)
940+
.create_storage_volume(controller_id, volume_name)
942941
.await
943942
}
944943

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@ pub trait Redfish: Send + Sync + 'static {
510510
&self,
511511
controller_id: &str,
512512
volume_name: &str,
513-
raid_type: &str,
514513
) -> Result<Option<String>, RedfishError>;
515514

516515
fn ac_powercycle_supported_by_power(&self) -> bool;

src/liteon_powershelf.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,10 +632,9 @@ impl Redfish for Bmc {
632632
&self,
633633
controller_id: &str,
634634
volume_name: &str,
635-
raid_type: &str,
636635
) -> Result<Option<String>, RedfishError> {
637636
self.s
638-
.create_storage_volume(controller_id, volume_name, raid_type)
637+
.create_storage_volume(controller_id, volume_name)
639638
.await
640639
}
641640

src/nvidia_dpu.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -798,10 +798,9 @@ impl Redfish for Bmc {
798798
&self,
799799
controller_id: &str,
800800
volume_name: &str,
801-
raid_type: &str,
802801
) -> Result<Option<String>, RedfishError> {
803802
self.s
804-
.create_storage_volume(controller_id, volume_name, raid_type)
803+
.create_storage_volume(controller_id, volume_name)
805804
.await
806805
}
807806

src/nvidia_gbswitch.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,10 +724,9 @@ impl Redfish for Bmc {
724724
&self,
725725
controller_id: &str,
726726
volume_name: &str,
727-
raid_type: &str,
728727
) -> Result<Option<String>, RedfishError> {
729728
self.s
730-
.create_storage_volume(controller_id, volume_name, raid_type)
729+
.create_storage_volume(controller_id, volume_name)
731730
.await
732731
}
733732

src/nvidia_gbx00.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,10 +1017,9 @@ impl Redfish for Bmc {
10171017
&self,
10181018
controller_id: &str,
10191019
volume_name: &str,
1020-
raid_type: &str,
10211020
) -> Result<Option<String>, RedfishError> {
10221021
self.s
1023-
.create_storage_volume(controller_id, volume_name, raid_type)
1022+
.create_storage_volume(controller_id, volume_name)
10241023
.await
10251024
}
10261025

src/nvidia_gh200.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,10 +684,9 @@ impl Redfish for Bmc {
684684
&self,
685685
controller_id: &str,
686686
volume_name: &str,
687-
raid_type: &str,
688687
) -> Result<Option<String>, RedfishError> {
689688
self.s
690-
.create_storage_volume(controller_id, volume_name, raid_type)
689+
.create_storage_volume(controller_id, volume_name)
691690
.await
692691
}
693692

0 commit comments

Comments
 (0)