Change Metadefs OS::Nova::Instance to OS::Nova::Server

The metadata definitions in etc/metadefs allow each namespace to be associated
with a resource type in OpenStack. Now that Horizon is supporting adding
metadata to instances (just got in during the mitaka cycle - so unrealeased),
I realized that we used OS::Nova::Instance instead of OS::Nova::Server in
Glance. This doesn’t align with Heat [0] or Searchlight [1].

There are a couple of metadef files that have OS::Nova::Instance that need to
change to OS::Nova::Server. I see also that OS::Nova:Instance is in one of
the db scripts. That script simply adds some initial "resource types" to the
database. [3]. It should be noted that there is no hard dependency on that
resource type to be in the DB script. You can add new resource types at any
time via API or JSON files and they are automatically added.

I'm not sure if the change to the db script needs to be done in a different
patch or not, but that can easily be accommodated.

See bug for additional links.

Change-Id: I196ce1d9a62a61027ccd444b17a30b2c018d9c84
Closes-Bug: 1537903
This commit is contained in:
Travis Tripp 2016-01-25 14:01:09 -07:00
parent ad75afad0f
commit 33ae05ee86
8 changed files with 49 additions and 7 deletions

View File

@ -282,7 +282,7 @@ The data is returned as a JSON-encoded mapping in the following format::
},
{
"created_at": "2014-08-28T17:13:04Z",
"name": "OS::Nova::Instance",
"name": "OS::Nova::Server",
"updated_at": "2014-08-28T17:13:04Z"
}
]

View File

@ -62,8 +62,9 @@ OpenStack services today:
| + *extra specs* | + *image metadata* | + *properties* |
| Host Aggregate | + *metadata* | + *tags* |
| + *metadata* | VolumeType | |
| Instances | + *extra specs* | |
| Servers | + *extra specs* | |
| + *metadata* | + *qos specs* | |
| + *scheduler_hints* | | |
| + *tags* | | |
+-------------------------+---------------------------+----------------------+
@ -182,4 +183,3 @@ aggregate_instance_extra_specs:companyx:fastio=true
In some cases, there may be multiple different filters that may use
the same property with different prefixes. In this case, the correct prefix
needs to be set based on which filter is enabled.

View File

@ -13,7 +13,7 @@
"properties_target": "image"
},
{
"name": "OS::Nova::Instance",
"name": "OS::Nova::Server",
"properties_target": "metadata"
},
{

View File

@ -13,7 +13,7 @@
"properties_target": "image"
},
{
"name": "OS::Nova::Instance",
"name": "OS::Nova::Server",
"properties_target": "metadata"
}
],

View File

@ -13,7 +13,7 @@
"properties_target": "image"
},
{
"name": "OS::Nova::Instance",
"name": "OS::Nova::Server",
"properties_target": "metadata"
}
],

View File

@ -24,7 +24,7 @@ from glance.db.sqlalchemy.migrate_repo.schema import (
RESOURCE_TYPES = [u'OS::Glance::Image', u'OS::Cinder::Volume',
u'OS::Nova::Flavor', u'OS::Nova::Aggregate',
u'OS::Nova::Instance']
u'OS::Nova::Server']
def _get_metadef_resource_types_table(meta):

View File

@ -0,0 +1,31 @@
# Copyright (c) 2016 Hewlett Packard Enterprise Software, 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 MetaData, Table
def upgrade(migrate_engine):
meta = MetaData()
meta.bind = migrate_engine
resource_types_table = Table('metadef_resource_types', meta, autoload=True)
resource_types_table.update(values={'name': 'OS::Nova::Server'}).where(
resource_types_table.c.name == 'OS::Nova::Instance').execute()
def downgrade(migrate_engine):
# NOTE(TravT): This is a bug fix (1537903). It shouldn't be downgraded.
return

View File

@ -0,0 +1,11 @@
---
upgrade:
- Metadata definitions previously associated with OS::Nova::Instance
have been changed to be associated with OS::Nova::Server in order to
align with Heat and Searchlight. You may either upgrade them using
glance-manage db load_metadefs [path] [merge] [prefer_new] or
glance-manage db upgrade 44.
fixes:
- Metadata definitions previously associated with OS::Nova::Instance
have been changed to be associated with OS::Nova::Server in order to
align with Heat and Searchlight.