api2/node/disks/zfs: check if default zfs mount path exists
and if it does bail, because otherwise we would get an error on mounting and have a zpool that is not imported and disks that are used Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
parent
6e1f0c138f
commit
b91b7d9ffd
|
@ -298,6 +298,18 @@ pub fn create_zpool(
|
|||
bail!("{:?} needs at least {} disks.", raidlevel, min_disks);
|
||||
}
|
||||
|
||||
// check if the default path does exist already and bail if it does
|
||||
// otherwise we get an error on mounting
|
||||
let mut default_path = std::path::PathBuf::from("/");
|
||||
default_path.push(&name);
|
||||
|
||||
match std::fs::metadata(&default_path) {
|
||||
Err(_) => {}, // path does not exist
|
||||
Ok(_) => {
|
||||
bail!("path {:?} already exists", default_path);
|
||||
}
|
||||
}
|
||||
|
||||
let upid_str = WorkerTask::new_thread(
|
||||
"zfscreate", Some(name.clone()), &username.clone(), to_stdout, move |worker|
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue