Skip to content

Commit 56eb785

Browse files
committed
include zfs list failure output, and bubble it up
1 parent 652b668 commit 56eb785

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

agent/src/datafile.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ impl DataFile {
464464
path.into_os_string().into_string().unwrap(),
465465
) {
466466
Ok(dataset) => dataset,
467-
Err(_e) => {
467+
Err(e) => {
468468
// This branch can only be entered if `zfs list` for that
469469
// dataset path failed to return anything.
470470

@@ -482,18 +482,21 @@ impl DataFile {
482482
// This is a bug: according to the agent's datafile,
483483
// the region exists, but according to zfs list, it
484484
// does not
485-
bail!("Agent thinks region {} exists but zfs list does not!", request.id.0);
485+
bail!("Agent thinks region {} exists but zfs list does not! {e}", request.id.0);
486486
}
487487

488488
State::Failed => {
489489
// Something has set the region to state failed, so
490490
// we can't delete this snapshot.
491-
bail!("Region {} is in state failed", request.id.0);
491+
bail!(
492+
"Region {} is in state failed! {e}",
493+
request.id.0
494+
);
492495
}
493496
}
494497
} else {
495498
// In here, the region never existed!
496-
bail!("Inside region {} snapshot {} delete, region never existed!", request.id.0, request.name);
499+
bail!("Inside region {} snapshot {} delete, region never existed! {e}", request.id.0, request.name);
497500
}
498501
}
499502
};

agent/src/main.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ impl ZFSDataset {
9898
.output()?;
9999

100100
if !cmd.status.success() {
101-
bail!("zfs list failed!");
101+
let stderr =
102+
String::from_utf8_lossy(&cmd.stderr).trim_end().to_string();
103+
bail!("zfs list failed! {stderr}");
102104
}
103105

104106
Ok(ZFSDataset {

0 commit comments

Comments
 (0)