[pbs-devel] [PATCH proxmox-backup v3 05/24] add helper for checking if a removable datastore is available
Dietmar Maurer
dietmar at proxmox.com
Wed Apr 10 10:40:21 CEST 2024
All public functions should have docs!
> +pub fn check_if_available(config: &DataStoreConfig) -> Result<(), Error> {
> + config.backing_device.as_ref().map_or(Ok(()), |uuid| {
> + let mut command = std::process::Command::new("findmnt");
> + command.args(["-n", "-o", "TARGET", "--source", &format!("UUID={uuid}")]);
> +
> + match proxmox_sys::command::run_command(command, None) {
> + Ok(mount_point) if mount_point.trim_end() == config.path => Ok(()),
> + _ => Err(format_err!(
> + "device for datastore '{}' has to be mounted at '{}'",
> + config.name,
> + config.path
> + )),
> + }
> + })
> +}
More information about the pbs-devel
mailing list