mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
network qos adding, listing, backend revamped. Add network bug for nat networks solved
This commit is contained in:
parent
5282d3e556
commit
d7f283f089
2 changed files with 65 additions and 61 deletions
|
@ -339,14 +339,15 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% ifequal state 0 %}
|
||||
{% include 'add_outbound_qos.html' %}
|
||||
{% include 'add_inbound_qos.html' %}
|
||||
{% endifequal %}
|
||||
{% if net_forward.0 == 'route' or net_forward.0 == 'nat' or net_forward.0 == 'isolated' %}
|
||||
{% if state == 0 and qos.items|length != 2%}
|
||||
<form class="form-horizontal" method="post" name="set_qos" role="form">{% csrf_token %}
|
||||
{% include 'add_network_qos.html' %}
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
<div class="row">
|
||||
<h3 class="page-header">{% trans "Qos Configuration" %}
|
||||
</h3>
|
||||
<h3 class="page-header">{% trans "Qos Configuration" %}</h3>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
@ -366,16 +367,16 @@
|
|||
<form method="post" role="form">{% csrf_token %}
|
||||
<tr>
|
||||
<td><label class="control-label">{{ q | capfirst }}</label></td>
|
||||
<td><input id="qos_{{ q }}_av" class="form-control" name="qos_{{ q }}_average"
|
||||
value="{{ att.average }}"/></td>
|
||||
<td><input id="qos_{{ q }}_peak" class="form-control" name="qos_{{ q }}_peak"
|
||||
value="{{ att.peak }}"/></td>
|
||||
<td><input id="qos_{{ q }}_burst" class="form-control" name="qos_{{ q }}_burst"
|
||||
value="{{ att.burst }}"/></td>
|
||||
<td><input id="qos_average" class="form-control" name="qos_average"
|
||||
value="{{ att.average|default:'' }}"/></td>
|
||||
<td><input id="qos_peak" class="form-control" name="qos_peak"
|
||||
value="{{ att.peak|default:'' }}"/></td>
|
||||
<td><input id="qos_burst" class="form-control" name="qos_burst"
|
||||
value="{{ att.burst|default:'' }}"/></td>
|
||||
<td>
|
||||
<input name="qos_direction" value="{{ q }}" hidden/>
|
||||
<button type="submit" class="btn btn-sm btn-primary"
|
||||
name="set_qos"
|
||||
name="set_qos" data-toggle="modal"
|
||||
title="Edit Qos" onclick="return confirm('{% trans "Are you sure?" %}')">
|
||||
<i class="glyphicon glyphicon-save"></i>
|
||||
</button>
|
||||
|
@ -392,6 +393,7 @@
|
|||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
<script>
|
||||
|
|
|
@ -195,19 +195,21 @@ def network(request, compute_id, pool):
|
|||
else:
|
||||
messages.success(request, _("Network XML is changed."))
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
|
||||
if 'set_qos' in request.POST:
|
||||
qos_dir = request.POST.get('qos_direction', '')
|
||||
average = request.POST.get('qos_{}_average'.format(qos_dir), '')
|
||||
peak = request.POST.get('qos_{}_peak'.format(qos_dir), '')
|
||||
burst = request.POST.get('qos_{}_burst'.format(qos_dir), '')
|
||||
average = request.POST.get('qos_average') or 0
|
||||
peak = request.POST.get('qos_peak') or 0
|
||||
burst = request.POST.get('qos_burst') or 0
|
||||
|
||||
try:
|
||||
conn.set_qos(qos_dir, average, peak, burst)
|
||||
if conn.is_active():
|
||||
messages.success(request, "{} Qos is set. Network XML is changed.".format(qos_dir.capitalize()) +
|
||||
"Stop and start network to activate new config")
|
||||
else:
|
||||
messages.success(request, "{} Qos is set".format(qos_dir.capitalize()))
|
||||
except libvirtError as le:
|
||||
messages.error(request, le.message)
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
if 'unset_qos' in request.POST:
|
||||
qos_dir = request.POST.get('qos_direction', '')
|
||||
|
|
Loading…
Reference in a new issue