Merge "Add nova.BootServerAndAddSecgroup"
This commit is contained in:
commit
322c471b36
@ -818,6 +818,33 @@
|
||||
security_groups: -1
|
||||
security_group_rules: -1
|
||||
|
||||
NovaSecGroup.boot_server_and_add_secgroups:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: {{flavor_name}}
|
||||
image:
|
||||
name: {{image_name}}
|
||||
security_group_count: 5
|
||||
rules_per_security_group: 5
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 2
|
||||
network:
|
||||
start_cidr: "10.2.0.0/24"
|
||||
quotas:
|
||||
nova:
|
||||
security_groups: -1
|
||||
security_group_rules: -1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
NovaKeypair.create_and_delete_keypair:
|
||||
-
|
||||
runner:
|
||||
|
@ -840,6 +840,21 @@ class NovaScenario(scenario.OpenStackScenario):
|
||||
with atomic.ActionTimer(self, "nova.list_security_groups"):
|
||||
return self.clients("nova").security_groups.list()
|
||||
|
||||
@atomic.optional_action_timer("nova.add_server_secgroups")
|
||||
def _add_server_secgroups(self, server, security_group,
|
||||
atomic_action=False):
|
||||
"""add security group to a server.
|
||||
|
||||
:param server: Server object
|
||||
:param security_groups: The name of security group to add.
|
||||
:param atomic_action: True if this is atomic action. added and
|
||||
handled by the optional_action_timer()
|
||||
decorator.
|
||||
:returns: An instance of novaclient.base.DictWithMeta
|
||||
"""
|
||||
return self.clients("nova").servers.add_security_group(server,
|
||||
security_group)
|
||||
|
||||
@atomic.action_timer("nova.list_floating_ips_bulk")
|
||||
def _list_floating_ips_bulk(self):
|
||||
"""List all floating IPs."""
|
||||
|
@ -766,6 +766,22 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||
"nova.list_security_groups")
|
||||
|
||||
def test__add_server_secgroups(self):
|
||||
server = mock.Mock()
|
||||
fake_secgroups = [fakes.FakeSecurityGroup(None, None, 1, "uuid1")]
|
||||
|
||||
nova_scenario = utils.NovaScenario()
|
||||
security_group = fake_secgroups[0]
|
||||
result = nova_scenario._add_server_secgroups(server,
|
||||
security_group.name)
|
||||
self.assertEqual(
|
||||
self.clients("nova").servers.add_security_group.return_value,
|
||||
result)
|
||||
(self.clients("nova").servers.add_security_group.
|
||||
assert_called_once_with(server, security_group.name))
|
||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||
"nova.add_server_secgroups")
|
||||
|
||||
def test__list_keypairs(self):
|
||||
nova_scenario = utils.NovaScenario()
|
||||
result = nova_scenario._list_keypairs()
|
||||
|
Loading…
Reference in New Issue
Block a user