Merge "Fix create cluster with cinder"
This commit is contained in:
commit
7923c58e44
|
@ -35,7 +35,7 @@ NODE_GROUP_DEFAULTS = {
|
|||
"node_configs": {},
|
||||
"volumes_per_node": 0,
|
||||
"volumes_size": 0,
|
||||
"volume_mount_prefix": "",
|
||||
"volume_mount_prefix": "/volumes/disk",
|
||||
}
|
||||
|
||||
INSTANCE_DEFAULTS = {
|
||||
|
|
|
@ -129,6 +129,8 @@ def _mount_volume(instance, device_path, mount_point):
|
|||
|
||||
|
||||
def detach(cluster):
|
||||
ctx = context.ctx()
|
||||
cluster = conductor.cluster_get(ctx, cluster)
|
||||
for node_group in cluster.node_groups:
|
||||
detach_from_instances(node_group.instances)
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ class DefaultsTest(test_base.ConductorManagerTestCase):
|
|||
node_configs={},
|
||||
volumes_per_node=0,
|
||||
volumes_size=0,
|
||||
volume_mount_prefix="")
|
||||
volume_mount_prefix="/volumes/disk")
|
||||
|
||||
def test_instance_defaults(self):
|
||||
ctx = context.ctx()
|
||||
|
|
|
@ -38,10 +38,11 @@ class TestAttachVolume(models_test_base.DbTestCase):
|
|||
self.assertRaises(ex.RemoteCommandException, volumes._mount_volume,
|
||||
instance, '123', '456')
|
||||
|
||||
@mock.patch('savanna.conductor.manager.ConductorManager.cluster_get')
|
||||
@mock.patch('cinderclient.v1.volumes.Volume.delete')
|
||||
@mock.patch('cinderclient.v1.volumes.Volume.detach')
|
||||
@mock.patch('savanna.utils.openstack.cinder.get_volume')
|
||||
def test_detach_volumes(self, p_get_volume, p_detach, p_delete):
|
||||
def test_detach_volumes(self, p_get_volume, p_detach, p_delete, p_cond):
|
||||
instance = {'instance_id': '123454321',
|
||||
'volumes': [123]}
|
||||
|
||||
|
@ -53,7 +54,8 @@ class TestAttachVolume(models_test_base.DbTestCase):
|
|||
self.assertIsNone(
|
||||
volumes.detach_from_instances([ng.instances[0]]))
|
||||
|
||||
cluster = r.ClusterResource({'node_groups': [ng]})
|
||||
cluster = r.ClusterResource({'id': '123', 'node_groups': [ng]})
|
||||
p_cond.return_value = cluster
|
||||
p_delete.side_effect = RuntimeError
|
||||
self.assertRaises(RuntimeError, volumes.detach, cluster)
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ def validate_uuid_format(entry):
|
|||
|
||||
@jsonschema.FormatChecker.cls_checks('posix_path')
|
||||
def validate_posix_path(entry):
|
||||
res = re.match("^(/([A-Z]|[a-z]|[0-9]|\-|_)+)*$", entry)
|
||||
res = re.match("^(/([A-Z]|[a-z]|[0-9]|\-|_)+)+$", entry)
|
||||
return res is not None
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue