Merge "Allowing shares to be edited on cluster update"

This commit is contained in:
Jenkins 2015-11-09 10:07:48 +00:00 committed by Gerrit Code Review
commit f86284180f
3 changed files with 30 additions and 3 deletions

View File

@ -16,6 +16,7 @@
import copy
import sahara.service.validations.cluster_template_schema as ct_schema
from sahara.service.validations import shares
def _build_node_groups_schema():
@ -66,7 +67,8 @@ CLUSTER_UPDATE_SCHEMA = {
},
"is_protected": {
"type": ["boolean", "null"],
}
},
"shares": copy.deepcopy(shares.SHARE_SCHEMA),
},
"additionalProperties": False,
"required": []

View File

@ -368,3 +368,26 @@ class ClusterTest(test_base.ConductorManagerTestCase):
self.assertRaises(sa_exc.InvalidRequestError,
self.api.cluster_get_all,
ctx, **{'badfield': 'somevalue'})
def test_cluster_update_shares(self):
ctx = context.ctx()
cluster_db_obj = self.api.cluster_create(ctx, SAMPLE_CLUSTER)
_id = cluster_db_obj["id"]
test_shares = [
{
"id": "bd71d2d5-60a0-4ed9-a3d2-ad312c368880",
"path": "/mnt/manila",
"access_level": "rw"
}
]
updated_cl = self.api.cluster_update(ctx, _id, {"shares": test_shares})
self.assertIsInstance(updated_cl, dict)
self.assertEqual(test_shares, updated_cl["shares"])
get_cl_obj = self.api.cluster_get(ctx, _id)
self.assertEqual(updated_cl, get_cl_obj)
with testtools.ExpectedException(ex.NotFoundException):
self.api.cluster_update(ctx, "bad_id", {"shares": test_shares})

View File

@ -37,7 +37,8 @@ class TestClusterUpdateValidation(u.ValidationTestCase):
'name': 'cluster',
'description': 'very big cluster',
'is_public': False,
'is_protected': False
'is_protected': False,
'shares': []
})
def test_cluster_update_nothing_required(self):
@ -51,7 +52,8 @@ class TestClusterUpdateValidation(u.ValidationTestCase):
'name': 'cluster',
'description': 'very big cluster',
'is_public': False,
'is_protected': False
'is_protected': False,
'shares': []
}
)