Bugfix: port_security_enabled issue 11/38511/2
authorJingLu5 <lvjing5@huawei.com>
Tue, 1 Aug 2017 08:24:01 +0000 (08:24 +0000)
committerRoss Brattain <ross.b.brattain@intel.com>
Tue, 1 Aug 2017 13:21:21 +0000 (13:21 +0000)
JIRA: YARDSTICK-765

When port_security_enabled is not set, VMs are assigned with security group 'default'.
When using 'default' security group, all egress traffic and intercommunication in the
default group are allowed and all ingress from outside of the default group is dropped
by default (in the default security group). This causes yardstick cannot ssh into VMs.

If port_security_enabled is not set, we should still add the security group that created
by yardstick to the VMs.

Change-Id: Ifd22fb452e0077581b6900f8f51c4e3c342a30aa
Signed-off-by: JingLu5 <lvjing5@huawei.com>
yardstick/benchmark/contexts/model.py

index aed1a3f..2db96ba 100644 (file)
@@ -257,10 +257,11 @@ class Server(Object):     # pragma: no cover
             port_name = server_name + "-" + network.name + "-port"
             self.ports[network.name] = {"stack_name": port_name}
             # we can't use secgroups if port_security_enabled is False
-            if network.port_security_enabled:
-                sec_group_id = self.secgroup_name
-            else:
+            if network.port_security_enabled is False:
                 sec_group_id = None
+            else:
+                # if port_security_enabled is None we still need to add to secgroup
+                sec_group_id = self.secgroup_name
             # don't refactor to pass in network object, that causes JSON
             # circular ref encode errors
             template.add_port(port_name, network.stack_name, network.subnet_stack_name,