Hi Josephine,

I think you already ran db sync command before this as a trial run. You can verify this via ‘glance-manage db version’  command. If you see version 2024_2 then you need to revert it in database.

Thanks & Best Regards,

Abhishek Kekane


On Tue, 27 Aug 2024 at 6:09 PM, Josephine Seifert <josephine.seifert@cloudandheat.com> wrote:

Hi,

I am currently trying to implement the upgrade path for the image encryption in Glance.

This should change all rows in the image_properties table where the names star with `cinder_encryption*` to `os_encrypt*`

The patch is: https://review.opendev.org/c/openstack/glance/+/926905

When I try to execute the data-migration on my devstack it does not work. I wonder why? What do I have to do to make it work?
Here is what I tried:

```
stack@devstack:~/devstack$ nano ../glance/glance/db/sqlalchemy/alembic_migrations/data_migrations/2024_2_migrate01_rename_encryption_metadata.py
stack@devstack:~/devstack$ source /opt/stack/data/venv/bin/activate
(venv) stack@devstack:~/devstack$ glance-manage db migrate 2024_2_migrate01
INFO dbcounter [-] Registered counter for database glance
DEBUG oslo_db.sqlalchemy.engines [-] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_ENGINE_SUBSTITUTION {{(pid=1782997) _check_effective_sql_mode /opt/stack/data/venv/lib/python3.10/site-packages/oslo_db/sqlalchemy/engines.py:342}}
DEBUG dbcounter [-] [1782997] Writer thread running {{(pid=1782997) stat_writer /opt/stack/data/venv/lib/python3.10/site-packages/dbcounter.py:102}}
INFO alembic.runtime.migration [-] Context impl MySQLImpl.
INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
Database is up to date. No migrations needed.
(venv) stack@devstack:~/devstack$ glance-manage db sync
INFO dbcounter [-] Registered counter for database glance
DEBUG oslo_db.sqlalchemy.engines [-] MySQL server mode set to STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_ENGINE_SUBSTITUTION {{(pid=1783029) _check_effective_sql_mode /opt/stack/data/venv/lib/python3.10/site-packages/oslo_db/sqlalchemy/engines.py:342}}
DEBUG dbcounter [-] [1783029] Writer thread running {{(pid=1783029) stat_writer /opt/stack/data/venv/lib/python3.10/site-packages/dbcounter.py:102}}
INFO alembic.runtime.migration [-] Context impl MySQLImpl.
INFO alembic.runtime.migration [-] Will assume non-transactional DDL.
Database is up to date. No migrations needed.
(venv) stack@devstack:~/devstack$ openstack image show enc-cirros
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                   |
+------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | 581caa530df8ceecfe5d4a87b847d8fa                                                                                                                                        |
| container_format | bare                                                                                                                                                                    |
| created_at       | 2024-06-21T08:10:23Z                                                                                                                                                    |
| disk_format      | raw                                                                                                                                                                     |
| file             | /v2/images/137d3237-3096-4b3f-b2c9-400819211b67/file                                                                                                                    |
| id               | 137d3237-3096-4b3f-b2c9-400819211b67                                                                                                                                    |
| min_disk         | 0                                                                                                                                                                       |
| min_ram          | 0                                                                                                                                                                       |
| name             | enc-cirros                                                                                                                                                              |
| owner            | db05e1116cb04ac689d82c738a5f103c                                                                                                                                        |
| properties       | cinder_encryption_key_deletion_policy='on_image_deletion', cinder_encryption_key_id='cf3d7b02-c82c-4a95-b866-9a22af9f87f1', hw_rng_model='virtio', locations='[{'url':  |
```

thank you
Josephine (Luzi)