Merge "Check min config requirements for rbd driver"
This commit is contained in:
commit
8f8f6cf072
@ -15,7 +15,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import ddt
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import tempfile
|
import tempfile
|
||||||
@ -122,6 +122,7 @@ CEPH_MON_DUMP = """dumped monmap epoch 1
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
@ddt.ddt
|
||||||
class RBDTestCase(test.TestCase):
|
class RBDTestCase(test.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -154,6 +155,17 @@ class RBDTestCase(test.TestCase):
|
|||||||
self.snapshot = dict(volume_name=self.volume_name,
|
self.snapshot = dict(volume_name=self.volume_name,
|
||||||
name=self.snapshot_name)
|
name=self.snapshot_name)
|
||||||
|
|
||||||
|
@ddt.data({'cluster_name': None, 'pool_name': 'rbd'},
|
||||||
|
{'cluster_name': 'volumes', 'pool_name': None})
|
||||||
|
@ddt.unpack
|
||||||
|
def test_min_config(self, cluster_name, pool_name):
|
||||||
|
self.cfg.rbd_cluster_name = cluster_name
|
||||||
|
self.cfg.rbd_pool = pool_name
|
||||||
|
|
||||||
|
with mock.patch('cinder.volume.drivers.rbd.rados'):
|
||||||
|
self.assertRaises(exception.InvalidConfigurationValue,
|
||||||
|
self.driver.check_for_setup_error)
|
||||||
|
|
||||||
@common_mocks
|
@common_mocks
|
||||||
def test_create_volume(self):
|
def test_create_volume(self):
|
||||||
client = self.mock_client.return_value
|
client = self.mock_client.return_value
|
||||||
|
@ -290,6 +290,11 @@ class RBDDriver(driver.TransferVD, driver.ExtendVD,
|
|||||||
msg = _('rados and rbd python libraries not found')
|
msg = _('rados and rbd python libraries not found')
|
||||||
raise exception.VolumeBackendAPIException(data=msg)
|
raise exception.VolumeBackendAPIException(data=msg)
|
||||||
|
|
||||||
|
for attr in ['rbd_cluster_name', 'rbd_pool']:
|
||||||
|
val = getattr(self.configuration, attr)
|
||||||
|
if not val:
|
||||||
|
raise exception.InvalidConfigurationValue(option=attr,
|
||||||
|
value=val)
|
||||||
# NOTE: Checking connection to ceph
|
# NOTE: Checking connection to ceph
|
||||||
# RADOSClient __init__ method invokes _connect_to_rados
|
# RADOSClient __init__ method invokes _connect_to_rados
|
||||||
# so no need to check for self.rados.Error here.
|
# so no need to check for self.rados.Error here.
|
||||||
|
Loading…
Reference in New Issue
Block a user