namespace deletion: propagate delete-groups=false but ENOTEMPTY as error

after all we couldn't delete all that got requested, ideally this
should become a task where we can log what got deleted and what
not...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht 2022-05-15 16:32:46 +02:00
parent 60b9676fa2
commit 3aafa61362
2 changed files with 6 additions and 1 deletions

View File

@ -487,6 +487,7 @@ impl DataStore {
log::debug!("namespace {ns} already removed")
}
Err(nix::Error::Sys(nix::errno::Errno::ENOTEMPTY)) if !delete_groups => {
removed_all_requested = false;
log::debug!("skip removal of non-empty namespace {ns}")
}
Err(err) => {

View File

@ -168,7 +168,11 @@ pub fn delete_namespace(
let datastore = DataStore::lookup_datastore(&store, Some(Operation::Write))?;
if !datastore.remove_namespace_recursive(&ns, delete_groups)? {
bail!("group only partially deleted due to protected snapshots");
if delete_groups {
bail!("group only partially deleted due to protected snapshots");
} else {
bail!("only partially deleted due to existing groups but `delete-groups` not true ");
}
}
Ok(Value::Null)