Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Large diffs are not rendered by default.

20 changes: 13 additions & 7 deletions lustre-collector/src/osd_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ where
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
choice((
(param(BRW_STATS), brw_stats().map(OsdStat::BrwStats)),
(param(BRW_STATS), brw_stats().map(OsdStat::BrwStats)).message("while parsing brw_stats"),
(
param(FILES_FREE),
digits().skip(newline()).map(OsdStat::FilesFree),
Expand All @@ -108,15 +108,18 @@ where
(
param(KBYTES_AVAIL),
digits().skip(newline()).map(OsdStat::KBytesAvail),
),
)
.message("while parsing kbytesavail"),
(
param(KBYTES_FREE),
digits().skip(newline()).map(OsdStat::KBytesFree),
),
)
.message("while parsing kbytesfree"),
(
param(KBYTES_TOTAL),
digits().skip(newline()).map(OsdStat::KBytesTotal),
),
)
.message("while parsing kbytestotal"),
(
param(QUOTA_ACCT_GRP),
quota_stats_osd().map(|stats| {
Expand All @@ -125,7 +128,8 @@ where
stats,
})
}),
),
)
.message("while parsing quota_slave.acct_group"),
(
param(QUOTA_ACCT_PRJ),
quota_stats_osd().map(|stats| {
Expand All @@ -134,7 +138,8 @@ where
stats,
})
}),
),
)
.message("while parsing quota_slave.acct_project"),
(
param(QUOTA_ACCT_USR),
quota_stats_osd().map(|stats| {
Expand All @@ -143,7 +148,8 @@ where
stats,
})
}),
),
)
.message("while parsing quota_slave.acct_user"),
))
}

Expand Down
2 changes: 2 additions & 0 deletions lustre-collector/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ mod tests {

test_fixtures!(test_lustre_2_14_0_ddn133_fixtures, "*ddn133*");

test_fixtures!(test_lustre_2_14_0_ddn184_fixtures, "*ddn184*");

#[test]
fn test_params() {
assert_debug_snapshot!(params());
Expand Down
11 changes: 9 additions & 2 deletions lustre-collector/src/quota/quota_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ where
I: Stream<Token = char>,
I::Error: ParseError<I::Token, I::Range, I::Position>,
{
(
let not_supported_parser = attempt(
string("not supported")
.skip(optional(newline()))
.map(|_| Vec::new()),
);

let yaml_parser = (
optional(newline()), // If quota stats are present, the whole yaml blob will start on a newline
take_until::<Vec<_>, _, _>(newline()), // But yaml header might not be indented, ignore it
newline(),
Expand All @@ -93,7 +99,8 @@ where
.skip(optional(eof()))
.and_then(|(_, _, _, x): (_, _, _, String)| {
serde_yaml::from_str::<Vec<QuotaStatOsd>>(&x).map_err(StreamErrorFor::<I>::other)
})
});
not_supported_parser.or(yaml_parser)
}

#[derive(Debug)]
Expand Down
Loading
Loading