diff --git a/instances/models.py b/instances/models.py index 978d118..0a20031 100644 --- a/instances/models.py +++ b/instances/models.py @@ -252,6 +252,7 @@ class CreateInstance(models.Model): error_messages={"required": _("No Network pool has been choosen")}, ) nwfilter = models.CharField(max_length=256, blank=True) + net_model = models.CharField(max_length=256, blank=True) storage = models.CharField(max_length=256, blank=True) template = models.CharField(max_length=256, blank=True) images = models.CharField(max_length=256, blank=True) diff --git a/instances/templates/add_instance_network_block.html b/instances/templates/add_instance_network_block.html index 2a57b12..c5ce705 100644 --- a/instances/templates/add_instance_network_block.html +++ b/instances/templates/add_instance_network_block.html @@ -45,6 +45,16 @@ +
+ +
+ +
+
+ +
+ +
+ +
@@ -422,7 +432,16 @@ {% endfor %}
- + +
+ +
+ +
@@ -666,6 +685,16 @@
+
+ +
+ +
+
@@ -865,7 +894,7 @@ '{% endfor %}' + '' + ' -> ' + value + ' ' + - '{% bs_icon 'trash'%} '; + ' X '; selected_list_html += li; counter++; }); @@ -899,7 +928,7 @@ let li = '
  • ' + ' eth' + net_counter + ' -> ' + value + ' ' + - '{% bs_icon 'trash'%}
  • '; + ' X '; random_mac(net_counter); selected_list_html += li; net_counter++; diff --git a/instances/views.py b/instances/views.py index d4865fd..57d1598 100755 --- a/instances/views.py +++ b/instances/views.py @@ -1253,6 +1253,7 @@ def add_network(request, pk): mac = request.POST.get("add-net-mac") nwfilter = request.POST.get("add-net-nwfilter") (source, source_type) = utils.get_network_tuple(request.POST.get("add-net-network")) + model = request.POST.get("add-net-model") if source_type == "iface": iface = wvmInterface( @@ -1264,7 +1265,7 @@ def add_network(request, pk): ) source_type = iface.get_type() - instance.proxy.add_network(mac, source, source_type, nwfilter=nwfilter) + instance.proxy.add_network(mac, source, source_type, model=model, nwfilter=nwfilter) msg = _("Add network: %(mac)s") % {"mac": mac} addlogmsg(request.user.username, instance.compute.name, instance.name, msg) return redirect(request.META.get("HTTP_REFERER") + "#network") @@ -1690,6 +1691,7 @@ def create_instance(request, compute_id, arch, machine): default_bus = app_settings.INSTANCE_VOLUME_DEFAULT_BUS networks = sorted(conn.get_networks()) nwfilters = conn.get_nwfilters() + net_models_host = conn.get_network_models() storages = sorted(conn.get_storages(only_actives=True)) default_graphics = app_settings.QEMU_CONSOLE_DEFAULT_TYPE default_cdrom = app_settings.INSTANCE_CDROM_ADD @@ -1866,6 +1868,7 @@ def create_instance(request, compute_id, arch, machine): virtio=data["virtio"], listener_addr=data["listener_addr"], nwfilter=data["nwfilter"], + net_model=data["net_model"], graphics=data["graphics"], video=data["video"], console_pass=data["console_pass"], diff --git a/vrtManager/connection.py b/vrtManager/connection.py index 3f49667..e2dfaed 100644 --- a/vrtManager/connection.py +++ b/vrtManager/connection.py @@ -757,7 +757,7 @@ class wvmConnect(object): """ :return: network card models """ - return ["default", "e1000", "virtio"] + return ["default", "e1000", "e1000e","rt18139", "virtio"] def get_image_formats(self): """ diff --git a/vrtManager/create.py b/vrtManager/create.py index 014a70b..90cd511 100644 --- a/vrtManager/create.py +++ b/vrtManager/create.py @@ -161,6 +161,7 @@ class wvmCreate(wvmConnect): graphics, virtio, listener_addr, + net_model="virtio", video="vga", console_pass="random", mac=None, @@ -316,7 +317,7 @@ class wvmCreate(wvmConnect): if nwfilter: xml += f"""""" if virtio: - xml += """""" + xml += f"""""" xml += """""" if console_pass == "random":