diff --git a/tempest/api/volume/base.py b/tempest/api/volume/base.py index e6b8234b3f..b788d54e0c 100644 --- a/tempest/api/volume/base.py +++ b/tempest/api/volume/base.py @@ -172,7 +172,11 @@ class BaseVolumeTest(tempest.test.BaseTestCase): 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 83844e370f..7fd8b60e66 100644 --- a/tempest/api/volume/test_volumes_actions.py +++ b/tempest/api/volume/test_volumes_actions.py @@ -55,10 +55,7 @@ class VolumesV2ActionsTest(base.BaseVolumeTest): @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 @@ class VolumesV2ActionsTest(base.BaseVolumeTest): @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 867e520cf3..141336fe0c 100644 --- a/tempest/api/volume/test_volumes_backup.py +++ b/tempest/api/volume/test_volumes_backup.py @@ -84,9 +84,7 @@ class VolumesBackupsV2Test(base.BaseVolumeTest): 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 e8ead5b2d1..fda0ddae32 100644 --- a/tempest/api/volume/test_volumes_negative.py +++ b/tempest/api/volume/test_volumes_negative.py @@ -176,10 +176,7 @@ class VolumesV2NegativeTest(base.BaseVolumeTest): @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 f971ecabb0..7be31d1368 100644 --- a/tempest/api/volume/test_volumes_snapshots.py +++ b/tempest/api/volume/test_volumes_snapshots.py @@ -45,11 +45,7 @@ class VolumesV2SnapshotTestJSON(base.BaseVolumeTest): 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)