Glance API V2 can't recognize parameter 'id'

Based on current implement, API V2 is using **id** in image schema,
but using **image_id** for most of the internal functions as key
word arguments. So user will got a key error if using:

glance --os-image-api-version 2 image-create --id <id>

This patch will map 'id' to 'image_id' in RequestDeserializer and
add an unit test case fo the change.

Closes-Bug: 1366515

Change-Id: I4c72881a7ada728307e806776426b42cf4cf0993
Duplicated image id return 409 instead of 500 in API v2

Based on current code, in API v2 duplicated image id will
return HTTP 500 error instead of 409. This patch fix this
issue and add an unit test case for that.

Closes-Bug: 1366503

Change-Id: Ia6c27f9edffd63619d63013e456072d811daf127
Change open(file) to with block

Currently script which loads metadata definitions to database
uses open(file) to stream files. This isn't the best practice
because in case of any errors this code may not be safe.
To solve this problem this patch changes open(file) to
'with open(file) as...:' block. It allows us to ensure that every
resource is cleaned up when the code finishes running.

Change-Id: I4a85700061ed5050f4356f1b39ea128931626c83
Closes-Bug: #1367172
Sync glance docs with metadefs api changes

 - Rename resource_type to resource_type_
   associations in namespace API input/output
 - Add created_at/updated_at in resource_
   type_associations block of namespace API
   input/output.
 - Fix minor nits

Closes-bug: 1367908

Change-Id: Ie74bfb36a7023abb346852f5b863f19d0d7bc4ff
Replaces assertEqual with assertTrue and assertFalse

In order to improve coding practices and be aligned to a standard,
self.assertEqual(...,True) statements where replaced with
self.assertTrue and self.assertFalse.

Change-Id: I4150a343493beae03d6f71c88e84f60d14fb60e1
Closes-Bug: #1230127
Enabling separated sample config file generation

As a common approach most projects used now and Oslo preferred, this
change enabled sample configuration file generation mechanism for
each Glance services.

This change, as an enhancement, allows generating separated sample
configuration files for each Glance major services, e.g.:

    etc/glance-api.conf.sample
    etc/glance-cache.conf.sample
    etc/glance-manage.conf.sample
    etc/glance-registry.conf.sample
    etc/glance-scrubber.conf.sample

It is different than I94d486d6686815c45705a7a9b00fb26062e1eb63
which only supports generating an unified sample configuration
file to including all Glance available options.

This mechanism  not only can help auditing by packager, milestone
maintainer or developer as a function (testenv) of tox, but also
those separated configuration files could make deployment be easy.
And it helps keeping sample configuration files be update with
code change.

The change added "genconfigs" function as a tox testenv (-egenconfigs),
and it dependes on oslo-config-generator function of oslo.config.

The change doesn't introduce those sample files Glance repo, so
next step is to investigate if we can generate them in gate
automatically when a change was merged.

Related-Change-Id: I15686708fc9460948a58cfea3d18dae40ba1fda9
Related-Change-Id: Iae31856d5886ee78786972d80c7c103c3460a2b3
Related-Change-Id: I76043b08e2872867e5af2a5ac902e4d092fda5c8
Closes-Bug: #1300546
Closes-Bug: #1361963

Change-Id: Ibe03a3fe80b96ca32acb1a6bea7e38e6075951bb
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Fixes Error Calling GET on V1 Registry

Calling GET on members in the glance registry no longer returns a
500 Server Error. Since GET isn't supported, it now returns a
405 Method Not Allowed, matching the behavior of members for the
glance api.

Change-Id: I25d7e5f4818a1cdb20788643ae6dd7e277928743
Closes-Bug: #1187395
Remove uses of unicode() builtin

Some uses of unicode() appear to have crept into glance's codebase. This
change replaces them with the recommended six.text_type().

Change-Id: I239f91114a921d3276da5cfd96ec1fde10601565
Partial-bug: #1282893
Enforce using six.text_type() over unicode()

For python 3 compatibility, this adds a hacking check to prevent the
usage of unicode().

Change-Id: I791bbf251ac0f9615a9bedc2dd295a7982d72e0a
Closes-bug: #1282893
replace dict.iteritems() with six.iteritems(dict)

All metadata definition code added should ensure that
six.iteritems is used.

Change-Id: Ic93595ffb2a5a8ed7667028d820fac8debd988e6
Closes-Bug: #1370769
Merge "Enabling separated sample config file generation"
Merge "Replaces assertEqual with assertTrue and assertFalse"
Merge "Enforce using six.text_type() over unicode()"
Merge "Sync glance docs with metadefs api changes"
Merge "Change open(file) to with block"
Remove db_enforce_mysql_charset option for db_sync of glance-manage

This is a deprecated option only should be used for migration. As we
scheduled before, now glance removes it out from Juno release.

Change-Id: Ice4ade659307ee5e635a75d6637b4664ee431c20
Signed-off-by: Zhi Yan Liu <zhiyanl@cn.ibm.com>
Updated from global requirements

Change-Id: I988b92eeb0bde0372247a27b6148f1b4c982eaa9
Merge "Fixes Error Calling GET on V1 Registry"
Merge "Updated from global requirements"
Merge "Glance API V2 can't recognize parameter 'id'"