You have been subscribed to a public bug:

Not sure where this best belongs as it contains both a packaging and a
glance issue, but I'll start with glance.

The glance.postinst script has the following code snippet

        if ! grep sql_connection /etc/glance/glance-registry.conf | grep -qv 
"sql_connection = sqlite:////var/lib/glance/glance.sqlite"
        then
                su -c 'glance-manage db_sync' glance
        fi

During upgrade testing we found a few problems with this part

•       On api servers its legitimate not be configured as a registry server 
also. On those nodes, one way to ensure that is to remove the registry 
configuration file. The package upgrade respects this and doesn’t override the 
removal, but the check will then bomb out if the file doesn’t exist, and the 
package ends up in a partially installed state on api servers.
•       The check looks for ‘sql_connection =  ‘
Theoretically, we think this might match a comment which may give undesired 
behaviour.
•       As coded, we think the check only works for sqlite databases. Our 
database is mysql and the check failed to call the db sync during postinstall. 
Unfortunately, once the registry service was started it seemed to create the 
image_members table, and a manual fixup by calling glance-manage db_sync 
continually failed due to prior existence of the table.
We think the check needs to cover all valid databases (the ! and grep –v are 
hard to read).
Maybe its enough to check for “^sql_connection = <anything>”?
It would be helpful if the database upgrade code could continue if the table 
exists (as long it has the valid columns).

Here’s an admittedly ugly version of what the postinst could do:

        if [ -e /etc/glance/glance-registry.conf ]
        then
            sql_line="`grep ^sql_connection /etc/glance/glance-registry.conf`"
            if ! echo $sql_line | grep -qv "sql_connection = 
sqlite:////var/lib/glance/glance.sqlite" ||
               echo $sql_line | grep -q "^sql_connection = mysql://"
            then
                echo 'glance.postinst sync database'
                logger -plocal0.warn -t glance.postinst 'glance postinstall 
sync database'
                su -c 'glance-manage db_sync' glance
            fi
        fi

** Affects: glance (Ubuntu)
     Importance: Low
         Status: Confirmed

-- 
install/upgrade questions re glance-manage db_sync
https://bugs.launchpad.net/bugs/882581
You received this bug notification because you are a member of Ubuntu Server 
Team, which is subscribed to glance in Ubuntu.

-- 
Ubuntu-server-bugs mailing list
Ubuntu-server-bugs@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-server-bugs

Reply via email to