block: Add BackingFilesDisabled error for actionable user guidance

When a QCOW2 image has a backing file but backing_files=on is not set,
the error was MaxNestingDepthExceeded which gives no indication that
this is a policy decision or how to resolve it.

Add a BackingFilesDisabled error variant whose message indicates that
backing file support is disabled and references the backing_files
option. The translation from MaxNestingDepthExceeded to
BackingFilesDisabled happens at the QcowDiskSync boundary where the
policy decision is made, preserving the original error for genuine
recursive depth exhaustion.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
This commit is contained in:
Anatol Belski
2026-02-19 11:22:28 +01:00
committed by Rob Bradford
parent 68f746fbea
commit 94368c622e
2 changed files with 13 additions and 6 deletions

View File

@@ -44,6 +44,8 @@ pub enum Error {
BackingFileIo(#[source] io::Error),
#[error("Backing file open error")]
BackingFileOpen(#[source] Box<Error>),
#[error("Backing file support is disabled")]
BackingFilesDisabled,
#[error("Backing file name is too long: {0} bytes over")]
BackingFileTooLong(usize),
#[error("Image is marked corrupt and cannot be opened for writing")]