During an upgrade, you'll already have a entry in the nova.services table for 'nova-osapi_compute'.
The new wsgi app has NAME='osapi_compute' and first queries for this name, which yields 0 rows.
Then since there's no entry it decides to create a new entry with INSERT where it appends 'nova-' to this 'name'. Problem is there's already an entry for 'nova-osapi_compute', so now the insert fails because of duplicate entries.
So NAME has to be changed, or append 'nova-' on both queries.
During an upgrade, you'll already have a entry in the nova.services table for 'nova-osapi_ compute' .
The new wsgi app has NAME='osapi_ compute' and first queries for this name, which yields 0 rows. compute' , so now the insert fails because of duplicate entries.
Then since there's no entry it decides to create a new entry with INSERT where it appends 'nova-' to this 'name'. Problem is there's already an entry for 'nova-osapi_
So NAME has to be changed, or append 'nova-' on both queries.
Also the queries
SELECT
if exists UPDATE
if not exists INSERT
Could really just boil down to
UPDATE
if fail INSERT
This way it's atomic aswell.