Merge "Follow up: Add Datastore Version Registry Extension"

This commit is contained in:
Zuul 2024-11-14 10:39:35 +00:00 committed by Gerrit Code Review
commit cd6cfbae9d
4 changed files with 34 additions and 16 deletions

View File

@ -1,18 +1,26 @@
{
"version": {
"datastore": "cc9ee471-e781-43bf-a796-423c5d549997",
"id": "4eb0179d-fe11-4556-9422-5267d2fc7625",
"links": [
{
"href": "https://127.0.0.1:8779/v1.0/9f8dd5eacb074c9f87d2d822c9092aa5/datastores/versions/4eb0179d-fe11-4556-9422-5267d2fc7625",
"rel": "self"
},
{
"href": "https://127.0.0.1:8779/datastores/versions/4eb0179d-fe11-4556-9422-5267d2fc7625",
"rel": "bookmark"
}
],
"name": "12",
"version": "5.7.29"
"id": "800774c4-0505-4ae7-8cf9-aae131e065ae",
"name": "5.7",
"version": "5.7",
"links": [
{
"href": "https://127.0.0.1:8779/v1.0/0600c20b16444bfa979b879b099805a1/datastores/versions/800774c4-0505-4ae7-8cf9-aae131e065ae",
"rel": "self"
},
{
"href": "https://127.0.0.1:8779/datastores/versions/800774c4-0505-4ae7-8cf9-aae131e065ae",
"rel": "bookmark"
}
],
"datastore": "3423e828-3355-48ef-9c16-5c41e7c196fb",
"active": true,
"packages": "",
"image": null,
"registry_ext": "trove.guestagent.datastore.mysql.manager.Manager",
"repl_strategy": "trove.guestagent.strategies.replication.mysql_gtid.MysqlGTIDReplication",
"image_tags": [
"trove"
]
}
}

View File

@ -0,0 +1,5 @@
---
fixes:
- |
fix a bug where the trove-manage script fails to upgrade
the database when the DBDatastoreVersion table is not empty.

View File

@ -65,7 +65,8 @@ class DBCapabilityOverrides(dbmodels.DatabaseModelBase):
class DBDatastoreVersion(dbmodels.DatabaseModelBase):
_data_fields = ['datastore_id', 'name', 'image_id', 'image_tags',
'packages', 'active', 'manager', 'version']
'packages', 'active', 'manager', 'version',
'registry_ext', 'repl_strategy']
_table_name = 'datastore_versions'

View File

@ -75,7 +75,11 @@ def upgrade() -> None:
'repl_namespace': repl_namespaces.get(dsv_manager, ''),
'repl_strategy': repl_strategies.get(dsv_manager, '')
}
ds_versions_table = table("datastore_versions", column("", String))
ds_versions_table = table(
"datastore_versions",
column("id", String),
column("registry_ext", String),
column("repl_strategy", String))
op.execute(
ds_versions_table.update()
.where(ds_versions_table.c.id == dsv_id)