Move memory conversion helpers to libvirt module#84
Conversation
Summary of ChangesHello @cgwalters, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the codebase by relocating libvirt-specific memory parsing and conversion utilities. The goal is to enhance the logical grouping of code, ensuring that functions directly related to libvirt XML processing reside within the dedicated Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a good refactoring that moves libvirt-specific memory conversion helpers from a general utility module to the more appropriate libvirt module. This improves code organization and modularity. I've identified a critical issue related to a potential integer overflow that could lead to incorrect memory calculations, along with a few suggestions to improve code maintainability.
a2c5585 to
2aa31c4
Compare
jmarrero
left a comment
There was a problem hiding this comment.
code lgtm but CI is not happy
|
Yeah my bad for trying to fix this manually, after chatting with an agent the issue became more obvious (I thought it was |
The module structure was twisted and this caused dead_code they belong, as these are libvirt-specific helpers for parsing libvirt domain XML memory specifications, not generic XML utilities. Assisted-by: Claude Code Signed-off-by: Colin Walters <walters@verbum.org>
We were missing the lint setup between the main kit crate and the workspace. Fix up the resulting warnings. Signed-off-by: Colin Walters <walters@verbum.org>
Clean up duplication. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
Our unit stuff was messy, this cleans it up a lot. Maybe at some point we should look for a crate that handles explicit units. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
Refactor string parsing to use idiomatic Rust methods: - parse_size: Use strip_suffix for unit detection instead of rfind/split_at - parse_memory_to_mb: Use strip_suffix for G/M/K detection - libvirt/domain: Use strip_prefix for "bridge=" prefix removal This is cleaner, more readable, and follows Rust best practices. Assisted-by: Claude Code (Sonnet 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
The module structure was twisted and this caused dead_code they belong, as these are libvirt-specific helpers for parsing libvirt domain XML memory specifications, not generic XML utilities.
Assisted-by: Claude Code