diff --git a/rally/plugins/openstack/context/nova/servers.py b/rally/plugins/openstack/context/nova/servers.py old mode 100644 new mode 100755 index aeb293a2..8bac8417 --- a/rally/plugins/openstack/context/nova/servers.py +++ b/rally/plugins/openstack/context/nova/servers.py @@ -59,6 +59,14 @@ class ServerGenerator(context.Context): }, "auto_assign_nic": { "type": "boolean", + }, + "nics": { + "type": "array", + "properties": { + "net-id": { + "type": "string" + } + } } }, "required": ["image", "flavor"], @@ -76,6 +84,7 @@ class ServerGenerator(context.Context): flavor = self.config["flavor"] auto_nic = self.config["auto_assign_nic"] servers_per_tenant = self.config["servers_per_tenant"] + kwargs = {"nics": self.config.get("nics", [])} clients = osclients.Clients(self.context["users"][0]["credential"]) image_id = types.GlanceImage.transform(clients=clients, @@ -102,7 +111,8 @@ class ServerGenerator(context.Context): servers = nova_scenario._boot_servers(image_id, flavor_id, requests=servers_per_tenant, - auto_assign_nic=auto_nic) + auto_assign_nic=auto_nic, + **kwargs) current_servers = [server.id for server in servers] diff --git a/tests/unit/plugins/openstack/context/nova/test_servers.py b/tests/unit/plugins/openstack/context/nova/test_servers.py old mode 100644 new mode 100755 index dc39b0be..544ff26d --- a/tests/unit/plugins/openstack/context/nova/test_servers.py +++ b/tests/unit/plugins/openstack/context/nova/test_servers.py @@ -114,10 +114,12 @@ class ServerGeneratorTestCase(test.ScenarioTestCase): flavor_id = mock_flavor_transform.return_value servers_ctx_config = self.context["config"]["servers"] expected_auto_nic = servers_ctx_config.get("auto_assign_nic", False) + expected_nics = servers_ctx_config.get("nics", []) expected_requests = servers_ctx_config.get("servers_per_tenant", False) called_times = len(tenants) mock_calls = [mock.call(image_id, flavor_id, auto_assign_nic=expected_auto_nic, + nics=expected_nics, requests=expected_requests) for i in range(called_times)] mock_nova_scenario__boot_servers.assert_has_calls(mock_calls)