1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-01-22 22:03:39 +03:00

F #5225: Support for kvm size_iops_size (#743)

This commit is contained in:
Pavel Czerný 2021-02-08 16:59:55 +01:00 committed by GitHub
parent 6da9f7f6c7
commit d132bab6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 6 deletions

View File

@ -855,6 +855,7 @@ VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC_MAX"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC_MAX"
VM_RESTRICTED_ATTR = "DISK/SIZE_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/OPENNEBULA_MANAGED"
VM_RESTRICTED_ATTR = "DISK/VCENTER_DS_REF"
VM_RESTRICTED_ATTR = "DISK/VCENTER_INSTANCE_ID"

View File

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

View File

@ -477,6 +477,7 @@ int LibVirtDriver::deployment_description_kvm(
string write_iops_sec = "";
string write_iops_sec_max_length = "";
string write_iops_sec_max = "";
string size_iops_sec;
string default_total_bytes_sec = "";
string default_total_bytes_sec_max_length = "";
@ -496,6 +497,7 @@ int LibVirtDriver::deployment_description_kvm(
string default_write_iops_sec = "";
string default_write_iops_sec_max_length = "";
string default_write_iops_sec_max = "";
string default_size_iops_sec;
int disk_id;
int order;
@ -615,11 +617,13 @@ int LibVirtDriver::deployment_description_kvm(
file << "\t<title>" << vm->get_name() << "</title>" << endl;
auto os = vm->get_template_attribute("OS");
auto uuid = os->vector_value("UUID");
if (!uuid.empty())
if (os)
{
file << "\t<uuid>" << uuid << "</uuid>" << endl;
auto uuid = os->vector_value("UUID");
if (!uuid.empty())
{
file << "\t<uuid>" << uuid << "</uuid>" << endl;
}
}
// ------------------------------------------------------------------------
@ -860,6 +864,8 @@ int LibVirtDriver::deployment_description_kvm(
get_attribute(nullptr, host, cluster, "DISK", "WRITE_IOPS_SEC_MAX", default_write_iops_sec_max);
get_attribute(nullptr, host, cluster, "DISK", "WRITE_IOPS_SEC_MAX_LENGTH", default_write_iops_sec_max_length);
get_attribute(nullptr, host, cluster, "DISK", "SIZE_IOPS_SEC", default_size_iops_sec);
// ------------------------------------------------------------------------
num = vm->get_template_attribute("DISK", disk);
@ -917,6 +923,8 @@ int LibVirtDriver::deployment_description_kvm(
write_iops_sec_max = disk[i]->vector_value("WRITE_IOPS_SEC_MAX");
write_iops_sec_max_length = disk[i]->vector_value("WRITE_IOPS_SEC_MAX_LENGTH");
size_iops_sec = disk[i]->vector_value("SIZE_IOPS_SEC");
set_sec_default(read_bytes_sec, default_read_bytes_sec);
set_sec_default(read_bytes_sec_max, default_read_bytes_sec_max);
set_sec_default(read_bytes_sec_max_length, default_read_bytes_sec_max_length);
@ -941,6 +949,8 @@ int LibVirtDriver::deployment_description_kvm(
set_sec_default(total_iops_sec_max, default_total_iops_sec_max);
set_sec_default(total_iops_sec_max_length, default_total_iops_sec_max_length);
set_sec_default(size_iops_sec, default_size_iops_sec);
disk[i]->vector_value_str("DISK_ID", disk_id);
if (target.empty())
@ -1252,6 +1262,12 @@ int LibVirtDriver::deployment_description_kvm(
total_iops_sec_max , total_iops_sec_max_length);
}
if ( !size_iops_sec.empty() && !(total_iops_sec.empty()
&& read_iops_sec.empty() && write_iops_sec.empty()))
{
insert_sec(file, "size_iops", size_iops_sec, "", "");
}
file << "\t\t\t</iotune>" << endl;
}

View File

@ -76,6 +76,7 @@ READ_IOPS_SEC_MAX=${READ_IOPS_SEC_MAX:-${DEFAULT_ATTACH_READ_IOPS_SEC_MAX}}
WRITE_IOPS_SEC=${WRITE_IOPS_SEC:-${DEFAULT_ATTACH_WRITE_IOPS_SEC}}
WRITE_IOPS_SEC_MAX_LENGTH=${WRITE_IOPS_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX_LENGTH}}
WRITE_IOPS_SEC_MAX=${WRITE_IOPS_SEC_MAX:-${DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX}}
SIZE_IOPS_SEC=${SIZE_IOPS_SEC:-${DEFAULT_ATTACH_SIZE_IOPS_SEC}}
# disk XML
XML=''
@ -116,7 +117,7 @@ then
"${WRITE_BYTES_SEC_MAX_LENGTH}"
fi
if [ -n "${TOTAL_BYTES_SEC}${TOTAL_BYTES_SEC_MAX}" ]; then
if [ -n "${TOTAL_IOPS_SEC}${TOTAL_IOPS_SEC_MAX}" ]; then
insert_sec "total_iops" "${TOTAL_IOPS_SEC}" "${TOTAL_IOPS_SEC_MAX}" \
"${TOTAL_IOPS_SEC_MAX_LENGTH}"
else
@ -127,6 +128,12 @@ then
"${WRITE_IOPS_SEC_MAX_LENGTH}"
fi
if [ -n "${SIZE_IOPS_SEC}" ] && \
[ -n "${TOTAL_IOPS_SEC}${READ_IOPS_SEC}${WRITE_IOPS_SEC}" ];
then
insert_sec "size_iops" "${SIZE_IOPS_SEC}" "" ""
fi
XML+="</iotune>"
fi

View File

@ -79,6 +79,7 @@ DEFAULT_ATTACH_DISCARD=unmap
#DEFAULT_ATTACH_WRITE_IOPS_SEC=
#DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX=
#DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX_LENGTH=
#DEFAULT_SIZE_IOPS_SEC=
# This parameters will set the default NIC model and filter for
# the hot-attached interfaces.