Skip to content

Commit

Permalink
Cherry pick: fix taking rootfs as filesystem by mistake (tikv#11554) (#…
Browse files Browse the repository at this point in the history
…52)

* fix adding rootfs as filesystem by mistake

Signed-off-by: onlyacat <[email protected]>

* reformat by lints

Signed-off-by: onlyacat <[email protected]>

* close tikv#11552

Signed-off-by: onlyacat <[email protected]>
Signed-off-by: CalvinNeo <[email protected]>

Co-authored-by: Z.H <[email protected]>
Co-authored-by: Zhigao Tong <[email protected]>
  • Loading branch information
3 people authored Mar 24, 2022
1 parent 55152e1 commit a1ffca1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/server/service/diagnostics/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,19 +362,18 @@ fn disk_hardware_info(collector: &mut Vec<ServerInfoItem>) {
system.refresh_disks();
let disks = system.get_disks();
for disk in disks {
let file_sys = std::str::from_utf8(disk.get_file_system()).unwrap_or("unknown");
if file_sys == "rootfs" {
continue;
}
let total = disk.get_total_space();
let free = disk.get_available_space();
let used = total - free;
let free_pct = (free as f64) / (total as f64);
let used_pct = (used as f64) / (total as f64);
let infos = vec![
("type", format!("{:?}", disk.get_type())),
(
"fstype",
std::str::from_utf8(disk.get_file_system())
.unwrap_or("unkonwn")
.to_string(),
),
("fstype", file_sys.to_string()),
(
"path",
disk.get_mount_point()
Expand Down

0 comments on commit a1ffca1

Please sign in to comment.