mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
add macvtap support : create macvtap virtual net, add/edit instance network for macvtap
This commit is contained in:
parent
46884304b0
commit
015719b952
9 changed files with 90 additions and 67 deletions
|
|
@ -46,7 +46,7 @@ class AddNetPool(forms.Form):
|
|||
|
||||
def clean_bridge_name(self):
|
||||
bridge_name = self.cleaned_data['bridge_name']
|
||||
if self.cleaned_data['forward'] == 'bridge':
|
||||
if self.cleaned_data['forward'] in ['bridge', 'macvtap']:
|
||||
have_symbol = re.match('^[a-zA-Z0-9\.\_\:\-]+$', bridge_name)
|
||||
if not have_symbol:
|
||||
raise forms.ValidationError(_('The pool bridge name must not contain any special characters'))
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
<option value="route">{% trans "ROUTE" %}</option>
|
||||
<option value="none">{% trans "ISOLATE" %}</option>
|
||||
<option value="bridge">{% trans "BRIDGE" %}</option>
|
||||
<option value="macvtap">{% trans "MACVTAP" %}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -55,25 +56,25 @@
|
|||
<input type="checkbox" id="enable_ipv6" name="enable_ipv6" value="false">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row bridge_name_form_group_dhcp ipv6_group">
|
||||
<div class="form-group row ipv6_group">
|
||||
<label class="col-sm-4 col-form-label">{% trans "IPv6 Subnet pool" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" name="subnet6" value="" placeholder="fd00:dead:baba:1::/64" required pattern="[0-9\/\.]+">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row bridge_name_form_group_dhcp ipv6_group">
|
||||
<div class="form-group row ipv6_group">
|
||||
<label class="col-sm-4 col-form-label">{% trans "DHCPv6" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" name="dhcp6" value="true">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row bridge_name_form_group">
|
||||
<label class="col-sm-4 col-form-label">{% trans "Bridge Name" %}</label>
|
||||
<label class="col-sm-4 col-form-label" id="bridge_label">{% trans "Bridge Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" name="bridge_name" placeholder="br0" pattern="[a-z0-9\-_:]+">
|
||||
<input type="text" class="form-control" name="bridge_name" id="bridge_name" placeholder="br0" pattern="[a-z0-9\-_:]+">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group row bridge_name_form_group">
|
||||
<div class="form-group row bridge_name_form_group openvswitch">
|
||||
<label class="col-sm-4 col-form-label">{% trans "Open vSwitch" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="checkbox" name="openvswitch" value="true">
|
||||
|
|
@ -88,4 +89,5 @@
|
|||
</div> <!-- /.modal-content -->
|
||||
</div> <!-- /.modal-dialog -->
|
||||
</div> <!-- /.modal -->
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
<!-- /.row -->
|
||||
|
||||
{% include 'errors_block.html' %}
|
||||
{% include 'messages_block.html' %}
|
||||
|
||||
<div class="row">
|
||||
<dl class="ml-3 row">
|
||||
|
|
|
|||
|
|
@ -79,6 +79,12 @@
|
|||
if ($(this).val() == 'bridge') {
|
||||
$('.bridge_name_form_group').show();
|
||||
$('.bridge_name_form_group_dhcp').hide();
|
||||
} else if ($(this).val() == 'macvtap') {
|
||||
$('#bridge_label').text("Dev Name");
|
||||
$('#bridge_name').attr("placeholder", "eth0");
|
||||
$('.bridge_name_form_group').show();
|
||||
$('.bridge_name_form_group_dhcp').hide();
|
||||
$('.openvswitch').hide();
|
||||
} else {
|
||||
$('.bridge_name_form_group').hide();
|
||||
$('.bridge_name_form_group_dhcp').show();
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ def networks(request, compute_id):
|
|||
if data['name'] in networks:
|
||||
msg = _("Network pool name already in use")
|
||||
error_messages.append(msg)
|
||||
if data['forward'] == 'bridge' and data['bridge_name'] == '':
|
||||
error_messages.append(_('Please enter bridge name'))
|
||||
if data['forward'] in ['bridge', 'macvtap'] and data['bridge_name'] == '':
|
||||
error_messages.append(_('Please enter bridge/dev name'))
|
||||
if data['subnet']:
|
||||
ipv4 = True
|
||||
gateway4, netmask4, dhcp4 = network_size(data['subnet'], data['dhcp4'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue