tools/disks: skip lsblk for partition check

We already have a 'Disk' which has a udev 'Device' which we can query
directly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2023-11-29 17:20:30 +01:00
parent 7dddf742b8
commit 7fb5bd39e2

View File

@ -1121,17 +1121,8 @@ pub fn wipe_blockdev(disk: &Disk, worker: Arc<WorkerTask>) -> Result<(), Error>
Some(path) => path, Some(path) => path,
None => bail!("disk {:?} has no node in /dev", disk.syspath()), None => bail!("disk {:?} has no node in /dev", disk.syspath()),
}; };
let disk_path_str = match disk_path.to_str() {
Some(path) => path,
None => bail!("disk {:?} could not transform into a str", disk.syspath()),
};
let mut is_partition = false; let is_partition = disk.is_partition();
for disk_info in get_lsblk_info()?.iter() {
if disk_info.path == disk_path_str && disk_info.partition_type.is_some() {
is_partition = true;
}
}
let mut to_wipe: Vec<PathBuf> = Vec::new(); let mut to_wipe: Vec<PathBuf> = Vec::new();