diff options
author | Zuul <zuul@review.openstack.org> | 2018-11-28 13:43:53 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2018-11-28 13:43:53 +0000 |
commit | 631af5f9bbaa60ea69049119327f9c03a0798f76 (patch) | |
tree | 85699a2a30b13691b8b2a0232bd874c9912c35f1 /ironic/db | |
parent | f526c03ab3ac329fcfbc22a7cc3081c08c6054f9 (diff) | |
parent | 68d62f2bee879306a4951b5d7dd54eabaa17d1bc (diff) | |
download | ironic-631af5f9bbaa60ea69049119327f9c03a0798f76.tar.gz |
Merge "Support for protecting nodes from undeploying and rebuilding"
Diffstat (limited to 'ironic/db')
-rw-r--r-- | ironic/db/sqlalchemy/alembic/versions/93706939026c_add_node_protected_field.py | 33 | ||||
-rw-r--r-- | ironic/db/sqlalchemy/models.py | 5 |
2 files changed, 37 insertions, 1 deletions
diff --git a/ironic/db/sqlalchemy/alembic/versions/93706939026c_add_node_protected_field.py b/ironic/db/sqlalchemy/alembic/versions/93706939026c_add_node_protected_field.py new file mode 100644 index 000000000..d332fc829 --- /dev/null +++ b/ironic/db/sqlalchemy/alembic/versions/93706939026c_add_node_protected_field.py @@ -0,0 +1,33 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +"""Add Node.protected field + +Revision ID: 93706939026c +Revises: d2b036ae9378 +Create Date: 2018-10-18 14:55:12.489170 + +""" + +from alembic import op +import sqlalchemy as sa + +# revision identifiers, used by Alembic. +revision = '93706939026c' +down_revision = 'd2b036ae9378' + + +def upgrade(): + op.add_column('nodes', sa.Column('protected', sa.Boolean(), nullable=False, + server_default=sa.false())) + op.add_column('nodes', sa.Column('protected_reason', sa.Text(), + nullable=True)) diff --git a/ironic/db/sqlalchemy/models.py b/ironic/db/sqlalchemy/models.py index 70dafcc50..37fdbcc71 100644 --- a/ironic/db/sqlalchemy/models.py +++ b/ironic/db/sqlalchemy/models.py @@ -24,7 +24,7 @@ from oslo_db import options as db_options from oslo_db.sqlalchemy import models from oslo_db.sqlalchemy import types as db_types import six.moves.urllib.parse as urlparse -from sqlalchemy import Boolean, Column, DateTime, Index +from sqlalchemy import Boolean, Column, DateTime, false, Index from sqlalchemy import ForeignKey, Integer from sqlalchemy import schema, String, Text from sqlalchemy.ext.declarative import declarative_base @@ -176,6 +176,9 @@ class Node(Base): inspection_started_at = Column(DateTime, nullable=True) extra = Column(db_types.JsonEncodedDict) automated_clean = Column(Boolean, nullable=True) + protected = Column(Boolean, nullable=False, default=False, + server_default=false()) + protected_reason = Column(Text, nullable=True) bios_interface = Column(String(255), nullable=True) boot_interface = Column(String(255), nullable=True) |