Add nova.getHypervisorStatistics
Get hypervisor statistics over all compute nodes. Measure the "nova hypervisor-stats" command performance. Change-Id: Id7b2ff3e9f85c9f99c3f701637b8be32f9e23fe4
This commit is contained in:
@@ -662,6 +662,20 @@
|
|||||||
failure_rate:
|
failure_rate:
|
||||||
max: 0
|
max: 0
|
||||||
|
|
||||||
|
NovaHypervisors.statistics_hypervisors:
|
||||||
|
-
|
||||||
|
args: {}
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 5
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 2
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
|
|
||||||
NovaHypervisors.list_and_get_hypervisors:
|
NovaHypervisors.list_and_get_hypervisors:
|
||||||
-
|
-
|
||||||
|
|||||||
@@ -62,6 +62,19 @@ class ListAndGetHypervisors(utils.NovaScenario):
|
|||||||
self._get_hypervisor(hypervisor)
|
self._get_hypervisor(hypervisor)
|
||||||
|
|
||||||
|
|
||||||
|
@validation.required_services(consts.Service.NOVA)
|
||||||
|
@validation.required_openstack(admin=True)
|
||||||
|
@scenario.configure(name="NovaHypervisors.statistics_hypervisors")
|
||||||
|
class StatisticsHypervisors(utils.NovaScenario):
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
"""Get hypervisor statistics over all compute nodes.
|
||||||
|
|
||||||
|
Measure the "nova hypervisor-stats" command performance.
|
||||||
|
"""
|
||||||
|
self._statistics_hypervisors()
|
||||||
|
|
||||||
|
|
||||||
@validation.required_services(consts.Service.NOVA)
|
@validation.required_services(consts.Service.NOVA)
|
||||||
@validation.required_openstack(admin=True)
|
@validation.required_openstack(admin=True)
|
||||||
@scenario.configure(name="NovaHypervisors.list_and_get_uptime_hypervisors")
|
@scenario.configure(name="NovaHypervisors.list_and_get_uptime_hypervisors")
|
||||||
|
|||||||
@@ -863,6 +863,14 @@ class NovaScenario(scenario.OpenStackScenario):
|
|||||||
"""List hypervisors."""
|
"""List hypervisors."""
|
||||||
return self.admin_clients("nova").hypervisors.list(detailed)
|
return self.admin_clients("nova").hypervisors.list(detailed)
|
||||||
|
|
||||||
|
@atomic.action_timer("nova.statistics_hypervisors")
|
||||||
|
def _statistics_hypervisors(self):
|
||||||
|
"""Get hypervisor statistics over all compute nodes.
|
||||||
|
|
||||||
|
:returns: Hypervisor statistics
|
||||||
|
"""
|
||||||
|
return self.admin_clients("nova").hypervisors.statistics()
|
||||||
|
|
||||||
@atomic.optional_action_timer("nova.get_hypervisor")
|
@atomic.optional_action_timer("nova.get_hypervisor")
|
||||||
def _get_hypervisor(self, hypervisor):
|
def _get_hypervisor(self, hypervisor):
|
||||||
"""Get a specific hypervisor.
|
"""Get a specific hypervisor.
|
||||||
|
|||||||
23
samples/tasks/scenarios/nova/statistics-hypervisors.json
Normal file
23
samples/tasks/scenarios/nova/statistics-hypervisors.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"NovaHypervisors.statistics_hypervisors": [
|
||||||
|
{
|
||||||
|
"args": {},
|
||||||
|
"runner": {
|
||||||
|
"type": "constant",
|
||||||
|
"concurrency": 2,
|
||||||
|
"times": 2
|
||||||
|
},
|
||||||
|
"context": {
|
||||||
|
"users": {
|
||||||
|
"tenants": 3,
|
||||||
|
"users_per_tenant": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sla": {
|
||||||
|
"failure_rate": {
|
||||||
|
"max": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
15
samples/tasks/scenarios/nova/statistics-hypervisors.yaml
Normal file
15
samples/tasks/scenarios/nova/statistics-hypervisors.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
NovaHypervisors.statistics_hypervisors:
|
||||||
|
-
|
||||||
|
args: {}
|
||||||
|
runner:
|
||||||
|
type: "constant"
|
||||||
|
times: 2
|
||||||
|
concurrency: 2
|
||||||
|
context:
|
||||||
|
users:
|
||||||
|
tenants: 3
|
||||||
|
users_per_tenant: 2
|
||||||
|
sla:
|
||||||
|
failure_rate:
|
||||||
|
max: 0
|
||||||
@@ -38,6 +38,12 @@ class NovaHypervisorsTestCase(test.ScenarioTestCase):
|
|||||||
self._test_atomic_action_timer(scenario.atomic_actions(),
|
self._test_atomic_action_timer(scenario.atomic_actions(),
|
||||||
"nova.get_hypervisor")
|
"nova.get_hypervisor")
|
||||||
|
|
||||||
|
def test_statistics_hypervisors(self):
|
||||||
|
scenario = hypervisors.StatisticsHypervisors(self.context)
|
||||||
|
scenario._statistics_hypervisors = mock.Mock()
|
||||||
|
scenario.run()
|
||||||
|
scenario._statistics_hypervisors.assert_called_once_with()
|
||||||
|
|
||||||
def test_list_and_get_uptime_hypervisors(self):
|
def test_list_and_get_uptime_hypervisors(self):
|
||||||
scenario = hypervisors.ListAndGetUptimeHypervisors(self.context)
|
scenario = hypervisors.ListAndGetUptimeHypervisors(self.context)
|
||||||
scenario._list_hypervisors = mock.MagicMock(detailed=False)
|
scenario._list_hypervisors = mock.MagicMock(detailed=False)
|
||||||
|
|||||||
@@ -841,6 +841,17 @@ class NovaScenarioTestCase(test.ScenarioTestCase):
|
|||||||
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
"nova.list_hypervisors")
|
"nova.list_hypervisors")
|
||||||
|
|
||||||
|
def test__statistics_hypervisors(self):
|
||||||
|
nova_scenario = utils.NovaScenario()
|
||||||
|
result = nova_scenario._statistics_hypervisors()
|
||||||
|
self.assertEqual(
|
||||||
|
self.admin_clients("nova").hypervisors.statistics.return_value,
|
||||||
|
result)
|
||||||
|
(self.admin_clients("nova").hypervisors.statistics.
|
||||||
|
assert_called_once_with())
|
||||||
|
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
|
||||||
|
"nova.statistics_hypervisors")
|
||||||
|
|
||||||
def test__get_hypervisor(self):
|
def test__get_hypervisor(self):
|
||||||
hypervisor = mock.Mock()
|
hypervisor = mock.Mock()
|
||||||
nova_scenario = utils.NovaScenario()
|
nova_scenario = utils.NovaScenario()
|
||||||
|
|||||||
Reference in New Issue
Block a user