Update attach logic in VolumeEncryptionTest
Pick the same logic as volume attach tests have, when after
volume attach server is rebooted to make sure guest OS
recognize new device.
Change-Id: I92098c7d994dc7d85643da29380866a805f4e869
Related-Prod: PROD-21942
diff --git a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
index 51491d4..c7d2577 100644
--- a/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
+++ b/barbican_tempest_plugin/tests/scenario/test_volume_encryption.py
@@ -16,6 +16,7 @@
from oslo_log import log as logging
from tempest.common import utils
+from tempest.common import waiters
from tempest import config
from tempest.lib import decorators
from tempest.lib import exceptions as lib_exc
@@ -68,7 +69,8 @@
if device_name in disks:
return
if int(time.time()) - start >= wait_timeout:
- message = 'Device %s was not found in %d sec' % wait_timeout
+ message = ('Device %s did not appear in %d sec' % (
+ device_name, wait_timeout))
raise lib_exc.TimeoutException(message)
def attach_detach_volume(self, server, volume, keypair):
@@ -77,6 +79,13 @@
# Write a timestamp to volume
server_ip = self.get_server_ip(server)
+ self.servers_client.stop_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'SHUTOFF')
+
+ self.servers_client.start_server(server['id'])
+ waiters.wait_for_server_status(self.servers_client, server['id'],
+ 'ACTIVE')
self.wait_for_disk(server_ip, keypair,
CONF.compute.volume_device_name)
timestamp = self.create_timestamp(