Upgrade to 'datastores' breaks instance list

Bug #1259642 reported by Vipul Sabhaya on 2013-12-10
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack DBaaS (Trove)
Medium
Greg Hill

Bug Description

When upgrading an existing install to data stores support, we break existing API calls such as instance list.

This is because there is no default datastore or datastore_version included as part of the db migration. The addition of a column datastore_version_id means that w/o a default value for preexisting instances, the creation of a SimpleInstance fails.

    Dec 10 06:53:45.908 DEBUG PID:29019 [trove.common.wsgi] Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/trove/common/wsgi.py", line 323, in execute_action
        **action_args)
      File "/usr/local/lib/python2.7/dist-packages/trove/openstack/common/wsgi.py", line 395, in execute_action
        return self.dispatch(self.controller, action, request, **action_args)
      File "/usr/local/lib/python2.7/dist-packages/trove/openstack/common/wsgi.py", line 404, in dispatch
        return method(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/trove/instance/service.py", line 137, in index
        servers, marker = models.Instances.load(context)
      File "/usr/local/lib/python2.7/dist-packages/trove/instance/models.py", line 665, in load
        find_server)
      File "/usr/local/lib/python2.7/dist-packages/trove/instance/models.py", line 697, in _load_servers_status
        ret.append(load_instance(context, db, status, server=server))
      File "/usr/local/lib/python2.7/dist-packages/trove/instance/models.py", line 643, in load_simple_instance
        return SimpleInstance(context, db, status)
      File "/usr/local/lib/python2.7/dist-packages/trove/instance/models.py", line 126, in __init__
        load(self.db_info.datastore_version_id))
      File "/usr/local/lib/python2.7/dist-packages/trove/datastore/models.py", line 89, in load
        raise exception.DatastoreVersionNotFound(version=id_or_name)
    DatastoreVersionNotFound: Datastore version 'None' cannot be found.

Sushil Kumar (sushil-kumar2) wrote :

Facing this problem while upgrading code from pre-"datastore" trove to latest trove.
Probably we need to find way to simulate values from old table service_images and get populated newer needed values in datastores and datastore_versions.

Greg Hill (greg-hill) on 2013-12-12
Changed in trove:
assignee: nobody → Greg Hill (greg-hill)
status: New → In Progress
Changed in trove:
importance: Undecided → Medium
milestone: none → icehouse-2
Greg Hill (greg-hill) wrote :

We discussed it more on IRC and decided to approach it from making the field optional, as the data migration will be highly vendor specific and no code appears to currently consume the ds or ds_version fields added to the instance data by the previous change.

Fix proposed to branch: master
Review: https://review.openstack.org/63523

Changed in trove:
milestone: icehouse-2 → icehouse-3

Reviewed: https://review.openstack.org/63523
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=b973cb2f38d949c13e7c549b1fddc72df4be9b42
Submitter: Jenkins
Branch: master

commit b973cb2f38d949c13e7c549b1fddc72df4be9b42
Author: Greg Hill <email address hidden>
Date: Fri Dec 20 15:18:28 2013 -0600

    make datastore_version_id required

    The datastore addition didn't migrate existing instances,
    which causes existing installations to blow up after upgrading.
    This commit addresses that by inserting best-guess dummy data
    into the db. Operators will need to clean up the values to match
    their actual usage.

    Change-Id: I7ae064cea9b654a4501b91877b779fb4073623af
    Closes-Bug: #1259642

Changed in trove:
status: In Progress → Fix Committed

Reviewed: https://review.openstack.org/69537
Committed: https://git.openstack.org/cgit/openstack/trove/commit/?id=8fa6f56c502784b00333c0f3fe69760f680bacef
Submitter: Jenkins
Branch: master

commit 8fa6f56c502784b00333c0f3fe69760f680bacef
Author: Vipul Sabhaya <email address hidden>
Date: Mon Jan 27 20:49:24 2014 -0800

    Fix default_datastore migration script

    Fixes the migration script introduced earlier to remove
    dependencies on the Trove database model classes.

    Change-Id: I71762baa095039f65e97b3413a7ff0fc3e0014ec
    Closes-Bug: 1259642

Thierry Carrez (ttx) on 2014-03-05
Changed in trove:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2014-04-17
Changed in trove:
milestone: icehouse-3 → 2014.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers