Skip to content

Commit

Permalink
fix: trace errno in lvol destroy error message
Browse files Browse the repository at this point in the history
Also return verbose errors in the grpc status for the catch all internal errors.

Signed-off-by: Tiago Castro <[email protected]>
  • Loading branch information
tiagolobocastro committed Oct 4, 2022
1 parent 11e24a4 commit a9d536c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mayastor/src/bdev/nexus/nexus_bdev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl From<Error> for tonic::Status {
Error::ChildNotFound {
..
} => Status::not_found(e.to_string()),
e => Status::new(Code::Internal, e.to_string()),
e => Status::new(Code::Internal, e.verbose()),
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion mayastor/src/grpc/mayastor_grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use tonic::{Request, Response, Status};
#[derive(Debug)]
struct UnixStream(tokio::net::UnixStream);

use crate::bdev::nexus::VerboseError;
use ::function_name::named;
use std::{panic::AssertUnwindSafe, pin::Pin};
use version_info::raw_version_string;
Expand Down Expand Up @@ -174,7 +175,7 @@ impl From<LvsError> for Status {
LvsError::InvalidBdev {
source, ..
} => source.into(),
_ => Status::internal(e.to_string()),
_ => Status::internal(e.verbose()),
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions mayastor/src/lvs/lvol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,10 @@ impl Lvol {
r.await
.expect("lvol destroy callback is gone")
.to_result(|e| {
warn!("error while destroying lvol {}", name);
let errno = Errno::from_i32(e);
warn!("error while destroying lvol {}: {}", name, errno);
Error::RepDestroy {
source: Errno::from_i32(e),
source: errno,
name: name.clone(),
}
})?;
Expand Down

0 comments on commit a9d536c

Please sign in to comment.