Skip to content

Commit

Permalink
fix(launchpad): make sure the correct primary path is used
Browse files Browse the repository at this point in the history
- when dealing with unix, every mount point would start with '/', so
instead find the point that ends with '/'. This would be our primary
partition.
  • Loading branch information
RolandSherwin authored and jacderida committed Jun 26, 2024
1 parent ba7e252 commit bf6695a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion node-launchpad/src/components/manage_nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,20 @@ impl ManageNodes {

fn get_available_space_b() -> Result<usize> {
let disks = Disks::new_with_refreshed_list();
if tracing::level_enabled!(tracing::Level::DEBUG) {
for disk in disks.list() {
let res = disk.mount_point().ends_with(Self::get_mount_point());
debug!(
"Disk: {disk:?} ends with '{:?}': {res:?}",
Self::get_mount_point()
);
}
}

let available_space_b = disks
.list()
.iter()
.find(|disk| disk.mount_point().starts_with(Self::get_mount_point()))
.find(|disk| disk.mount_point().ends_with(Self::get_mount_point()))
.context("Cannot find the primary disk")?
.available_space() as usize;

Expand Down

0 comments on commit bf6695a

Please sign in to comment.