Add db table for Glance Metadata
This commit implements the blueprint https://blueprints.launchpad.net/cinder/+spec/retain-glance-metadata-for-billing It creates the new table volume_glance_metadata in the cinder database, provides the CRUD methods for it, and populates the table when a volume or snapshot is created from a Glance image. Patch set 2: remove superflous line Patch set 3: Fix incorrect column types in sqlalchemy/models.py Patch set 4: Define exception class GlanceMetadataExists Change-Id: I8f98f6eaae005a33bfd49cea783774407b7aa120
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
SQLAlchemy models for cinder data.
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, Integer, String, schema
|
||||
from sqlalchemy import Column, Integer, String, Text, schema
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import ForeignKey, DateTime, Boolean
|
||||
@@ -205,6 +205,16 @@ class VolumeTypeExtraSpecs(BASE, CinderBase):
|
||||
)
|
||||
|
||||
|
||||
class VolumeGlanceMetadata(BASE, CinderBase):
|
||||
"""Glance metadata for a bootable volume"""
|
||||
__tablename__ = 'volume_glance_metadata'
|
||||
id = Column(Integer, primary_key=True, nullable=False)
|
||||
volume_id = Column(String(36), ForeignKey('volumes.id'))
|
||||
snapshot_id = Column(String(36), ForeignKey('snapshots.id'))
|
||||
key = Column(String(255))
|
||||
value = Column(Text)
|
||||
|
||||
|
||||
class Quota(BASE, CinderBase):
|
||||
"""Represents a single quota override for a project.
|
||||
|
||||
@@ -378,6 +388,7 @@ def register_models():
|
||||
VolumeMetadata,
|
||||
VolumeTypeExtraSpecs,
|
||||
VolumeTypes,
|
||||
VolumeGlanceMetadata,
|
||||
)
|
||||
engine = create_engine(FLAGS.sql_connection, echo=False)
|
||||
for model in models:
|
||||
|
||||
Reference in New Issue
Block a user