Merge "Set random name in common function create_server"
diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py
index e6b8234..b788d54 100644
--- a/tempest/api/volume/base.py
+++ b/tempest/api/volume/base.py
@@ -172,7 +172,11 @@
except Exception:
pass
- def create_server(self, name, **kwargs):
+ def create_server(self, **kwargs):
+ name = kwargs.get(
+ 'name',
+ data_utils.rand_name(self.__class__.__name__ + '-instance'))
+
tenant_network = self.get_tenant_network()
body, _ = compute.create_test_server(
self.os,
diff --git a/tempest/api/volume/test_volumes_actions.py b/tempest/api/volume/test_volumes_actions.py
index 83844e3..7fd8b60 100644
--- a/tempest/api/volume/test_volumes_actions.py
+++ b/tempest/api/volume/test_volumes_actions.py
@@ -55,10 +55,7 @@
@test.services('compute')
def test_attach_detach_volume_to_instance(self):
# Create a server
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Volume is attached and detached successfully from an instance
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],
@@ -89,10 +86,7 @@
@test.services('compute')
def test_get_volume_attachment(self):
# Create a server
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Verify that a volume's attachment information is retrieved
self.client.attach_volume(self.volume['id'],
instance_uuid=server['id'],
diff --git a/tempest/api/volume/test_volumes_backup.py b/tempest/api/volume/test_volumes_backup.py
index 867e520..141336f 100644
--- a/tempest/api/volume/test_volumes_backup.py
+++ b/tempest/api/volume/test_volumes_backup.py
@@ -84,9 +84,7 @@
volume = self.create_volume()
self.addCleanup(self.volumes_client.delete_volume,
volume['id'])
- server_name = data_utils.rand_name(
- self.__class__.__name__ + '-instance')
- server = self.create_server(name=server_name, wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
# Attach volume to instance
self.servers_client.attach_volume(server['id'],
volumeId=volume['id'])
diff --git a/tempest/api/volume/test_volumes_negative.py b/tempest/api/volume/test_volumes_negative.py
index e8ead5b..fda0dda 100644
--- a/tempest/api/volume/test_volumes_negative.py
+++ b/tempest/api/volume/test_volumes_negative.py
@@ -176,10 +176,7 @@
@test.idempotent_id('f5e56b0a-5d02-43c1-a2a7-c9b792c2e3f6')
@test.services('compute')
def test_attach_volumes_with_nonexistent_volume_id(self):
- srv_name = data_utils.rand_name(self.__class__.__name__ + '-Instance')
- server = self.create_server(
- name=srv_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
self.assertRaises(lib_exc.NotFound,
self.client.attach_volume,
diff --git a/tempest/api/volume/test_volumes_snapshots.py b/tempest/api/volume/test_volumes_snapshots.py
index f971eca..7be31d1 100644
--- a/tempest/api/volume/test_volumes_snapshots.py
+++ b/tempest/api/volume/test_volumes_snapshots.py
@@ -45,11 +45,7 @@
def test_snapshot_create_with_volume_in_use(self):
# Create a snapshot when volume status is in-use
# Create a test instance
- server_name = data_utils.rand_name(
- self.__class__.__name__ + '-instance')
- server = self.create_server(
- name=server_name,
- wait_until='ACTIVE')
+ server = self.create_server(wait_until='ACTIVE')
self.servers_client.attach_volume(
server['id'], volumeId=self.volume_origin['id'],
device='/dev/%s' % CONF.compute.volume_device_name)