Skip to content

StaticHeader::setup Improve error reporting #1443

@tasleson

Description

@tasleson

Note: Taken from #1440 (comment)

fn setup<F>(f: &mut F) -> StratisResult<Option<StaticHeader>>
    where
        F: Read + Seek + SyncAll,

This returns an error in two situations:

  • If the metadata seems to indicate that the device is a Stratis deivce, but no well-formed signature could be found.
  • If a well-formed signature was found but an error occurred during the repair of a second, ill-formed, old, or unreadable signature.

I think it is right to return an error in the first case, but I think the second should possibly be handled differently. I think a good option is to enrich the return type to

StratisResult<Option<StaticHeader>, Option<some error thing if repair fails>>

Additionally, taken from: #1440 (comment)

let err_str =  "Appeared to be a Stratis device, but no valid sigblock found";
Err(StratisError::Engine(ErrorEnum::Invalid, err_str.into()))

Actually, better to include both errors, and improve the error messages in the errors returned from sigblock_from_buf.

Metadata

Metadata

Assignees

Labels

sub-issueissue that has a parent

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions