diff --git a/create/forms.py b/create/forms.py
index 0f208ce..d1e5bf0 100644
--- a/create/forms.py
+++ b/create/forms.py
@@ -38,6 +38,7 @@ class NewVMForm(forms.Form):
disk = forms.IntegerField(required=False)
memory = forms.IntegerField(error_messages={'required': _('No RAM size has been entered')})
networks = forms.CharField(error_messages={'required': _('No Network pool has been choice')})
+ nwfilter = forms.CharField(required=False)
storage = forms.CharField(max_length=20, required=False)
template = forms.CharField(required=False)
images = forms.CharField(required=False)
diff --git a/create/templates/create_instance.html b/create/templates/create_instance.html
index 88b5fbe..8b741f2 100644
--- a/create/templates/create_instance.html
+++ b/create/templates/create_instance.html
@@ -107,6 +107,17 @@
{% endfor %}
+
+
@@ -226,6 +237,17 @@
+
+
+
+
+
diff --git a/instances/templates/instance.html b/instances/templates/instance.html
index 9b34878..4dbfa6d 100644
--- a/instances/templates/instance.html
+++ b/instances/templates/instance.html
@@ -859,11 +859,8 @@
{% endfor %}
- {% ifequal status 5 %}
-
- {% else %}
-
- {% endifequal %}
+
+
diff --git a/instances/views.py b/instances/views.py
index ec6adbc..0f4469f 100644
--- a/instances/views.py
+++ b/instances/views.py
@@ -364,6 +364,7 @@ def instance(request, compute_id, vname):
else:
media_iso = []
networks = conn.get_net_device()
+ nwfilters = conn.get_nwfilters()
vcpu_range = conn.get_max_cpus()
memory_range = [256, 512, 768, 1024, 2048, 4096, 6144, 8192, 16384]
if memory not in memory_range:
@@ -708,9 +709,10 @@ def instance(request, compute_id, vname):
if 'add_network' in request.POST:
mac = request.POST.get('add-net-mac')
+ nwfilter = request.POST.get('nwfilter')
(source, source_type) = get_network_tuple(request.POST.get('add-net-network'))
- conn.add_network(mac, source, source_type)
+ conn.add_network(mac, source, source_type, nwfilter=nwfilter)
msg = _("Edit network")
addlogmsg(request.user.username, instance.name, msg)
msg = _("Network Devices are changed. Please reboot instance to activate.")
diff --git a/nwfilters/templates/nwfilter.html b/nwfilters/templates/nwfilter.html
index 0d2e2f1..9f97831 100644
--- a/nwfilters/templates/nwfilter.html
+++ b/nwfilters/templates/nwfilter.html
@@ -22,7 +22,7 @@
{% trans "Interfaces" %}
- {% trans "NWFilters" %}
+ {% trans "NWFilters" %}
{% trans "Secrets" %}
diff --git a/nwfilters/views.py b/nwfilters/views.py
index 99686ed..c0dd8d8 100644
--- a/nwfilters/views.py
+++ b/nwfilters/views.py
@@ -98,7 +98,7 @@ def nwfilters(request, compute_id):
addlogmsg(request.user.username, compute.hostname, msg)
for nwf in conn.get_nwfilters():
- nwfilters_all.append(conn.get_nwfilter_info(nwf.name()))
+ nwfilters_all.append(conn.get_nwfilter_info(nwf))
conn.close()
except libvirtError as lib_err:
@@ -132,7 +132,7 @@ def nwfilter(request, compute_id, nwfltr):
compute.type)
for nwf in conn.get_nwfilters():
- nwfilters_all.append(conn.get_nwfilter_info(nwf.name()))
+ nwfilters_all.append(conn.get_nwfilter_info(nwf))
uuid = nwfilter.get_uuid()
name = nwfilter.get_name()
diff --git a/vrtManager/connection.py b/vrtManager/connection.py
index 96a4fbf..1a16f4e 100644
--- a/vrtManager/connection.py
+++ b/vrtManager/connection.py
@@ -391,7 +391,7 @@ class wvmConnect(object):
def get_nwfilters(self):
nwfilters = []
- for nwfilter in self.wvm.listAllNWFilters():
+ for nwfilter in self.wvm.listNWFilters():
nwfilters.append(nwfilter)
return nwfilters
diff --git a/vrtManager/instance.py b/vrtManager/instance.py
index ca5568f..dd2db64 100644
--- a/vrtManager/instance.py
+++ b/vrtManager/instance.py
@@ -788,7 +788,7 @@ class wvmInstance(wvmConnect):
bridge_name = net.bridgeName()
return bridge_name
- def add_network(self, mac_address, source, source_type='net', interface_type='bridge', model='virtio'):
+ def add_network(self, mac_address, source, source_type='net', interface_type='bridge', model='virtio', nwfilter=None):
tree = ElementTree.fromstring(self._XMLDesc(0))
bridge_name = self.get_bridge_name(source, source_type)
xml_interface = """
@@ -796,8 +796,13 @@ class wvmInstance(wvmConnect):
-
- """ % (interface_type, mac_address, bridge_name, model)
+ """ % (interface_type, mac_address, bridge_name, model)
+ if nwfilter:
+ xml_interface += """
+
+ """ % nwfilter
+ xml_interface += """"""
+
if self.get_status() == 5:
devices = tree.find('devices')
elm_interface = ElementTree.fromstring(xml_interface)