Merge "Add Nova scenario to list hypervisors"

This commit is contained in:
Jenkins 2015-05-05 09:32:55 +00:00 committed by Gerrit Code Review
commit 274f1fe2e9
7 changed files with 119 additions and 0 deletions

View File

@ -1380,6 +1380,18 @@
failure_rate:
max: 0
NovaHypervisors.list_hypervisors:
-
args:
detailed: True
runner:
type: "constant"
times: 5
concurrency: 2
sla:
failure_rate:
max: 0
VMTasks.boot_runcommand_delete:
-
args:

View File

@ -0,0 +1,40 @@
# Copyright 2015 Cisco Systems Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from rally.benchmark.scenarios import base
from rally.benchmark.scenarios.nova import utils
from rally.benchmark import validation
from rally.common import log as logging
from rally import consts
LOG = logging.getLogger(__name__)
class NovaHypervisors(utils.NovaScenario):
"""Benchmark scenarios for Nova hypervisors."""
@validation.required_services(consts.Service.NOVA)
@validation.required_openstack(admin=True)
@base.scenario()
def list_hypervisors(self, detailed=True):
"""List hypervisors.
Measure the "nova hypervisor-list" command performance.
:param detailed: True if the hypervisor listing should contain
detailed information about all of them
"""
self._list_hypervisors(detailed)

View File

@ -742,3 +742,8 @@ class NovaScenario(base.Scenario):
def _delete_floating_ips_bulk(self, ip_range):
"""Delete floating IPs by range."""
return self.admin_clients("nova").floating_ips_bulk.delete(ip_range)
@base.atomic_action_timer("nova.list_hypervisors")
def _list_hypervisors(self, detailed=True):
"""List hypervisors."""
return self.admin_clients("nova").hypervisors.list(detailed)

View File

@ -0,0 +1,14 @@
{
"NovaHypervisors.list_hypervisors": [
{
"runner": {
"type": "constant",
"concurrency": 2,
"times": 10
},
"args": {
"detailed": true
}
}
]
}

View File

@ -0,0 +1,9 @@
---
NovaHypervisors.list_hypervisors:
-
args:
detailed: True
runner:
type: "constant"
times: 10
concurrency: 2

View File

@ -0,0 +1,31 @@
# Copyright 2013 Cisco Systems Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from rally.benchmark.scenarios.nova import hypervisors
from tests.unit import test
NOVA_HYPERVISORS_MODULE = "rally.benchmark.scenarios.nova.hypervisors"
NOVA_HYPERVISORS = NOVA_HYPERVISORS_MODULE + ".NovaHypervisors"
class NovaHypervisorsTestCase(test.TestCase):
def test_list_hypervisors(self):
scenario = hypervisors.NovaHypervisors()
scenario._list_hypervisors = mock.Mock()
scenario.list_hypervisors(detailed=False)
scenario._list_hypervisors.assert_called_once_with(False)

View File

@ -749,3 +749,11 @@ class NovaScenarioTestCase(test.TestCase):
fake_cidr)
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
"nova.delete_floating_ips_bulk")
@mock.patch(NOVA_UTILS + ".NovaScenario.admin_clients")
def test__list_hypervisors(self, mock_clients):
nova_scenario = utils.NovaScenario()
nova_scenario._list_hypervisors(detailed=False)
mock_clients("nova").hypervisors.list.assert_called_once_with(False)
self._test_atomic_action_timer(nova_scenario.atomic_actions(),
"nova.list_hypervisors")