]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commit
Improve metadata update operations
authorGorka Eguileor <geguileo@redhat.com>
Fri, 21 Aug 2015 17:06:07 +0000 (19:06 +0200)
committerGorka Eguileor <geguileo@redhat.com>
Wed, 25 Nov 2015 15:49:57 +0000 (16:49 +0100)
commit9bcf96230e4fd6d7998782c0c62cc8188df518ac
tree20fb71eedb6aa64fb33395fe9cec8a0f63d0b616
parent1070c28774a74f3e482cb21dbd98f031010ec4a5
Improve metadata update operations

Currently our metadata operations in the DB and the API are less than
optimal, main issues are:

- To update metadata first we get all metadata in the API and add
  requested update metadata, then on the DB we retrieve each of the
  metadata keys and update one by one contents.
- When deletion of existing keys is requested in the DB we retrieve all
  metadata contents and for those that are not in the new metadata we
  retrieve the contents from the DB (again) and delete the entry.

This patch changes this so we no longer retrieve metadata in the API,
deletion does not retrieve any metadata from the DB and just makes 1
deletion request to the DB, and for changes we retrieve metadata once
and then issue a bulk change to create new entries and update existing
ones.

Partial-Bug: #1238093
Change-Id: I12506541cca61282122e319e3504560f68df225b
cinder/db/sqlalchemy/api.py
cinder/tests/unit/test_db_api.py
cinder/volume/api.py