Add boot-server-attach-created-volume-and-resize nova benchmark
Added boot-server-attach-created-volume-and-resize nova benchmark. Partially-Implements: blueprint benchmark-scenarios-for-nova Change-Id: I83782ebd58e155e20b37ab3e12bc24be60bcbc98
This commit is contained in:
parent
8d6ce4e7bc
commit
6ed5c3c671
@ -307,6 +307,33 @@
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
NovaServers.boot_server_attach_created_volume_and_resize:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: "m1.tiny"
|
||||
image:
|
||||
name: {{image_name}}
|
||||
to_flavor:
|
||||
name: "m1.small"
|
||||
volume_size: 1
|
||||
confirm: true
|
||||
force_delete: false
|
||||
do_delete: true
|
||||
boot_server_kwargs: {}
|
||||
create_volume_kwargs: {}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 2
|
||||
users_per_tenant: 1
|
||||
sla:
|
||||
failure_rate:
|
||||
max: 0
|
||||
|
||||
NovaServers.boot_and_bounce_server:
|
||||
-
|
||||
args:
|
||||
|
@ -366,6 +366,57 @@ class NovaServers(utils.NovaScenario,
|
||||
self._resize_revert(server)
|
||||
self._delete_server(server, force=force_delete)
|
||||
|
||||
@types.set(image=types.ImageResourceType,
|
||||
flavor=types.FlavorResourceType,
|
||||
to_flavor=types.FlavorResourceType)
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
@validation.required_services(consts.Service.NOVA, consts.Service.CINDER)
|
||||
@validation.required_openstack(users=True)
|
||||
@scenario.configure(context={"cleanup": ["cinder", "nova"]})
|
||||
def boot_server_attach_created_volume_and_resize(
|
||||
self, image, flavor, to_flavor, volume_size, min_sleep=0,
|
||||
max_sleep=0, force_delete=False, confirm=True, do_delete=True,
|
||||
boot_server_kwargs=None, create_volume_kwargs=None):
|
||||
"""Create a VM from image, attach a volume to it and resize.
|
||||
|
||||
Simple test to create a VM and attach a volume, then resize the VM,
|
||||
detach the volume then delete volume and VM.
|
||||
Optional 'min_sleep' and 'max_sleep' parameters allow the scenario
|
||||
to simulate a pause between attaching a volume and running resize
|
||||
(of random duration from range [min_sleep, max_sleep]).
|
||||
:param image: Glance image name to use for the VM
|
||||
:param flavor: VM flavor name
|
||||
:param to_flavor: flavor to be used to resize the booted instance
|
||||
:param volume_size: volume size (in GB)
|
||||
:param min_sleep: Minimum sleep time in seconds (non-negative)
|
||||
:param max_sleep: Maximum sleep time in seconds (non-negative)
|
||||
:param force_delete: True if force_delete should be used
|
||||
:param confirm: True if need to confirm resize else revert resize
|
||||
:param do_delete: True if resources needs to be deleted explicitly
|
||||
else use rally cleanup to remove resources
|
||||
:param boot_server_kwargs: optional arguments for VM creation
|
||||
:param create_volume_kwargs: optional arguments for volume creation
|
||||
"""
|
||||
boot_server_kwargs = boot_server_kwargs or {}
|
||||
create_volume_kwargs = create_volume_kwargs or {}
|
||||
|
||||
server = self._boot_server(image, flavor, **boot_server_kwargs)
|
||||
volume = self._create_volume(volume_size, **create_volume_kwargs)
|
||||
|
||||
self._attach_volume(server, volume)
|
||||
self.sleep_between(min_sleep, max_sleep)
|
||||
self._resize(server, to_flavor)
|
||||
|
||||
if confirm:
|
||||
self._resize_confirm(server)
|
||||
else:
|
||||
self._resize_revert(server)
|
||||
|
||||
if do_delete:
|
||||
self._detach_volume(server, volume)
|
||||
self._delete_volume(volume)
|
||||
self._delete_server(server, force=force_delete)
|
||||
|
||||
@types.set(image=types.ImageResourceType,
|
||||
flavor=types.FlavorResourceType)
|
||||
@validation.image_valid_on_flavor("flavor", "image")
|
||||
|
@ -0,0 +1,35 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{
|
||||
"NovaServers.boot_server_attach_created_volume_and_resize": [
|
||||
{
|
||||
"args": {
|
||||
"flavor": {
|
||||
"name": "{{flavor_name}}"
|
||||
},
|
||||
"image": {
|
||||
"name": "^cirros.*uec$"
|
||||
},
|
||||
"to_flavor": {
|
||||
"name": "m1.small"
|
||||
},
|
||||
"confirm": true,
|
||||
"volume_size": 1,
|
||||
"force_delete": false,
|
||||
"do_delete": true,
|
||||
"boot_server_kwargs": {},
|
||||
"create_volume_kwargs": {}
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
"times": 10,
|
||||
"concurrency": 2
|
||||
},
|
||||
"context": {
|
||||
"users": {
|
||||
"tenants": 3,
|
||||
"users_per_tenant": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
---
|
||||
NovaServers.boot_server_attach_created_volume_and_resize:
|
||||
-
|
||||
args:
|
||||
flavor:
|
||||
name: "{{flavor_name}}"
|
||||
image:
|
||||
name: "^cirros.*uec$"
|
||||
to_flavor:
|
||||
name: "m1.small"
|
||||
confirm: true
|
||||
volume_size: 1
|
||||
force_delete: false
|
||||
do_delete: true
|
||||
boot_server_kwargs: {}
|
||||
create_volume_kwargs: {}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
concurrency: 2
|
||||
context:
|
||||
users:
|
||||
tenants: 3
|
||||
users_per_tenant: 2
|
@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
|
||||
from rally import exceptions as rally_exceptions
|
||||
@ -25,6 +26,7 @@ NOVA_SERVERS_MODULE = "rally.plugins.openstack.scenarios.nova.servers"
|
||||
NOVA_SERVERS = NOVA_SERVERS_MODULE + ".NovaServers"
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class NovaServersTestCase(test.ScenarioTestCase):
|
||||
|
||||
def test_boot_rescue_unrescue(self):
|
||||
@ -406,6 +408,55 @@ class NovaServersTestCase(test.ScenarioTestCase):
|
||||
def test_resize_with_revert(self):
|
||||
self._test_resize(confirm=False)
|
||||
|
||||
@ddt.data({"confirm": True, "do_delete": True},
|
||||
{"confirm": False, "do_delete": True})
|
||||
@ddt.unpack
|
||||
def test_boot_server_attach_created_volume_and_resize(self, confirm=False,
|
||||
do_delete=False):
|
||||
fake_volume = mock.MagicMock()
|
||||
fake_server = mock.MagicMock()
|
||||
flavor = mock.MagicMock()
|
||||
to_flavor = mock.MagicMock()
|
||||
|
||||
scenario = servers.NovaServers(self.context)
|
||||
scenario.generate_random_name = mock.MagicMock(return_value="name")
|
||||
scenario._boot_server = mock.MagicMock(return_value=fake_server)
|
||||
scenario._create_volume = mock.MagicMock(return_value=fake_volume)
|
||||
scenario._attach_volume = mock.MagicMock()
|
||||
scenario._resize_confirm = mock.MagicMock()
|
||||
scenario._resize_revert = mock.MagicMock()
|
||||
scenario._resize = mock.MagicMock()
|
||||
scenario._detach_volume = mock.MagicMock()
|
||||
scenario._delete_volume = mock.MagicMock()
|
||||
scenario._delete_server = mock.MagicMock()
|
||||
scenario.sleep_between = mock.MagicMock()
|
||||
|
||||
volume_size = 10
|
||||
scenario.boot_server_attach_created_volume_and_resize(
|
||||
"img", flavor, to_flavor, volume_size, min_sleep=10,
|
||||
max_sleep=20, confirm=confirm, do_delete=do_delete)
|
||||
|
||||
scenario._boot_server.assert_called_once_with("img", flavor)
|
||||
scenario._create_volume.assert_called_once_with(volume_size)
|
||||
scenario._attach_volume.assert_called_once_with(fake_server,
|
||||
fake_volume)
|
||||
scenario._detach_volume.assert_called_once_with(fake_server,
|
||||
fake_volume)
|
||||
scenario.sleep_between.assert_called_once_with(10, 20)
|
||||
scenario._resize.assert_called_once_with(fake_server, to_flavor)
|
||||
|
||||
if confirm:
|
||||
scenario._resize_confirm.assert_called_once_with(fake_server)
|
||||
else:
|
||||
scenario._resize_revert.assert_called_once_with(fake_server)
|
||||
|
||||
if do_delete:
|
||||
scenario._detach_volume.assert_called_once_with(fake_server,
|
||||
fake_volume)
|
||||
scenario._delete_volume.assert_called_once_with(fake_volume)
|
||||
scenario._delete_server.assert_called_once_with(fake_server,
|
||||
force=False)
|
||||
|
||||
def test_boot_and_live_migrate_server(self):
|
||||
fake_server = mock.MagicMock()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user