Skip to content

Commit

Permalink
F #6435: Automatic setting of NIC IO queues
Browse files Browse the repository at this point in the history
This commit adds support for "auto" setting for virtio queues of NICs.
It follows the approach implemented by VIRTIO_BLK_QUEUES for DISKS.

The commit also includes default setting and RSunstone implementation

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
  • Loading branch information
rsmontero committed Jan 30, 2025
1 parent 950f33c commit 983066a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,10 @@
{{tr "Transmission queue"}}
{{{tip (tr "Only supported for virtio driver.")}}}
</label>
<input type="number" min="0" wizard_field="VIRTIO_QUEUES" id="VIRTIO_QUEUES" name="VIRTIO_QUEUES" />
<select wizard_field="VIRTIO_QUEUES" id="VIRTIO_QUEUES" name="VIRTIO_QUEUES">
<option value=""> - </option>
<option value="auto">Auto</option>
</select>
</div>
</div>
<div class="row pci-row">
Expand Down
16 changes: 15 additions & 1 deletion src/vmm/LibVirtDriverKVM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,8 @@ int LibVirtDriver::deployment_description_kvm(
string o_peak_kb;

string default_filter;
string default_model ;
string default_model;
string default_virtio_queues;

const VectorAttribute * graphics;

Expand Down Expand Up @@ -1697,6 +1698,8 @@ int LibVirtDriver::deployment_description_kvm(

get_attribute(nullptr, host, cluster, "NIC", "MODEL", default_model);

get_attribute(nullptr, host, cluster, "NIC", "VIRTIO_QUEUES", default_virtio_queues);

num = vm->get_template_attribute("NIC", nic);

for (int i=0; i<num; i++)
Expand Down Expand Up @@ -1795,6 +1798,17 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t\t\t<model type="
<< one_util::escape_xml_attr(*the_model) << "/>\n";

if (!virtio_queues.empty())
{
set_queues(virtio_queues, vcpu)
}
else if (!default_virtio_queues.empty())
{
set_queues(default_virtio_queues, vcpu)

virtio_queues = default_virtio_queues;
}

if (!virtio_queues.empty() && *the_model == "virtio")
{
file << "\t\t\t<driver name='vhost' queues="
Expand Down
4 changes: 3 additions & 1 deletion src/vmm_mad/exec/vmm_exec_kvm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
# * NIC:
# - FILTER
# - MODEL
# - VIRTIO_QUEUES
# * RAW: raw attribute value is appended to that on the VM template
# * HYPERV_OPTIONS: options used for FEATURES = [ HYPERV = yes ]
# * HYPERV_TIMERS: timers added when HYPERV is set to yes in FEATURES
Expand Down Expand Up @@ -114,7 +115,8 @@ DISK = [
]

NIC = [
MODEL = "virtio"
MODEL = "virtio",
VIRTIO_QUEUES = "auto"
# FILTER = "clean-traffic"
]

Expand Down

0 comments on commit 983066a

Please sign in to comment.