Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move StaticHeader into its own file #1792

Merged

Conversation

GuillaumeGomez
Copy link
Contributor

Part of #1573.

cc @mulkieran

@stratis-bot
Copy link

Test with Jenkins?

2 similar comments
@stratis-bot
Copy link

Test with Jenkins?

@stratis-bot
Copy link

Test with Jenkins?

@mulkieran
Copy link
Member

ok to test

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for coming back! Generally it looks good; I found a few things I noted. Please also move the test method test_ownership into the static header test methods as it has become a pure StaticHeader test.

sizes::{BDAExtendedSize, BlockdevSize, MDADataSize},
static_header::{device_identifiers, disown_device, StaticHeader},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't export StaticHeader...I think we may have to export eventually, but for now we get along great with just exporting device_identifiers and disown_device.

#[derive(Debug)]
pub struct BDA {
header: StaticHeader,
regions: mda::MDARegions,
}

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
enum MetadataLocation {
pub enum MetadataLocation {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move the definition of this type into the static_header module and import it into the bda module. It defines the API of some static_header methods which some bda methods call, so that is the best place to put it.

@GuillaumeGomez
Copy link
Contributor Author

Updated!

@mulkieran
Copy link
Member

The Jenkins test failure duplicates the ones in Travis, just an unused import:

  Compiling libstratis v2.0.0 (/home/fedora/workspace/stratisd)
error: unused import: `StaticHeader`
   --> src/engine/strat_engine/backstore/metadata/bda.rs:151:69
    |
151 |         tests::random_static_header, tests::static_header_strategy, StaticHeader,
    |                                                                     ^^^^^^^^^^^^
    |
    = note: `-D unused-imports` implied by `-D unused`

@GuillaumeGomez
Copy link
Contributor Author

Updated.

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than the requested changes to the use directives, this all looks good to me! Please make the changes and squash into one commit and I'll put it up for final review.


use devicemapper::{Bytes, Sectors, IEC};

use super::super::sizes::{static_header_size, MDADataSize};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use absolute name, should be crate::engine::strat_engine::metadata::sizes::{static_header_size, MDADataSize};


use super::super::sizes::static_header_size;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use crate name and merge the imports, as:

use crate::engine::strat_engine::metadata::{sizes::static_header_size, static_header::{tests::random_static_header, tests::static_header_strategy}}

But always leave the use super::*; separate in tests, which is the only place we use it.

@GuillaumeGomez
Copy link
Contributor Author

Updated.

@mulkieran
Copy link
Member

Whoops! It's not strat_engine::metadata, it's strat_engine::backstore::metadata.

@GuillaumeGomez
Copy link
Contributor Author

Arf, I didn't double-check, my bad!

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, correct import strat_engine::backstory::metadata still missing in one file. Also, please make sure to rebase to pull in latest Travis updates.

@GuillaumeGomez GuillaumeGomez force-pushed the move-stratis-header branch 4 times, most recently from 88b658f to 398a285 Compare February 4, 2020 16:11
@GuillaumeGomez GuillaumeGomez force-pushed the move-stratis-header branch 3 times, most recently from 2161a98 to ae18dae Compare February 4, 2020 20:55
Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one more thing about the imports...otherwise it's ready to go.


use devicemapper::{Bytes, Sectors, IEC};

use super::*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please reverse the order here as well.

@GuillaumeGomez
Copy link
Contributor Author

Done as well!

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@GuillaumeGomez Could you grab this commit 390eb43 and squash it onto your work? Then it should be entirely done, and we can move it into final review. Thanks!

@GuillaumeGomez
Copy link
Contributor Author

Done!

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, looks good!

@mulkieran mulkieran removed the request for review from jbaublitz February 6, 2020 14:34
Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops! Please add license header to newly created file.

@GuillaumeGomez
Copy link
Contributor Author

Updated. :)

Copy link
Member

@mulkieran mulkieran left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok!

@mulkieran mulkieran merged commit 78fbf7a into stratis-storage:develop Feb 6, 2020
@GuillaumeGomez GuillaumeGomez deleted the move-stratis-header branch February 6, 2020 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants