Merge "Add nova.ListAndSearchHypervisors scenario"
This commit is contained in:
commit
07fe83bef1
@ -709,6 +709,22 @@
|
|||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
NovaHypervisors.list_and_search_hypervisors:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
detailed: True
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 5
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
|
||||||
NovaImages.list_images:
|
NovaImages.list_images:
|
||||||
-
|
-
|
||||||
args:
|
args:
|
||||||
|
@ -59,7 +59,7 @@ class ListAndGetHypervisors(utils.NovaScenario):
|
|||||||
|
|
||||||
with atomic.ActionTimer(self, "nova.get_hypervisor"):
|
with atomic.ActionTimer(self, "nova.get_hypervisor"):
|
||||||
for hypervisor in hypervisors:
|
for hypervisor in hypervisors:
|
||||||
self._get_hypervisor(hypervisor)
|
self._get_hypervisor(hypervisor, atomic_action=False)
|
||||||
|
|
||||||
|
|
||||||
@validation.required_services(consts.Service.NOVA)
|
@validation.required_services(consts.Service.NOVA)
|
||||||
@ -95,3 +95,28 @@ class ListAndGetUptimeHypervisors(utils.NovaScenario):
|
|||||||
with atomic.ActionTimer(self, "nova.uptime_hypervisor"):
|
with atomic.ActionTimer(self, "nova.uptime_hypervisor"):
|
||||||
for hypervisor in hypervisors:
|
for hypervisor in hypervisors:
|
||||||
self._uptime_hypervisor(hypervisor, atomic_action=False)
|
self._uptime_hypervisor(hypervisor, atomic_action=False)
|
||||||
|
|
||||||
|
|
||||||
|
@validation.required_services(consts.Service.NOVA)
|
||||||
|
@validation.required_openstack(admin=True)
|
||||||
|
@scenario.configure(name="NovaHypervisors.list_and_search_hypervisors")
|
||||||
|
class ListAndSearchHypervisors(utils.NovaScenario):
|
||||||
|
def run(self, detailed=True):
|
||||||
|
"""List all servers belonging to specific hypervisor.
|
||||||
|
|
||||||
|
The scenario first list all hypervisors,then find its hostname,
|
||||||
|
then list all servers belonging to the hypervisor
|
||||||
|
|
||||||
|
Measure the "nova hypervisor-servers <hostname>" command performance.
|
||||||
|
|
||||||
|
:param detailed: True if the hypervisor listing should contain
|
||||||
|
detailed information about all of them
|
||||||
|
"""
|
||||||
|
hypervisors = self._list_hypervisors(detailed)
|
||||||
|
|
||||||
|
with atomic.ActionTimer(self,
|
||||||
|
"nova.search_%s_hypervisors" % len(hypervisors)
|
||||||
|
):
|
||||||
|
for hypervisor in hypervisors:
|
||||||
|
self._search_hypervisors(hypervisor.hypervisor_hostname,
|
||||||
|
atomic_action=False)
|
||||||
|
@ -898,6 +898,20 @@ class NovaScenario(scenario.OpenStackScenario):
|
|||||||
"""
|
"""
|
||||||
return self.admin_clients("nova").hypervisors.get(hypervisor)
|
return self.admin_clients("nova").hypervisors.get(hypervisor)
|
||||||
|
|
||||||
|
@atomic.optional_action_timer("nova.search_hypervisors")
|
||||||
|
def _search_hypervisors(self, hypervisor_match, servers=False):
|
||||||
|
"""List all servers belonging to specific hypervisor.
|
||||||
|
|
||||||
|
:param hypervisor_match: Hypervisor's host name.
|
||||||
|
:param servers: If True, server information is also retrieved.
|
||||||
|
:param atomic_action: True if this is atomic action. added and
|
||||||
|
handled by the optional_action_timer()
|
||||||
|
decorator.
|
||||||
|
:returns: Hypervisor object
|
||||||
|
"""
|
||||||
|
return self.admin_clients("nova").hypervisors.search(hypervisor_match,
|
||||||
|
servers=servers)
|
||||||
|
|
||||||
@atomic.action_timer("nova.lock_server")
|
@atomic.action_timer("nova.lock_server")
|
||||||
def _lock_server(self, server):
|
def _lock_server(self, server):
|
||||||
"""Lock the given server.
|
"""Lock the given server.
|
||||||
|
25
samples/tasks/scenarios/nova/list-and-search-hypervisor.json
Normal file
25
samples/tasks/scenarios/nova/list-and-search-hypervisor.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"NovaHypervisors.list_and_search_hypervisors": [
|
||||||
|
{
|
||||||
|
"args": {
|
||||||
|
"detailed": true
|
||||||
|
},
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"concurrency": 2,
|
||||||
|
"times": 2
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"users": {
|
||||||
|
"tenants": 3,
|
||||||
|
"users_per_tenant": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sla": {
|
||||||
|
"failure_rate": {
|
||||||
|
"max": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
16
samples/tasks/scenarios/nova/list-and-search-hypervisor.yaml
Normal file
16
samples/tasks/scenarios/nova/list-and-search-hypervisor.yaml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
NovaHypervisors.list_and_search_hypervisors:
|
||||||
|
-
|
||||||
|
args:
|
||||||
|
detailed: True
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 2
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 3
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
@ -55,3 +55,17 @@ class NovaHypervisorsTestCase(test.ScenarioTestCase):
|
|||||||
scenario._uptime_hypervisor.assert_called_once_with(hypervisor)
|
scenario._uptime_hypervisor.assert_called_once_with(hypervisor)
|
||||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
"nova.uptime_hypervisor")
|
"nova.uptime_hypervisor")
|
||||||
|
|
||||||
|
def test_list_and_search_hypervisors(self):
|
||||||
|
fake_hypervisors = [mock.Mock(hypervisor_hostname="fake_hostname")]
|
||||||
|
scenario = hypervisors.ListAndSearchHypervisors(self.context)
|
||||||
|
scenario._list_hypervisors = mock.MagicMock(
|
||||||
|
return_value=fake_hypervisors)
|
||||||
|
scenario._search_hypervisors = mock.MagicMock()
|
||||||
|
scenario.run(detailed=False)
|
||||||
|
|
||||||
|
scenario._list_hypervisors.assert_called_once_with(False)
|
||||||
|
scenario._search_hypervisors.assert_called_once_with(
|
||||||
|
"fake_hostname", atomic_action=False)
|
||||||
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
|
"nova.search_1_hypervisors")
|
||||||
|
@ -880,6 +880,15 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
|||||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
"nova.get_hypervisor")
|
"nova.get_hypervisor")
|
||||||
|
|
||||||
|
def test__search_hypervisors(self):
|
||||||
|
nova_scenario = utils.NovaScenario()
|
||||||
|
nova_scenario._search_hypervisors("fake_hostname", servers=False)
|
||||||
|
|
||||||
|
self.admin_clients("nova").hypervisors.search.assert_called_once_with(
|
||||||
|
"fake_hostname", servers=False)
|
||||||
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
|
"nova.search_hypervisors")
|
||||||
|
|
||||||
def test__list_images(self):
|
def test__list_images(self):
|
||||||
nova_scenario = utils.NovaScenario()
|
nova_scenario = utils.NovaScenario()
|
||||||
result = nova_scenario._list_images(detailed=False, fakearg="fakearg")
|
result = nova_scenario._list_images(detailed=False, fakearg="fakearg")
|
||||||
|
Loading…
Reference in New Issue
Block a user