Skip to content
Closed
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
2 changes: 1 addition & 1 deletion crates/kit/src/libvirt/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ impl DomainBuilder {
"filesystem",
&[("type", "mount"), ("accessmode", "passthrough")],
)?;
writer.write_empty_element("driver", &[("type", "virtiofs"), ("queue", "1024")])?;
writer.write_empty_element("driver", &[("type", "virtiofs"), ("queue", "4096")])?;

Choose a reason for hiding this comment

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

medium

The virtiofs queue size 4096 is a magic number. To improve readability and maintainability, it's best to define this as a constant. This also makes it easier to update in the future and to reference from tests.

The tests in test_virtiofs_filesystem_configuration are currently failing because they still assert the old queue size of 1024. Using a constant would help resolve this and prevent it from happening in the future.

You can add the following constant at the top of the file:

const VIRTIOFS_QUEUE_SIZE: &str = "4096";

Then, use this constant here and in the tests.

Suggested change
writer.write_empty_element("driver", &[("type", "virtiofs"), ("queue", "4096")])?;
writer.write_empty_element("driver", &[("type", "virtiofs"), ("queue", VIRTIOFS_QUEUE_SIZE)])?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't have any theory offhand why increasing the queue size here would make a difference - unless it somehow could relate to the maximum number of fds?

Either way it's probably useful to have an explicit rationale for why we picked the number. A reference to another virt framework (libvirt or systemd-vmspawn) could make sense here.

Copy link
Author

Choose a reason for hiding this comment

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

I don't have any theory offhand why increasing the queue size here would make a difference - unless it somehow could relate to the maximum number of fds?

The change was proposed by AI, and I meant want to give it a try, though I do not sure about this.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you! Looks this is not great to set to 4096, will close this and find another workaround.

Potential upside
Slight improvement only if:

- Very high parallel fs ops
- Many vCPUs (≥16–32)
- Heavy metadata churn (massive parallel builds, stress tests)

Copy link
Collaborator

Choose a reason for hiding this comment

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

The change was proposed by AI,

That's fine, though why was this commit missing the attribution?
https://github.com/bootc-dev/infra/blob/2dd498656b9653c321e5d9a8600e6b506714acb3/common/AGENTS.md#attribution

Not a big deal, but it's really helpful to know in general when one is looking at something a human thought vs something that came from AI or a hybrid.

if filesystem.readonly {
writer.write_empty_element("readonly", &[])?;
}
Expand Down
Loading