Models should be the same as the state in DB after migration (partial)
We are using declarative_base in nova.db.models just for reflection, not for db creation.
For creation we are using migrations.
We don't have any tests that checks, that our models are up-to-date. Also we are testing it only on sqlite, which couldn't test such things as nullable constraints.
So We should:
1) Use always explicit nullable parameter for columns. There is a lot of mistakes in current nova models implementation. (sometimes in schema is nullable=True and in model nullable=False and vise versa). Also at this moment when you see Column description without nullable, you couldn't be sure that is author forget to set nullable='False' or it is really nullable='True'. So the easiest way to track all this and to fix and to avoid such things is to have one rule "always use explicit nullable".
2) Add in __table_args__ indexes and unique constraints
3) Fix all mistakes in models
4) Fix all mistekes in migrations
5) Sync effects of migrations in different backends.
6) Add tests that ensures that models are up-to-date.
This will allow us to find probably some mistake, or missing inexes and make work with db more clean.
Blueprint information
- Status:
- Started
- Approver:
- Russell Bryant
- Priority:
- Low
- Drafter:
- Boris Pavlovic
- Direction:
- Needs approval
- Assignee:
- Boris Pavlovic
- Definition:
- Review
- Series goal:
- None
- Implementation:
- Slow progress
- Milestone target:
- next
- Started by
- Boris Pavlovic
- Completed by
Related branches
Related bugs
Sprints
Whiteboard
This blueprint has been deferred from the icehouse-3 milestone to Juno because it missed the "feature proposal freeze" deadline. https:/
This has lots of abandoned patches, defer this to Juno --johnthetubaguy
List of models:
✓AgentBuild
✓Aggregates
✓AggregateHost
✓AggregateMetadata
✓BandwidthUsage
✓BlockDeviceMapping
✓Cell
✓ Certificate
✓ ComputeNode
✓ ComputeNodeStat
✓Console
✓ConsolePool
✓DNSDomain
✓FixedIp
✓FloatingIp
✓ Instance
✓InstanceAction
✓InstanceAction
✓InstanceFault
✓InstanceGroup
✓InstanceGroupM
✓InstanceGroupM
✓InstanceGroupP
✓InstanceIdMapping
⚒InstanceInfoCache
✓InstanceMetadata
✓InstanceSystem
✓InstanceTypeEx
✓InstanceTypePr
✓InstanceTypes
✓ IscsiTarget
✓ KeyPair
✓ Migration
✓ Network
✓ProviderFirewa
✓Quota
✓QuotaClass
✓QuotaUsage
✓Reservation
✓S3Image
✓SecurityGroup
✓SecurityGroupI
✓SecurityGroupI
✓SecurityGroupI
✓ Service
✓Snapshot
✓SnapshotIdMapping
✓TaskLog
✓VirtualInterface
✓Volume
✓VolumeIdMapping
✓VolumeUsage
Bugs found that should be fixed by migrations:
*) drop `block_
*) InstanceAction.
*) SecurityGroupIn
*) SecurityGroupIn
SecurityGroupI
SecurityGroupIn
should be nullable=False
*) create fk in migrations for instance_uuid column
*) drop unused tables declared im migrations and skipped in models.
Gerrit topic: https:/
Addressed by: https:/
Fix db.models.Service description
Addressed by: https:/
Fix db.models.
Addressed by: https:/
Fix db.models.
Addressed by: https:/
Fix db.models.
Addressed by: https:/
Fix db.models.Instance description
Addressed by: https:/
Sync models and migrations.
Addressed by: https:/
Sync db.models.Instance* with migrations.
Addressed by: https:/
Sync db.models.Quota* with migrations.
Gerrit topic: https:/
Addressed by: https:/
Changed models for AgentBuild, Aggregates, AggregateHost tables.
Addressed by: https:/
Fix db description for some of Instance* models
Addressed by: https:/
Sync db.models.Security* with migrations.
Addressed by: https:/
Sync db.models.Volume* with migrations.
Addressed by: https:/
Sync db.models with migrations.
Addressed by: https:/
Sync models and migrations.
Addressed by: https:/
Sync models and migrations.
Addressed by: https:/
Sync models.Console* with migrations.
Addressed by: https:/
Sync db.models and migrations.
Addressed by: https:/
Sync db.models.Instance* with migrations.
Addressed by: https:/
Add cinder cleanup to migrations.
Addressed by: https:/
Check of equal models and migrations (mysql).
Addressed by: https:/
Sync models with migrations.
Addressed by: https:/
Add migrations with missing fkeys.
Addressed by: https:/
Fix migrations index
Gerrit topic: https:/
Addressed by: https:/
Change the types of hypervisor_type and launched_on columns
Gerrit topic: https:/
Addressed by: https:/
Add missing indexes back in from 152
Addressed by: https:/
Sync models with migrations
Addressed by: https:/
Implement testing of migrations from oslo
Addressed by: https:/
Sync migration with model PciDevice state
Unapproved - please re-submit via nova-spec --johnthetubagy (20th March 2014)
Addressed by: https:/
Sync model with migrations
Addressed by: https:/
Add migration to fix nullable params
Addressed by: https:/
Sync model SecurityGroup with migrations
Addressed by: https:/
Add a migration to change index in 'migrations' table.
Addressed by: https:/
WIP: test model migrations
Addressed by: https:/
Models should be the same as the state in DB after migration.
Work Items
Dependency tree
* Blueprints in grey have been implemented.