mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
adds link state option for instance networks. Enable/disable link while instance running
This commit is contained in:
parent
01f2290dd9
commit
ecf31b0b5b
3 changed files with 50 additions and 10 deletions
|
|
@ -878,6 +878,7 @@
|
|||
<th>{% trans 'MAC' %}</th>
|
||||
<th>{% trans 'IP Address' %}</th>
|
||||
<th>{% trans 'Source' %}</th>
|
||||
<th>{% trans 'LinkState' %}</th>
|
||||
<th>{% trans 'Filter' %}</th>
|
||||
<th>{% trans 'Qos' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
|
|
@ -886,11 +887,20 @@
|
|||
<tbody>
|
||||
{% for network in networks %}
|
||||
<tr>
|
||||
<td class="col-sm-2"><label>eth{{ forloop.counter0 }}({{ network.target|default:"no target" }})</label></td>
|
||||
<td><label>{{ network.mac }}</label></td>
|
||||
<td><label>{{ network.ipv4|default:"unknown" }}</label></td>
|
||||
<td><label>{{ network.nic }}</label></td>
|
||||
<td><label>{{ network.filterref|default:"None" }}</label></td>
|
||||
<td class="col-sm-1">eth{{ forloop.counter0 }}({{ network.target|default:"no target" }})</td>
|
||||
<td>{{ network.mac }}</td>
|
||||
<td>{{ network.ipv4|default:"unknown" }}</td>
|
||||
<td>{{ network.nic }}</td>
|
||||
<td>
|
||||
<form method="post">{% csrf_token %}
|
||||
<input name="mac" value="{{ network.mac }}" hidden/>
|
||||
<input name="set_link_state" value="{{ network.state }}" hidden/>
|
||||
<input type="checkbox" {% if network.state == 'up' %} checked
|
||||
{% endif %} onclick='submit();' />
|
||||
{% trans 'active' %}
|
||||
</form>
|
||||
</td>
|
||||
<td>{{ network.filterref|default:"None" }}</td>
|
||||
<td>
|
||||
<form class="form-horizontal" method="post" name="add_qos{{ forloop.counter0 }}" role="form">{% csrf_token %}
|
||||
<input type="text" name="net-mac-{{ forloop.counter0 }}" value="{{ network.mac }}" hidden/>
|
||||
|
|
|
|||
|
|
@ -873,6 +873,15 @@ def instance(request, compute_id, vname):
|
|||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#network')
|
||||
|
||||
if 'set_link_state' in request.POST:
|
||||
mac_address = request.POST.get('mac', '')
|
||||
state = request.POST.get('set_link_state')
|
||||
state = 'down' if state == 'up' else 'up'
|
||||
conn.set_link_state(mac_address, state)
|
||||
msg = _("Set Link State: {}".format(state))
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#network')
|
||||
|
||||
if 'set_qos' in request.POST:
|
||||
qos_dir = request.POST.get('qos_direction', '')
|
||||
average = request.POST.get('qos_average') or 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue