Repository navigation
source: separate reading libxenstat from filling its gaps - #11
Merged
Merged
Conversation
XenstatSource::sample copied a node out of libxenstat and patched what the library lacks in one go. Now: - read_node(): the FFI copy into a Snapshot, the only place libxenstat's structures are touched (all the unsafe code); - gaps::fill(): plain Rust over the Snapshot for pCPU idle time, VIFs, steal time and tapdisk3 latency, returning where each came from. The host collectors (libxenctrl, /proc/net/dev, tapdisk3 stats files) sit behind a small Collectors trait; HostCollectors is the real one. DataStatus is set from the result exactly as before, and each collector is still only called when the snapshot needs it. Vbd3Index hands over its map (into_map) instead of is_empty()/read(). New tests with fake collectors cover every status value and that nothing is read when the library is complete. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tor/xenstat-enrich
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Item 2 of the cleanup plan. Stacked on #10 (base
refactor/lib-loading); behavior-preserving.Changes
XenstatSource::sampleused to copy a node out of libxenstat and patch what the library lacks in one pass. Now:read_node()(xenstat.rs): the FFI copy into aSnapshot, as the library reports it. All the unsafe code that touches libxenstat's structures is here.gaps::fill()(newsrc/source/gaps.rs): plain Rust over theSnapshotfor pCPU idle time, VIFs, steal time and tapdisk3 latency. Returns where each came from (Gaps), whichsamplecopies intoDataStatusexactly as before./proc/net/dev, tapdisk3 stats files) sit behind a smallCollectorstrait;HostCollectorsis the real one, holding the libxenctrl handles that used to be fields ofXenstatSource. Each collector is still only called when the snapshot needs it.Vbd3Index::into_map()replacesis_empty()/read().sampleis now: read node → fill gaps → xenstore storage → xapi names.Testing
Availvalue for each class, VIFs rebuilt per guest in id order (dom0 and guests that have VIFs untouched), steal per domain, tapdisk3 latency from stats files, and that no collector is called when the library is complete.cargo test78 passed; clippy-D warningsand fmt clean.xenstat_init()as before. Please run it on an XCP-ng host (stock and patched libxenstat if possible) and compare theipanel /--batch"sources"with 0.4.0.🤖 Generated with Claude Code