Skip to content

Commit

Permalink
Add a volume create/delete stress test
Browse files Browse the repository at this point in the history
Simply performs a create/delete operation, in a while loop for the
duration passed to run_stress.py

Change-Id: I006f3754f1fc1cabfbb90ed72704b2185dcc4e5f
Fixes: bug #1192227
  • Loading branch information
gfidente committed Jun 20, 2013
1 parent a0a9103 commit bbb69e7
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tempest/stress/actions/volume_create_delete.py
@@ -0,0 +1,30 @@
# 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 tempest.common.utils.data_utils import rand_name


def create_delete(manager, logger):
while True:
name = rand_name("volume")
logger.info("creating %s" % name)
resp, volume = manager.volumes_client.create_volume(size=1,
display_name=name)
assert(resp.status == 200)
manager.volumes_client.wait_for_volume_status(volume['id'],
'available')
logger.info("created %s" % volume['id'])
logger.info("deleting %s" % name)
resp, _ = manager.volumes_client.delete_volume(volume['id'])
assert(resp.status == 202)
manager.volumes_client.wait_for_resource_deletion(volume['id'])
logger.info("deleted %s" % volume['id'])
13 changes: 13 additions & 0 deletions tempest/stress/cleanup.py
Expand Up @@ -58,3 +58,16 @@ def cleanup():
for tenant in tenants:
if tenant['name'].startswith("stress_tenant"):
admin_manager.identity_client.delete_tenant(tenant['id'])

_, vols = admin_manager.volumes_client.list_volumes({"all_tenants": True})
for v in vols:
try:
admin_manager.volumes_client.delete_volume(v['id'])
except Exception:
pass

for v in vols:
try:
admin_manager.volumes_client.wait_for_resource_deletion(v['id'])
except Exception:
pass
7 changes: 7 additions & 0 deletions tempest/stress/etc/volume-create-delete-test.json
@@ -0,0 +1,7 @@
[{"action": "tempest.stress.actions.volume_create_delete.create_delete",
"threads": 4,
"use_admin": false,
"use_isolated_tenants": false,
"kwargs": {}
}
]

0 comments on commit bbb69e7

Please sign in to comment.