1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

F #1226: Support for KVM iothreads (#783)

This commit is contained in:
Pavel Czerný 2021-02-11 15:33:09 +01:00 committed by GitHub
parent 3d5196c9ea
commit 05e6d4472a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 8 deletions

View File

@ -1231,8 +1231,8 @@ CommandParser::CmdParser.new(ARGV) do
This command accepts a template file or opens an editor, the full list of
configuration attributes are:
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT"]
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT"]
OS = ["ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "UUID"]
FEATURES = ["ACPI", "PAE", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT", "IOTHREADS"]
INPUT = ["TYPE", "BUS"]
GRAPHICS = ["TYPE", "LISTEN", "PASSWD", "KEYMAP" ]
RAW = ["DATA", "DATA_VMX", "TYPE"]

View File

@ -836,6 +836,7 @@ function get_source_xml {
# * WRITE_IOPS_SEC_MAX
# * WRITE_IOPS_SEC_MAX_LENGTH
# * SIZE_IOPS_SEC
# * IOTHREAD
# * TYPE_SOURCE: libvirt xml source name. $TYPE_SOURCE=$SOURCE => file=/my/path
# * SOURCE: disk source, can be path, ceph pool/image, device...
# * TYPE_XML
@ -900,7 +901,8 @@ function get_disk_information {
$DISK_XPATH/WRITE_IOPS_SEC \
$DISK_XPATH/WRITE_IOPS_SEC_MAX \
$DISK_XPATH/WRITE_IOPS_SEC_MAX_LENGTH \
$DISK_XPATH/SIZE_IOPS_SEC )
$DISK_XPATH/SIZE_IOPS_SEC \
$DISK_XPATH/IOTHREAD )
VMID="${XPATH_ELEMENTS[j++]}"
DRIVER="${XPATH_ELEMENTS[j++]:-$DEFAULT_TYPE}"
@ -944,6 +946,7 @@ function get_disk_information {
WRITE_IOPS_SEC_MAX="${XPATH_ELEMENTS[j++]}"
WRITE_IOPS_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
SIZE_IOPS_SEC="${XPATH_ELEMENTS[j++]}"
IOTHREAD="${XPATH_ELEMENTS[j++]}"
TYPE=$(echo "$TYPE"|tr A-Z a-z)
READONLY=$(echo "$READONLY"|tr A-Z a-z)

View File

@ -2769,7 +2769,7 @@ void VirtualMachine::get_public_clouds(const string& pname, set<string> &clouds)
static std::map<std::string,std::vector<std::string>> UPDATECONF_ATTRS = {
{"OS", {"ARCH", "MACHINE", "KERNEL", "INITRD", "BOOTLOADER", "BOOT", "KERNEL_CMD", "ROOT", "SD_DISK_BUS", "UUID"} },
{"FEATURES", {"PAE", "ACPI", "APIC", "LOCALTIME", "HYPERV", "GUEST_AGENT",
"VIRTIO_SCSI_QUEUES"} },
"VIRTIO_SCSI_QUEUES", "IOTHREADS"} },
{"INPUT", {"TYPE", "BUS"} },
{"GRAPHICS", {"TYPE", "LISTEN", "PASSWD", "KEYMAP", "COMMAND"} },
{"RAW", {"TYPE", "DATA", "DATA_VMX"} },

View File

@ -478,6 +478,7 @@ int LibVirtDriver::deployment_description_kvm(
string write_iops_sec_max_length = "";
string write_iops_sec_max = "";
string size_iops_sec;
string iothreadid;
string default_total_bytes_sec = "";
string default_total_bytes_sec_max_length = "";
@ -561,6 +562,8 @@ int LibVirtDriver::deployment_description_kvm(
bool guest_agent = false;
int virtio_scsi_queues = 0;
int scsi_targets_num = 0;
int iothreads = 0;
int iothread_actual = 1;
string hyperv_options = "";
@ -806,6 +809,13 @@ int LibVirtDriver::deployment_description_kvm(
file << mbacking;
}
get_attribute(vm, host, cluster, "FEATURES", "IOTHREADS", iothreads);
if ( iothreads > 0 )
{
file << "\t<iothreads>" << iothreads << "</iothreads>" << endl;
}
// ------------------------------------------------------------------------
// DEVICES SECTION
// ------------------------------------------------------------------------
@ -924,6 +934,7 @@ int LibVirtDriver::deployment_description_kvm(
write_iops_sec_max_length = disk[i]->vector_value("WRITE_IOPS_SEC_MAX_LENGTH");
size_iops_sec = disk[i]->vector_value("SIZE_IOPS_SEC");
iothreadid = disk[i]->vector_value("IOTHREAD");
set_sec_default(read_bytes_sec, default_read_bytes_sec);
set_sec_default(read_bytes_sec_max, default_read_bytes_sec_max);
@ -1212,6 +1223,21 @@ int LibVirtDriver::deployment_description_kvm(
file << " discard=" << one_util::escape_xml_attr(default_driver_discard);
}
if ( iothreads > 0 && disk_bus == "virtio" )
{
int iothreadid_i = to_i(iothreadid);
if (iothreadid_i > 0 && iothreadid_i <= iothreads)
{
file << " iothread=" << one_util::escape_xml_attr(iothreadid_i);
}
else
{
file << " iothread=" << one_util::escape_xml_attr(iothread_actual);
iothread_actual = (iothread_actual % iothreads) + 1;
}
}
file << "/>" << endl;
// ---- I/O Options ----
@ -1725,11 +1751,22 @@ int LibVirtDriver::deployment_description_kvm(
<< "\t\t<controller type='scsi' index='0' model='virtio-scsi'>"
<< endl;
file << "\t\t\t<driver";
if ( virtio_scsi_queues > 0 )
{
file << "\t\t\t<driver queues='" << virtio_scsi_queues << "'/>" << endl;
file << " queues=" << one_util::escape_xml_attr(virtio_scsi_queues);
}
if ( iothreads > 0 )
{
file << " iothread=" << one_util::escape_xml_attr(iothread_actual);
iothread_actual = (iothread_actual % iothreads) + 1;
}
file << "/>" << endl;
file << "\t\t</controller>" << endl
<< "\t</devices>" << endl;
}

View File

@ -21,9 +21,9 @@
# - os [kernel,initrd,boot,root,kernel_cmd,arch,machine,sd_disk_bus]
# - vcpu
# - memory_slots: number of memory slots for hotplug memory
# - features [acpi, pae, apic, hyperv, localtime, guest_agent, virtio_scsi_queues]
# - features [acpi, pae, apic, hyperv, localtime, guest_agent, virtio_scsi_queues, iothreads]
# - cpu_model [model]
# - disk [driver, cache, io, discard, total_bytes_sec, total_iops_sec, read_bytes_sec, write_bytes_sec, read_iops_sec, write_iops_sec]
# - disk [driver, cache, io, discard, total_bytes_sec, total_iops_sec, read_bytes_sec, write_bytes_sec, read_iops_sec, write_iops_sec, size_iops_sec]
# - nic [filter, model]
# - raw
# - hyperv_options: options used for FEATURES = [ HYPERV = yes ]
@ -45,7 +45,8 @@ FEATURES = [
APIC = "no",
HYPERV = "no",
GUEST_AGENT = "yes",
VIRTIO_SCSI_QUEUES = "1"
VIRTIO_SCSI_QUEUES = "1",
IOTHREADS = "0"
]
#CPU_MODEL = [ MODEL = "host-passthrough"]

View File

@ -87,6 +87,7 @@ XML+="<driver name='qemu' type='$(xml_esc "${DRIVER}")'"
[ -n "${CACHE}" ] && XML+=" cache='$(xml_esc "${CACHE}")'"
[ -n "${DISK_IO}" ] && XML+=" io='$(xml_esc "${DISK_IO}")'"
[ -n "${DISCARD}" ] && XML+=" discard='$(xml_esc "${DISCARD}")'"
[ -n "${IOTHREAD}" ] && XML+=" iothread='$(xml_esc "${IOTHREAD}")'"
XML+="/>"
XML+="<source ${TYPE_SOURCE}='$(xml_esc "${SOURCE}")' ${SOURCE_ARGS}>"