1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

F #1439: Added new attributes to set maximum values (#2060)

* F #1439: Added new attributes to set maximum values

* F #1439: Added attributes to oned.conf

* F #1439: Added new attributes to Sunstone
This commit is contained in:
juanmont 2018-05-04 17:12:16 +02:00 committed by Tino Vázquez
parent 0b11b765ac
commit f42f43b6a2
7 changed files with 199 additions and 19 deletions

View File

@ -775,11 +775,17 @@ VM_RESTRICTED_ATTR = "NIC_DEFAULT/BRIDGE"
#VM_RESTRICTED_ATTR = "NIC/VCENTER_NET_REF"
#VM_RESTRICTED_ATTR = "NIC/VCENTER_PORTGROUP_TYPE"
VM_RESTRICTED_ATTR = "DISK/TOTAL_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/TOTAL_BYTES_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/READ_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/READ_BYTES_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/WRITE_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_BYTES_SEC_MAX"
VM_RESTRICTED_ATTR = "DISK/TOTAL_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/TOTAL_IOPS_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC_MAX"
#VM_RESTRICTED_ATTR = "DISK/OPENNEBULA_MANAGED"
#VM_RESTRICTED_ATTR = "DISK/VCENTER_DS_REF"
#VM_RESTRICTED_ATTR = "DISK/VCENTER_INSTANCE_ID"

View File

@ -998,11 +998,17 @@ VM_RESTRICTED_ATTR = "NIC_DEFAULT/MAC"
VM_RESTRICTED_ATTR = "NIC_DEFAULT/VLAN_ID"
VM_RESTRICTED_ATTR = "NIC_DEFAULT/BRIDGE"
VM_RESTRICTED_ATTR = "DISK/TOTAL_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/TOTAL_BYTES_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/READ_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/READ_BYTES_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/WRITE_BYTES_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_BYTES_SEC_MAX"
VM_RESTRICTED_ATTR = "DISK/TOTAL_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/TOTAL_IOPS_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/READ_IOPS_SEC_MAX_LENGTH"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC"
VM_RESTRICTED_ATTR = "DISK/WRITE_IOPS_SEC_MAX"
VM_RESTRICTED_ATTR = "DISK/OPENNEBULA_MANAGED"
VM_RESTRICTED_ATTR = "DISK/VCENTER_DS_REF"
VM_RESTRICTED_ATTR = "DISK/VCENTER_INSTANCE_ID"

View File

@ -690,11 +690,17 @@ function get_source_xml {
# * DISK_IO
# * ORDER
# * TOTAL_BYTES_SEC
# * TOTAL_BYTES_SEC_MAX_LENGTH
# * READ_BYTES_SEC
# * READ_BYTES_SEC_MAX_LENGTH
# * WRITE_BYTES_SEC
# * WRITE_BYTES_SEC_MAX
# * TOTAL_IOPS_SEC
# * TOTAL_IOPS_SEC_MAX_LENGTH
# * READ_IOPS_SEC
# * READ_IOPS_SEC_MAX_LENGTH
# * WRITE_IOPS_SEC
# * WRITE_IOPS_SEC_MAX
# * TYPE_SOURCE: libvirt xml source name. $TYPE_SOURCE=$SOURCE => file=/my/path
# * SOURCE: disk source, can be path, ceph pool/image, device...
# * TYPE_XML
@ -741,11 +747,17 @@ function get_disk_information {
$DISK_XPATH/IO \
$DISK_XPATH/ORDER \
$DISK_XPATH/TOTAL_BYTES_SEC \
$DISK_XPATH/TOTAL_BYTES_SEC_MAX_LENGTH \
$DISK_XPATH/READ_BYTES_SEC \
$DISK_XPATH/READ_BYTES_SEC_MAX_LENGTH \
$DISK_XPATH/WRITE_BYTES_SEC \
$DISK_XPATH/WRITE_BYTES_SEC_MAX \
$DISK_XPATH/TOTAL_IOPS_SEC \
$DISK_XPATH/TOTAL_IOPS_SEC_MAX_LENGTH \
$DISK_XPATH/READ_IOPS_SEC \
$DISK_XPATH/WRITE_IOPS_SEC)
$DISK_XPATH/READ_IOPS_SEC_MAX_LENGTH \
$DISK_XPATH/WRITE_IOPS_SEC \
$DISK_XPATH/WRITE_IOPS_SEC_MAX )
VMID="${XPATH_ELEMENTS[j++]}"
DRIVER="${XPATH_ELEMENTS[j++]:-$DEFAULT_TYPE}"
@ -770,11 +782,17 @@ function get_disk_information {
DISK_IO="${XPATH_ELEMENTS[j++]}"
ORDER="${XPATH_ELEMENTS[j++]}"
TOTAL_BYTES_SEC="${XPATH_ELEMENTS[j++]}"
TOTAL_BYTES_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
READ_BYTES_SEC="${XPATH_ELEMENTS[j++]}"
READ_BYTES_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
WRITE_BYTES_SEC="${XPATH_ELEMENTS[j++]}"
WRITE_BYTES_SEC_MAX="${XPATH_ELEMENTS[j++]}"
TOTAL_IOPS_SEC="${XPATH_ELEMENTS[j++]}"
TOTAL_IOPS_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
READ_IOPS_SEC="${XPATH_ELEMENTS[j++]}"
READ_IOPS_SEC_MAX_LENGTH="${XPATH_ELEMENTS[j++]}"
WRITE_IOPS_SEC="${XPATH_ELEMENTS[j++]}"
WRITE_IOPS_SEC_MAX="${XPATH_ELEMENTS[j++]}"
TYPE=$(echo "$TYPE"|tr A-Z a-z)
READONLY=$(echo "$READONLY"|tr A-Z a-z)

View File

@ -144,6 +144,25 @@
<input wizard_field="WRITE_BYTES_SEC" type="number" min="0" id="WRITE_BYTES_SEC" name="WRITE_BYTES_SEC" />
</fieldset>
</div>
<div class="medium-6 columns hypervisor only_kvm">
<fieldset>
<legend>{{tr "Max IO throttling (bytes/s)"}}</legend>
<label for="TOTAL_BYTES_SEC_MAX_LENGTH">
{{tr "Maximum total (read+write) bytes/s"}}
</label>
<input wizard_field="TOTAL_BYTES_SEC_MAX_LENGTH" type="number" min="0" id="TOTAL_BYTES_SEC_MAX_LENGTH" name="TOTAL_BYTES_SEC_MAX_LENGTH" />
<label for="READ_BYTES_SEC_MAX_LENGTH">
{{tr "Maximum read bytes/s"}}
</label>
<input wizard_field="READ_BYTES_SEC_MAX_LENGTH" type="number" min="0" id="READ_BYTES_SEC_MAX_LENGTH" name="READ_BYTES_SEC_MAX_LENGTH" />
<label for="WRITE_BYTES_SEC">
{{tr "Maximum write bytes/s"}}
</label>
<input wizard_field="WRITE_BYTES_SEC_MAX" type="number" min="0" id="WRITE_BYTES_SEC_MAX" name="WRITE_BYTES_SEC_MAX" />
</fieldset>
</div>
</div>
<div class="row vm_param">
<div class="medium-6 columns hypervisor only_kvm">
<fieldset>
<legend>{{tr "IO throttling (IOPS)"}}</legend>
@ -161,4 +180,21 @@
<input wizard_field="WRITE_IOPS_SEC" type="number" min="0" id="WRITE_IOPS_SEC" name="WRITE_IOPS_SEC" />
</fieldset>
</div>
<div class="medium-6 columns hypervisor only_kvm">
<fieldset>
<legend>{{tr "Max IO throttling (IOPS)"}}</legend>
<label for="TOTAL_IOPS_SEC_MAX_LENGTH">
{{tr "Maximum total (read+write) IOPS"}}
</label>
<input wizard_field="TOTAL_IOPS_SEC_MAX_LENGTH" type="number" min="0" id="TOTAL_IOPS_SEC_MAX_LENGTH" name="TOTAL_IOPS_SEC_MAX_LENGTH" />
<label for="READ_IOPS_SEC_MAX_LENGTH">
{{tr "Maximum read IOPS"}}
</label>
<input wizard_field="READ_IOPS_SEC_MAX_LENGTH" type="number" min="0" id="READ_IOPS_SEC_MAX_LENGTH" name="READ_IOPS_SEC_MAX_LENGTH" />
<label for="WRITE_IOPS_SEC_MAX">
{{tr "Maximum write IOPS Sec"}}
</label>
<input wizard_field="WRITE_IOPS_SEC_MAX" type="number" min="0" id="WRITE_IOPS_SEC_MAX" name="WRITE_IOPS_SEC_MAX" />
</fieldset>
</div>
</div>

View File

@ -142,19 +142,31 @@ int LibVirtDriver::deployment_description_kvm(
string gluster_host = "";
string gluster_volume = "";
string total_bytes_sec = "";
string read_bytes_sec = "";
string write_bytes_sec = "";
string total_iops_sec = "";
string read_iops_sec = "";
string write_iops_sec = "";
string total_bytes_sec = "";
string total_bytes_sec_max_length = "";
string read_bytes_sec = "";
string read_bytes_sec_max_length = "";
string write_bytes_sec = "";
string write_bytes_sec_max = "";
string total_iops_sec = "";
string total_iops_sec_max_length = "";
string read_iops_sec = "";
string read_iops_sec_max_length = "";
string write_iops_sec = "";
string write_iops_sec_max = "";
string default_total_bytes_sec = "";
string default_read_bytes_sec = "";
string default_write_bytes_sec = "";
string default_total_iops_sec = "";
string default_read_iops_sec = "";
string default_write_iops_sec = "";
string default_total_bytes_sec = "";
string default_total_bytes_sec_max_length = "";
string default_read_bytes_sec = "";
string default_read_bytes_sec_max_length = "";
string default_write_bytes_sec = "";
string default_write_bytes_sec_max = "";
string default_total_iops_sec = "";
string default_total_iops_sec_max_length = "";
string default_read_iops_sec = "";
string default_read_iops_sec_max_length = "";
string default_write_iops_sec = "";
string default_write_iops_sec_max = "";
int disk_id;
int order;
@ -462,11 +474,17 @@ int LibVirtDriver::deployment_description_kvm(
get_default("DISK", "IO", default_driver_disk_io);
get_default("DISK", "DISCARD", default_driver_discard);
get_default("DISK", "TOTAL_BYTES_SEC", default_total_bytes_sec);
get_default("DISK", "TOTAL_BYTES_SEC_MAX_LENGTH", default_total_bytes_sec_max_length);
get_default("DISK", "READ_BYTES_SEC", default_read_bytes_sec);
get_default("DISK", "READ_BYTES_SEC_MAX_LENGTH", default_read_bytes_sec_max_length);
get_default("DISK", "WRITE_BYTES_SEC", default_write_bytes_sec);
get_default("DISK", "WRITE_BYTES_SEC_MAX", default_write_bytes_sec_max);
get_default("DISK", "TOTAL_IOPS_SEC", default_total_iops_sec);
get_default("DISK", "TOTAL_IOPS_SEC_MAX_LENGTH", default_total_iops_sec_max_length);
get_default("DISK", "READ_IOPS_SEC", default_read_iops_sec);
get_default("DISK", "READ_IOPS_SEC_MAX_LENGTH", default_read_iops_sec_max_length);
get_default("DISK", "WRITE_IOPS_SEC", default_write_iops_sec);
get_default("DISK", "WRITE_IOPS_SEC_MAX", default_write_iops_sec_max);
// ------------------------------------------------------------------------
@ -500,42 +518,78 @@ int LibVirtDriver::deployment_description_kvm(
sheepdog_host = disk[i]->vector_value("SHEEPDOG_HOST");
total_bytes_sec = disk[i]->vector_value("TOTAL_BYTES_SEC");
read_bytes_sec = disk[i]->vector_value("READ_BYTES_SEC");
write_bytes_sec = disk[i]->vector_value("WRITE_BYTES_SEC");
total_iops_sec = disk[i]->vector_value("TOTAL_IOPS_SEC");
read_iops_sec = disk[i]->vector_value("READ_IOPS_SEC");
write_iops_sec = disk[i]->vector_value("WRITE_IOPS_SEC");
total_bytes_sec_max_length = disk[i]->vector_value("TOTAL_BYTES_SEC_MAX_LENGTH");
read_bytes_sec = disk[i]->vector_value("READ_BYTES_SEC");
read_bytes_sec_max_length = disk[i]->vector_value("READ_BYTES_SEC_MAX_LENGTH");
write_bytes_sec = disk[i]->vector_value("WRITE_BYTES_SEC");
write_bytes_sec_max = disk[i]->vector_value("WRITE_BYTES_SEC_MAX");
total_iops_sec = disk[i]->vector_value("TOTAL_IOPS_SEC");
total_iops_sec_max_length = disk[i]->vector_value("TOTAL_IOPS_SEC_MAX_LENGTH");
read_iops_sec = disk[i]->vector_value("READ_IOPS_SEC");
read_iops_sec_max_length = disk[i]->vector_value("READ_IOPS_SEC_MAX_LENGTH");
write_iops_sec = disk[i]->vector_value("WRITE_IOPS_SEC");
write_iops_sec_max = disk[i]->vector_value("WRITE_IOPS_SEC_MAX");
if ( total_bytes_sec.empty() && !default_total_bytes_sec.empty())
{
total_bytes_sec = default_total_bytes_sec;
}
if ( total_bytes_sec_max_length.empty() && !default_total_bytes_sec_max_length.empty())
{
total_bytes_sec_max_length = default_total_bytes_sec_max_length;
}
if ( read_bytes_sec.empty() && !default_read_bytes_sec.empty())
{
read_bytes_sec = default_read_bytes_sec;
}
if ( read_bytes_sec_max_length.empty() && !default_read_bytes_sec_max_length.empty())
{
read_bytes_sec_max_length = default_read_bytes_sec_max_length;
}
if ( write_bytes_sec.empty() && !default_write_bytes_sec.empty())
{
write_bytes_sec = default_write_bytes_sec;
}
if ( write_bytes_sec_max.empty() && !default_write_bytes_sec_max.empty())
{
write_bytes_sec_max = default_write_bytes_sec_max;
}
if ( total_iops_sec.empty() && !default_total_iops_sec.empty())
{
total_iops_sec = default_total_iops_sec;
}
if ( total_iops_sec_max_length.empty() && !default_total_iops_sec_max_length.empty())
{
total_iops_sec_max_length = default_total_iops_sec_max_length;
}
if ( read_iops_sec.empty() && !default_read_iops_sec.empty())
{
read_iops_sec = default_read_iops_sec;
}
if ( read_iops_sec_max_length.empty() && !default_read_iops_sec_max_length.empty())
{
read_iops_sec_max_length = default_read_iops_sec_max_length;
}
if ( write_iops_sec.empty() && !default_write_iops_sec.empty())
{
write_iops_sec = default_write_iops_sec;
}
if ( write_iops_sec_max.empty() && !default_write_iops_sec_max.empty())
{
write_iops_sec_max = default_write_iops_sec_max;
}
disk[i]->vector_value_str("DISK_ID", disk_id);
if (target.empty())
@ -792,7 +846,13 @@ int LibVirtDriver::deployment_description_kvm(
if (!(total_bytes_sec.empty() && read_bytes_sec.empty() &&
write_bytes_sec.empty() && total_iops_sec.empty() &&
read_iops_sec.empty() && write_iops_sec.empty()))
read_iops_sec.empty() && write_iops_sec.empty() &&
total_bytes_sec_max_length.empty() &&
read_bytes_sec_max_length.empty() &&
write_bytes_sec_max.empty() &&
total_iops_sec_max_length.empty() &&
read_iops_sec_max_length.empty() &&
write_iops_sec_max.empty() ))
{
file << "\t\t\t<iotune>" << endl;
@ -803,6 +863,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</total_bytes_sec>\n";
}
if ( !total_bytes_sec_max_length.empty() )
{
file << "\t\t\t\t<total_bytes_sec_max_length>"
<< one_util::escape_xml(total_bytes_sec_max_length)
<< "</total_bytes_sec_max_length>\n";
}
if ( !read_bytes_sec.empty() )
{
file << "\t\t\t\t<read_bytes_sec>"
@ -810,6 +877,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</read_bytes_sec>\n";
}
if ( !read_bytes_sec_max_length.empty() )
{
file << "\t\t\t\t<read_bytes_sec_max_length>"
<< one_util::escape_xml(read_bytes_sec_max_length)
<< "</read_bytes_sec_max_length>\n";
}
if ( !write_bytes_sec.empty() )
{
file << "\t\t\t\t<write_bytes_sec>"
@ -817,6 +891,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</write_bytes_sec>\n";
}
if ( !write_bytes_sec_max.empty() )
{
file << "\t\t\t\t<write_bytes_sec_max>"
<< one_util::escape_xml(write_bytes_sec_max)
<< "</write_bytes_sec_max>\n";
}
if ( !total_iops_sec.empty() )
{
file << "\t\t\t\t<total_iops_sec>"
@ -824,6 +905,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</total_iops_sec>\n";
}
if ( !total_iops_sec_max_length.empty() )
{
file << "\t\t\t\t<total_iops_sec_max_length>"
<< one_util::escape_xml(total_iops_sec_max_length)
<< "</total_iops_sec_max_length>\n";
}
if ( !read_iops_sec.empty() )
{
file << "\t\t\t\t<read_iops_sec>"
@ -831,6 +919,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</read_iops_sec>\n";
}
if ( !read_iops_sec_max_length.empty() )
{
file << "\t\t\t\t<read_iops_sec_max_length>"
<< one_util::escape_xml(read_iops_sec_max_length)
<< "</read_iops_sec_max_length>\n";
}
if ( !write_iops_sec.empty() )
{
file << "\t\t\t\t<write_iops_sec>"
@ -838,6 +933,13 @@ int LibVirtDriver::deployment_description_kvm(
<< "</write_iops_sec>\n";
}
if ( !write_iops_sec_max.empty() )
{
file << "\t\t\t\t<write_iops_sec_max>"
<< one_util::escape_xml(write_iops_sec_max)
<< "</write_iops_sec_max>\n";
}
file << "\t\t\t</iotune>" << endl;
}

View File

@ -35,11 +35,17 @@ CACHE=${CACHE:-default} # https://github.com/OpenNebula/one/blob/c0d081917224f1
DISCARD=${DISCARD:-${DEFAULT_ATTACH_DISCARD}}
DISK_IO=${DISK_IO:-${DEFAULT_ATTACH_IO}}
TOTAL_BYTES_SEC=${TOTAL_BYTES_SEC:-${DEFAULT_ATTACH_TOTAL_BYTES_SEC}}
TOTAL_BYTES_SEC_MAX_LENGTH=${TOTAL_BYTES_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_TOTAL_BYTES_SEC_MAX_LENGTH}}
READ_BYTES_SEC=${READ_BYTES_SEC:-${DEFAULT_ATTACH_READ_BYTES_SEC}}
READ_BYTES_SEC_MAX_LENGTH=${READ_BYTES_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_READ_BYTES_SEC_MAX_LENGTH}}
WRITE_BYTES_SEC=${WRITE_BYTES_SEC:-${DEFAULT_ATTACH_WRITE_BYTES_SEC}}
WRITE_BYTES_SEC_MAX=${WRITE_BYTES_SEC_MAX:-${DEFAULT_ATTACH_WRITE_BYTES_SEC_MAX}}
TOTAL_IOPS_SEC=${TOTAL_IOPS_SEC:-${DEFAULT_ATTACH_TOTAL_IOPS_SEC}}
TOTAL_IOPS_SEC_MAX_LENGTH=${TOTAL_IOPS_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_TOTAL_IOPS_SEC_MAX_LENGTH}}
READ_IOPS_SEC=${READ_IOPS_SEC:-${DEFAULT_ATTACH_READ_IOPS_SEC}}
READ_IOPS_SEC_MAX_LENGTH=${READ_IOPS_SEC_MAX_LENGTH:-${DEFAULT_ATTACH_READ_IOPS_SEC_MAX_LENGTH}}
WRITE_IOPS_SEC=${WRITE_IOPS_SEC:-${DEFAULT_ATTACH_WRITE_IOPS_SEC}}
WRITE_IOPS_SEC_MAX=${WRITE_IOPS_SEC_MAX:-${DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX}}
# disk XML
XML=''

View File

@ -52,11 +52,17 @@ export SHUTDOWN_TIMEOUT=300
# These parameters set the default DISK I/O throttling attributes
# for the new attached disk in case they aren't set.
#DEFAULT_ATTACH_TOTAL_BYTES_SEC=
#DEFAULT_ATTACH_TOTAL_BYTES_SEC_MAX_LENGTH=
#DEFAULT_ATTACH_READ_BYTES_SEC=
#DEFAULT_ATTACH_READ_BYTES_SEC_MAX_LENGTH=
#DEFAULT_ATTACH_WRITE_BYTES_SEC=
#DEFAULT_ATTACH_WRITE_BYTES_SEC_MAX=
#DEFAULT_ATTACH_TOTAL_IOPS_SEC=
#DEFAULT_ATTACH_TOTAL_IOPS_SEC_MAX_LENGTH=
#DEFAULT_ATTACH_READ_IOPS_SEC=
#DEFAULT_ATTACH_READ_IOPS_SEC_MAX_LENGTH=
#DEFAULT_ATTACH_WRITE_IOPS_SEC=
#DEFAULT_ATTACH_WRITE_IOPS_SEC_MAX=
# This parameters will set the default NIC model and filter for
# the hot-attached interfaces.