Add podm_id field to node database

Currently, node validation schema doesnt allow podm_id as valid
attribute, this commit updates the same. And also, adds the podm_id
to node_db, as it is required for the same, to know which podmanager
is managing the node.

Change-Id: I66ce650afed530cc423db34febb9d8bac564ea55
This commit is contained in:
Anusha Ramineni 2017-07-25 10:21:34 +05:30
parent a31acd11b0
commit 4c28f0864c
3 changed files with 12 additions and 3 deletions

View File

@ -202,6 +202,9 @@ class ComposedNode(ModelBaseWithTimeStamp):
'name': {
'validate': types.Text.validate
},
'podm_id': {
'validate': types.Text.validate
},
'index': {
'validate': types.Text.validate
},

View File

@ -136,6 +136,7 @@ class TestNodeApi(TestApiValidation):
def test_compose_request_using_properties(self, mock_compose):
req = {
"name": "test_request",
"podm_id": "test-podm",
"properties": {
"memory": {
"capacity_mib": "4000",
@ -179,11 +180,13 @@ class TestNodeApi(TestApiValidation):
@mock.patch('valence.controller.nodes.Node.manage_node')
def test_node_manage_request(self, mock_manage):
req = {"node_index": "fake-index"}
req = {"node_index": "fake-index",
"podm_id": "test-podm-id"}
mock_manage.return_value = {"uuid": "ea8e2a25-2901-438d-8157-de7ffd",
"links": "fake-links",
"name": "fake-node",
"index": "fake-index"}
"index": "fake-index",
"podm_id": "test-podm-id"}
resp = self.app.post('/v1/nodes/manage',
content_type='application/json',
data=json.dumps(req))

View File

@ -89,7 +89,8 @@ compose_node_with_flavor = {
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'flavor_id': {'type': 'string'}
'flavor_id': {'type': 'string'},
'podm_id': {'type': 'string'}
},
'required': ['name', 'flavor_id'],
'additionalProperties': False,
@ -100,6 +101,7 @@ compose_node_with_properties = {
'properties': {
'name': {'type': 'string'},
'description': {'type': 'string'},
'podm_id': {'type': 'string'},
'properties': {
'type': 'object',
'properties': {
@ -140,6 +142,7 @@ node_manage_schema = {
'type': 'object',
'properties': {
'node_index': {'type': 'string'},
'podm_id': {'type': 'string'},
},
'required': ['node_index'],
'additionalProperties': False,