Refactor metadef ORM classes to use to_dict instead of as_dict

The Metadef ORM base dictionary class should replace as_dict with to_dict
to be consistent with other Glance ORM classes.

Change-Id: I1550bd519f100cdffcf5046e9838cf192d4aac50
Closes-Bug: 1370058
Updated from global requirements

Change-Id: I32c8167913b9412120d1256ffddf9117f765551f
Add missing metadefs for Aggregate Filters

The below spec implemented in Juno added numerous properties
that can be added to Host Aggregates. The Metadata
Definitions catalog should include them.

https://github.com/openstack/nova-specs/blob/master/specs/juno/per-aggregate-filters.rst

Change-Id: Id37028b4b24ab5f6b0c4547a3c1af47bd76e61f6
Closes-bug: 1368032
(cherry picked from commit 313d4f272cbeabfdcb39de4bcb441749f56fb4d4)
Nova instance config drive Metadata Definition

A nova Juno FFE landed to support setting the
img_config_drive property on images to require images
to be booted with a config drive. The Glance Metadata
Definitions should include this property.

See Nova Blueprint:
https://blueprints.launchpad.net/nova/+spec/config-drive-image-property

Change-Id: Iffc4d4f00f3677ed1fa41233ef6cfbc5c46d8602
Closes-bug: 1367981
(cherry picked from commit 0dd620c7bd7f07935e1cea5d0bfab2a41f754d1b)
Include Metadata Defs Concepts in Dev Docs

The http://docs.openstack.org/developer/glance/
site currently doesn't include the Juno Metadata
Definitions concepts.  This patch adds
an overview of the concepts to this site.

This provides a synopis of the concepts in:
https://github.com/openstack/glance-specs/blob/master/specs/juno/metadata-schema-catalog.rst

DocImpact
Closes-Bug: 1367432
Related-Bug: 1367908
Related-Bug: 1363615
Related-Bug: 1366286
Related-Bug: 1363383
Change-Id: Iad4d388cbbf2f63fa243d04d35032de0cb0bc1b4
(cherry picked from commit 0aab5e271667990afb1a2522c7c9c61fa7211e0b)
Make compute-trust.json compatible with TrustFilter

Current properties inside compute-trust.json does not match
with how TrustFilter in nova works. JSON provides True/False
boolean values but TrustFilter expects trusted/untrusted/unknown
string values. This patch repairs compute-trust.json to be
compatible with TrustFilter.

Change-Id: I26965a549daf9340621b0f18a1b845b39bac4bd8
Closes-Bug: #1369581
(cherry picked from commit 39e90f29d93f991d95092de5f93a239be1b3ca3b)
Specify the MetadefNamespace.namespace column is not nullable

The metadef_namespaces table definition indicates the namespace
column as not accepting nulls. The related MetadefNamespace ORM class
should also indicate that the namespace column does not accept nulls
with "nullable=False" in the column definition.

Change-Id: I681747b6579a2284f23bf154889a61c639b0616d
Closes-Bug: 1367619
(cherry picked from commit 10e858d57be5e04615f390b3060c8aeadaeed954)
Mark custom properties in image schema as non-base

Currently it is impossible to determine if given image schema property
is base or custom one and knowledge of that can be handy in some
situations.    Proposed change appends to every custom property special
key which determiness that it is not a base property.

Change-Id: I49255255df311036d516768afc55475c1f9aad47
Partial-Bug: #1371559
(cherry picked from commit 94c05cbdbb3a78b3df4df8d522555f34d2f0a166)
Merge "Nova instance config drive Metadata Definition" into proposed/juno
Merge "Make compute-trust.json compatible with TrustFilter" into proposed/juno
Merge "Specify the MetadefNamespace.namespace column is not nullable" into proposed/juno
Merge "Include Metadata Defs Concepts in Dev Docs" into proposed/juno
Merge "Mark custom properties in image schema as non-base" into proposed/juno
Update driver metadata definitions to Juno

vmware and libvirt support different hw_vif_model settings.
This patch updates them so that each namespace can specify
the models they support.

vmware api is updated with the vmware_disktype

Change-Id: Iec5901097c9621a052a930b99d5cbe7872d4f3ff
Closes-bug: 1370767
(cherry picked from commit ebafdbeef6420d0fcc4922f245956096ca9e50b3)
Add missing metadefs for shutdown behavior

The following Nova patch adds support for graceful shutdown
of a guest VM and allows setting timeout properties on images.
The properties should be updated in the Metadata Definitions catalog.

https://review.openstack.org/#/c/68942/

Change-Id: I58145d9d0114b3932b63263ea123c4662146d14b
Closes-bug: 1368036
(cherry picked from commit 5fcb3aa2e35e9af17cb8be9e24c6613626036f2b)
Merge "Add missing metadefs for shutdown behavior" into proposed/juno
Metadef Property and Object schema columns should use JSONEncodedDict

The MetadefProperty and MetadefObject ORM classes currently specify the
JSON schema columns as type Text. It is preferred to use the
JSONEncodedDict Type Decorator instead. This fix also includes necessary
code changes to remove JSON encoding/decoding that was previously done
in other layers. Fixes for unit tests involving the schema columns are
also included.

Closes-Bug: 1368479

Conflicts:
	glance/db/__init__.py
	glance/db/sqlalchemy/models_metadef.py

Change-Id: I2c574210f8d62c77a438afab83ff80f3e5bd2fe7
(cherry picked from commit 824d9620b0b90483baf45981d2cb328855943e06)
Use ID for namespace generated by DB

In current implementation ID that is used in namespace to
insert data to DB is generated by built-in function - enumerate.
This causes problems with loading the metadata when there are already
namespaces in DB.

This patch removes 'enumerate' and asks for namespace ID
generated by database.

Closes-Bug: #1367771
Co-Authored-By: Bartosz Fic <bartosz.fic@intel.com>
Co-Authored-By: Pawel Koniszewski <pawel.koniszewski@intel.com>
(cherry picked from commit 89c04904416270d3c306d430f443a7127c5fc206)

Conflicts:
	glance/db/sqlalchemy/metadata.py

Change-Id: I235c6310077526cafb898ac007c3601b4d66c9fe
updated translations

Commands run:-
$ python setup.py extract_messages
$ python setup.py update_catalog --no-fuzzy-matching \
  --ignore-obsolete=true
$ source \
  ../openstack-infra/project-config/jenkins/scripts/common_translation_update.sh
$ setup_loglevel_vars
$ cleanup_po_files glance

Change-Id: If1bdff3f7330c3eb58bd56b08299472ae3d4b552
Merge "Updated from global requirements" into proposed/juno