summaryrefslogtreecommitdiffstats
path: root/snaps/openstack/utils/tests/cinder_utils_tests.py
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2018-03-07 13:01:37 -0700
committerspisarski <s.pisarski@cablelabs.com>2018-03-08 14:02:05 -0700
commitf77540b440d3e5224eb1648339dc8c945f29bbe2 (patch)
tree84856cebdfb36f9c758d43bb127d1b91b88cc7d6 /snaps/openstack/utils/tests/cinder_utils_tests.py
parente4563aec1eb8f98e5e42fe513918432eddadcd37 (diff)
Ensure the project for volumes are handled properly.
Although this patch has added the project_name member to VolumeConfig, it does not work properly due to a cinder bug https://bugs.launchpad.net/cinder/+bug/1641982. However, the code will now allow for volumes with the same name to be created on the same pod just as long as they do not exist within the same project/tenant. JIRA: SNAPS-270 Change-Id: Ia6f98e9b66793a69c0205d2d8e38bb3d03f3333e Signed-off-by: spisarski <s.pisarski@cablelabs.com>
Diffstat (limited to 'snaps/openstack/utils/tests/cinder_utils_tests.py')
-rw-r--r--snaps/openstack/utils/tests/cinder_utils_tests.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/snaps/openstack/utils/tests/cinder_utils_tests.py b/snaps/openstack/utils/tests/cinder_utils_tests.py
index b624b09..3004c0f 100644
--- a/snaps/openstack/utils/tests/cinder_utils_tests.py
+++ b/snaps/openstack/utils/tests/cinder_utils_tests.py
@@ -26,7 +26,7 @@ from snaps.openstack import create_volume
from snaps.openstack.create_qos import Consumer
from snaps.openstack.tests import validation_utils
from snaps.openstack.tests.os_source_file_test import OSComponentTestCase
-from snaps.openstack.utils import cinder_utils
+from snaps.openstack.utils import cinder_utils, keystone_utils
__author__ = 'spisarski'
@@ -75,6 +75,7 @@ class CinderUtilsVolumeTests(OSComponentTestCase):
self.volume_name = self.__class__.__name__ + '-' + str(guid)
self.volume = None
self.cinder = cinder_utils.cinder_client(self.os_creds)
+ self.keystone = keystone_utils.keystone_client(self.os_creds)
def tearDown(self):
"""
@@ -94,14 +95,15 @@ class CinderUtilsVolumeTests(OSComponentTestCase):
"""
volume_settings = VolumeConfig(name=self.volume_name)
self.volume = cinder_utils.create_volume(
- self.cinder, volume_settings)
+ self.cinder, self.keystone, volume_settings)
self.assertIsNotNone(self.volume)
self.assertEqual(self.volume_name, self.volume.name)
self.assertTrue(volume_active(self.cinder, self.volume))
volume = cinder_utils.get_volume(
- self.cinder, volume_settings=volume_settings)
+ self.cinder, self.keystone, volume_settings=volume_settings,
+ project_name=self.os_creds.project_name)
self.assertIsNotNone(volume)
validation_utils.objects_equivalent(self.volume, volume)
@@ -111,21 +113,24 @@ class CinderUtilsVolumeTests(OSComponentTestCase):
"""
volume_settings = VolumeConfig(name=self.volume_name)
self.volume = cinder_utils.create_volume(
- self.cinder, volume_settings)
+ self.cinder, self.keystone, volume_settings)
self.assertIsNotNone(self.volume)
self.assertEqual(self.volume_name, self.volume.name)
self.assertTrue(volume_active(self.cinder, self.volume))
volume = cinder_utils.get_volume(
- self.cinder, volume_settings=volume_settings)
+ self.cinder, self.keystone, volume_settings=volume_settings,
+ project_name=self.os_creds.project_name)
self.assertIsNotNone(volume)
validation_utils.objects_equivalent(self.volume, volume)
cinder_utils.delete_volume(self.cinder, self.volume)
self.assertTrue(volume_deleted(self.cinder, self.volume))
self.assertIsNone(
- cinder_utils.get_volume(self.cinder, volume_settings))
+ cinder_utils.get_volume(
+ self.cinder, self.keystone, volume_settings,
+ project_name=self.os_creds.project_name))
def volume_active(cinder, volume):