From e3caa76fbcb95b39be0215afd753e91ce2a7a01f Mon Sep 17 00:00:00 2001 From: tengqm Date: Thu, 18 Dec 2014 15:08:43 +0800 Subject: [PATCH] Add 'data' fields to cluster and node --- senlin/db/sqlalchemy/migrate_repo/versions/001_first_version.py | 2 ++ senlin/db/sqlalchemy/models.py | 2 ++ senlin/engine/cluster.py | 1 + senlin/engine/node.py | 1 + 4 files changed, 6 insertions(+) diff --git a/senlin/db/sqlalchemy/migrate_repo/versions/001_first_version.py b/senlin/db/sqlalchemy/migrate_repo/versions/001_first_version.py index 51a84345c..9f14a8731 100644 --- a/senlin/db/sqlalchemy/migrate_repo/versions/001_first_version.py +++ b/senlin/db/sqlalchemy/migrate_repo/versions/001_first_version.py @@ -53,6 +53,7 @@ def upgrade(migrate_engine): sqlalchemy.Column('status', sqlalchemy.String(255)), sqlalchemy.Column('status_reason', sqlalchemy.String(255)), sqlalchemy.Column('tags', types.Json), + sqlalchemy.Column('data', types.Json), mysql_engine='InnoDB', mysql_charset='utf8' ) @@ -76,6 +77,7 @@ def upgrade(migrate_engine): sqlalchemy.Column('status', sqlalchemy.String(255)), sqlalchemy.Column('status_reason', sqlalchemy.String(255)), sqlalchemy.Column('tags', types.Json), + sqlalchemy.Column('data', types.Json), mysql_engine='InnoDB', mysql_charset='utf8' ) diff --git a/senlin/db/sqlalchemy/models.py b/senlin/db/sqlalchemy/models.py index de55adb19..859a6a3d1 100644 --- a/senlin/db/sqlalchemy/models.py +++ b/senlin/db/sqlalchemy/models.py @@ -103,6 +103,7 @@ class Cluster(BASE, SenlinBase, SoftDelete): status = sqlalchemy.Column(sqlalchemy.String(255)) status_reason = sqlalchemy.Column(sqlalchemy.String(255)) tags = sqlalchemy.Column(types.Json) + data = sqlalchemy.Column(types.Json) class Node(BASE, SenlinBase): @@ -128,6 +129,7 @@ class Node(BASE, SenlinBase): status = sqlalchemy.Column(sqlalchemy.String(255)) status_reason = sqlalchemy.Column(sqlalchemy.String(255)) tags = sqlalchemy.Column(types.Json) + data = sqlalchemy.Column(types.Json) class ClusterLock(BASE, SenlinBase): diff --git a/senlin/engine/cluster.py b/senlin/engine/cluster.py index 328ec26ec..9582f88cd 100644 --- a/senlin/engine/cluster.py +++ b/senlin/engine/cluster.py @@ -56,6 +56,7 @@ class Cluster(object): self.status = '' self.status_reason = '' + self.data = {} self.tags = {} # persist object into database very early because: diff --git a/senlin/engine/node.py b/senlin/engine/node.py index 26fbb82c0..80c12fdb3 100644 --- a/senlin/engine/node.py +++ b/senlin/engine/node.py @@ -48,6 +48,7 @@ class Node(object): self.status = self.ACTIVE self.status_reason = 'Initialized' + self.data = {} self.tags = {} # TODO: store this to database