Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds
disabled
field for instance-types.
The `disabled` field is intended to be used when phasing out instance-types. In this case, a delete wouldn't work because the instance-type needs to still be available for live instances using that type, but we don't want to allow *new* instances created from that type. In addition, we don't want to list hidden instance-types for regular users, but we *do* want to list them for admin-users to ensure they have a complete view of what's going on in the system. Once all references to the phased-out instance-type have been dropped, it would be safe to mark the instance-type as `deleted=True`. Change-Id: I2af1c027f4d8114aee31353007dfdd3d0bb679ed
- Loading branch information
1 parent
9a020a6
commit f371198
Showing
12 changed files
with
349 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
nova/db/sqlalchemy/migrate_repo/versions/099_add_disabled_instance_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright 2012 OpenStack LLC. | ||
# | ||
# 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. | ||
|
||
from sqlalchemy import Boolean, Column, MetaData, Table | ||
|
||
from nova import log as logging | ||
|
||
LOG = logging.getLogger(__name__) | ||
|
||
|
||
def upgrade(migrate_engine): | ||
meta = MetaData() | ||
meta.bind = migrate_engine | ||
|
||
instance_types = Table('instance_types', meta, autoload=True) | ||
disabled = Column('disabled', Boolean) | ||
|
||
instance_types.create_column(disabled) | ||
instance_types.update().values(disabled=False).execute() | ||
|
||
|
||
def downgrade(migrate_engine): | ||
meta = MetaData() | ||
meta.bind = migrate_engine | ||
|
||
instance_types = Table('instance_types', meta, autoload=True) | ||
disabled = Column('disabled', Boolean) | ||
|
||
instance_types.drop_column(disabled) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.