Add param volume_type when creating volume in nova scenarios
Volume_type can specify a certain volume type when there are multiple backends. Change-Id: Ifdc80f5bb6c0a05c64f0b0c6b28b536a2e46f714
This commit is contained in:
parent
cf0dc61303
commit
65bb33ed97
4
rally-jobs/nova.yaml
Normal file → Executable file
4
rally-jobs/nova.yaml
Normal file → Executable file
@ -1,6 +1,7 @@
|
||||
{%- set cirros_image_url = "http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img" %}
|
||||
{% set image_name = "^(cirros.*uec|TestVM)$" %}
|
||||
{% set flavor_name = "m1.tiny" %}
|
||||
{% set volume_type = "" %}
|
||||
---
|
||||
Authenticate.validate_nova:
|
||||
-
|
||||
@ -465,6 +466,7 @@
|
||||
image:
|
||||
name: {{image_name}}
|
||||
volume_size: 1
|
||||
volume_type: {{volume_type}}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
@ -485,6 +487,7 @@
|
||||
image:
|
||||
name: {{image_name}}
|
||||
volume_size: 1
|
||||
volume_type: {{volume_type}}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
@ -1107,6 +1110,7 @@
|
||||
image:
|
||||
name: {{image_name}}
|
||||
volume_size: 1
|
||||
volume_type: {{volume_type}}
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 2
|
||||
|
@ -135,6 +135,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume_and_delete(self, image, flavor,
|
||||
volume_size,
|
||||
volume_type=None,
|
||||
min_sleep=0, max_sleep=0,
|
||||
force_delete=False, **kwargs):
|
||||
"""Boot a server from volume and then delete it.
|
||||
@ -147,12 +148,15 @@ class NovaServers(utils.NovaScenario,
|
||||
:param image: image to be used to boot an instance
|
||||
:param flavor: flavor to be used to boot an instance
|
||||
:param volume_size: volume size (in GB)
|
||||
:param volume_type: specifies volume type when there are
|
||||
multiple backends
|
||||
: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 kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
volume = self._create_volume(volume_size, imageRef=image,
|
||||
volume_type=volume_type)
|
||||
block_device_mapping = {"vda": "%s:::1" % volume.id}
|
||||
server = self._boot_server(None, flavor,
|
||||
block_device_mapping=block_device_mapping,
|
||||
@ -278,7 +282,8 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.required_openstack(users=True)
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume(self, image, flavor, volume_size,
|
||||
auto_assign_nic=False, **kwargs):
|
||||
volume_type=None, auto_assign_nic=False,
|
||||
**kwargs):
|
||||
"""Boot a server from volume.
|
||||
|
||||
The scenario first creates a volume and then a server.
|
||||
@ -287,10 +292,13 @@ class NovaServers(utils.NovaScenario,
|
||||
:param image: image to be used to boot an instance
|
||||
:param flavor: flavor to be used to boot an instance
|
||||
:param volume_size: volume size (in GB)
|
||||
:param volume_type: specifies volume type when there are
|
||||
multiple backends
|
||||
:param auto_assign_nic: True if NICs should be assigned
|
||||
:param kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
volume = self._create_volume(volume_size, imageRef=image,
|
||||
volume_type=volume_type)
|
||||
block_device_mapping = {"vda": "%s:::1" % volume.id}
|
||||
self._boot_server(None, flavor, auto_assign_nic=auto_assign_nic,
|
||||
block_device_mapping=block_device_mapping,
|
||||
@ -649,6 +657,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume_and_live_migrate(self, image, flavor,
|
||||
volume_size,
|
||||
volume_type=None,
|
||||
block_migration=False,
|
||||
disk_over_commit=False,
|
||||
force_delete=False,
|
||||
@ -668,6 +677,8 @@ class NovaServers(utils.NovaScenario,
|
||||
:param image: image to be used to boot an instance
|
||||
:param flavor: flavor to be used to boot an instance
|
||||
:param volume_size: volume size (in GB)
|
||||
:param volume_type: specifies volume type when there are
|
||||
multiple backends
|
||||
:param block_migration: Specifies the migration type
|
||||
:param disk_over_commit: Specifies whether to allow overcommit
|
||||
on migrated instance or not
|
||||
@ -676,7 +687,8 @@ class NovaServers(utils.NovaScenario,
|
||||
:param max_sleep: Maximum sleep time in seconds (non-negative)
|
||||
:param kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
volume = self._create_volume(volume_size, imageRef=image,
|
||||
volume_type=volume_type)
|
||||
block_device_mapping = {"vda": "%s:::1" % volume.id}
|
||||
server = self._boot_server(None, flavor,
|
||||
block_device_mapping=block_device_mapping,
|
||||
@ -889,6 +901,7 @@ class NovaServers(utils.NovaScenario,
|
||||
@validation.required_openstack(users=True)
|
||||
@scenario.configure(context={"cleanup": ["nova", "cinder"]})
|
||||
def boot_server_from_volume_snapshot(self, image, flavor, volume_size,
|
||||
volume_type=None,
|
||||
auto_assign_nic=False, **kwargs):
|
||||
"""Boot a server from a snapshot.
|
||||
|
||||
@ -900,10 +913,13 @@ class NovaServers(utils.NovaScenario,
|
||||
:param image: image to be used to boot an instance
|
||||
:param flavor: flavor to be used to boot an instance
|
||||
:param volume_size: volume size (in GB)
|
||||
:param volume_type: specifies volume type when there are
|
||||
multiple backends
|
||||
:param auto_assign_nic: True if NICs should be assigned
|
||||
:param kwargs: Optional additional arguments for server creation
|
||||
"""
|
||||
volume = self._create_volume(volume_size, imageRef=image)
|
||||
volume = self._create_volume(volume_size, imageRef=image,
|
||||
volume_type=volume_type)
|
||||
snapshot = self._create_snapshot(volume.id, False)
|
||||
block_device_mapping = {"vda": "%s:snap::1" % snapshot.id}
|
||||
self._boot_server(None, flavor, auto_assign_nic=auto_assign_nic,
|
||||
|
2
samples/tasks/scenarios/nova/boot-from-volume-and-delete.json
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-from-volume-and-delete.json
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
{
|
||||
"NovaServers.boot_server_from_volume_and_delete": [
|
||||
{
|
||||
@ -10,6 +11,7 @@
|
||||
"name": "^cirros.*uec$"
|
||||
},
|
||||
"volume_size": 10,
|
||||
"volume_type": "{{volume_type}}",
|
||||
"force_delete": false
|
||||
},
|
||||
"runner": {
|
||||
|
2
samples/tasks/scenarios/nova/boot-from-volume-and-delete.yaml
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-from-volume-and-delete.yaml
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
---
|
||||
NovaServers.boot_server_from_volume_and_delete:
|
||||
-
|
||||
@ -8,6 +9,7 @@
|
||||
image:
|
||||
name: "^cirros.*uec$"
|
||||
volume_size: 10
|
||||
volume_type: "{{volume_type}}"
|
||||
force_delete: false
|
||||
runner:
|
||||
type: "constant"
|
||||
|
4
samples/tasks/scenarios/nova/boot-from-volume-snapshot.json
Normal file → Executable file
4
samples/tasks/scenarios/nova/boot-from-volume-snapshot.json
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
{
|
||||
"NovaServers.boot_server_from_volume_snapshot": [
|
||||
{
|
||||
@ -9,7 +10,8 @@
|
||||
"image": {
|
||||
"name": "^cirros.*uec$"
|
||||
},
|
||||
"volume_size": 10
|
||||
"volume_size": 10,
|
||||
"volume_type": "{{volume_type}}"
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
|
2
samples/tasks/scenarios/nova/boot-from-volume-snapshot.yaml
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-from-volume-snapshot.yaml
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
---
|
||||
NovaServers.boot_server_from_volume_snapshot:
|
||||
-
|
||||
@ -8,6 +9,7 @@
|
||||
image:
|
||||
name: "^cirros.*uec$"
|
||||
volume_size: 10
|
||||
volume_type: "{{volume_type}}"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
|
4
samples/tasks/scenarios/nova/boot-from-volume.json
Normal file → Executable file
4
samples/tasks/scenarios/nova/boot-from-volume.json
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
{
|
||||
"NovaServers.boot_server_from_volume": [
|
||||
{
|
||||
@ -9,7 +10,8 @@
|
||||
"image": {
|
||||
"name": "^cirros.*uec$"
|
||||
},
|
||||
"volume_size": 10
|
||||
"volume_size": 10,
|
||||
"volume_type": "{{volume_type}}"
|
||||
},
|
||||
"runner": {
|
||||
"type": "constant",
|
||||
|
2
samples/tasks/scenarios/nova/boot-from-volume.yaml
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-from-volume.yaml
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
---
|
||||
NovaServers.boot_server_from_volume:
|
||||
-
|
||||
@ -8,6 +9,7 @@
|
||||
image:
|
||||
name: "^cirros.*uec$"
|
||||
volume_size: 10
|
||||
volume_type: "{{volume_type}}"
|
||||
runner:
|
||||
type: "constant"
|
||||
times: 10
|
||||
|
2
samples/tasks/scenarios/nova/boot-server-from-volume-and-live-migrate.json
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-server-from-volume-and-live-migrate.json
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
{
|
||||
"NovaServers.boot_server_from_volume_and_live_migrate": [
|
||||
{
|
||||
@ -11,6 +12,7 @@
|
||||
},
|
||||
"block_migration": false,
|
||||
"volume_size": 10,
|
||||
"volume_type": "{{volume_type}}",
|
||||
"force_delete": false
|
||||
},
|
||||
"runner": {
|
||||
|
2
samples/tasks/scenarios/nova/boot-server-from-volume-and-live-migrate.yaml
Normal file → Executable file
2
samples/tasks/scenarios/nova/boot-server-from-volume-and-live-migrate.yaml
Normal file → Executable file
@ -1,4 +1,5 @@
|
||||
{% set flavor_name = flavor_name or "m1.tiny" %}
|
||||
{% set volume_type = volume_type or "" %}
|
||||
---
|
||||
NovaServers.boot_server_from_volume_and_live_migrate:
|
||||
- args:
|
||||
@ -8,6 +9,7 @@
|
||||
name: "^cirros.*uec$"
|
||||
block_migration: false
|
||||
volume_size: 10
|
||||
volume_type: "{{volume_type}}"
|
||||
force_delete: false
|
||||
runner:
|
||||
type: "constant"
|
||||
|
@ -329,10 +329,12 @@ class NovaServersTestCase(test.ScenarioTestCase):
|
||||
fake_volume.id = "volume_id"
|
||||
scenario._create_volume = mock.MagicMock(return_value=fake_volume)
|
||||
|
||||
scenario.boot_server_from_volume("img", 0, 5, auto_assign_nic=False,
|
||||
scenario.boot_server_from_volume("img", 0, 5, volume_type=None,
|
||||
auto_assign_nic=False,
|
||||
fakearg="f")
|
||||
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img")
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img",
|
||||
volume_type=None)
|
||||
scenario._boot_server.assert_called_once_with(
|
||||
None, 0, auto_assign_nic=False,
|
||||
block_device_mapping={"vda": "volume_id:::1"},
|
||||
@ -349,10 +351,11 @@ class NovaServersTestCase(test.ScenarioTestCase):
|
||||
fake_volume.id = "volume_id"
|
||||
scenario._create_volume = mock.MagicMock(return_value=fake_volume)
|
||||
|
||||
scenario.boot_server_from_volume_and_delete("img", 0, 5, 10, 20,
|
||||
scenario.boot_server_from_volume_and_delete("img", 0, 5, None, 10, 20,
|
||||
fakearg="f")
|
||||
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img")
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img",
|
||||
volume_type=None)
|
||||
scenario._boot_server.assert_called_once_with(
|
||||
None, 0,
|
||||
block_device_mapping={"vda": "volume_id:::1"},
|
||||
@ -584,11 +587,13 @@ class NovaServersTestCase(test.ScenarioTestCase):
|
||||
scenario._create_volume = mock.MagicMock(return_value=fake_volume)
|
||||
|
||||
scenario.boot_server_from_volume_and_live_migrate("img", 0, 5,
|
||||
volume_type=None,
|
||||
min_sleep=10,
|
||||
max_sleep=20,
|
||||
fakearg="f")
|
||||
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img")
|
||||
scenario._create_volume.assert_called_once_with(5, imageRef="img",
|
||||
volume_type=None)
|
||||
|
||||
scenario._boot_server.assert_called_once_with(
|
||||
None, 0,
|
||||
@ -780,10 +785,12 @@ class NovaServersTestCase(test.ScenarioTestCase):
|
||||
scenario._create_snapshot = mock.MagicMock(return_value=fake_snapshot)
|
||||
|
||||
scenario.boot_server_from_volume_snapshot("img", "flavor", 1,
|
||||
volume_type=None,
|
||||
auto_assign_nic=False,
|
||||
fakearg="f")
|
||||
|
||||
scenario._create_volume.assert_called_once_with(1, imageRef="img")
|
||||
scenario._create_volume.assert_called_once_with(1, imageRef="img",
|
||||
volume_type=None)
|
||||
scenario._create_snapshot.assert_called_once_with("volume_id", False)
|
||||
scenario._boot_server.assert_called_once_with(
|
||||
None, "flavor", auto_assign_nic=False,
|
||||
|
Loading…
Reference in New Issue
Block a user