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
Can not delete images if db deadlock occurs

Glance api returns 500 Internal Server Error, if db deadlock occurs
in glance-registry for some reason while deleting an image.

Added retry on image_destroy when db deadlock occures which will again
try to delete the image from database.

Closes-bug: 1378215
Change-Id: Ifad403e363daf368e846b5b6838432a7bedbe81a
Add logging to image_members and image_tags

Adding exceptions logging in image_members and image_tags modules in
REST API.

Change-Id: I36d7425c033403dab030bf79c5249a90e0865e7e
Closes-Bug: 1349845
Related to bp refactoring-glance-logging
DocImpact
Glance scrubber should page thru images from registry

If the registry is limited in it's page size when returning the
list of images, the scrubber will only receive the first page.
This patch enables the scrubber to retrieve all the pages of
images.

The new tests are implemented with mock rather than mox. There
is another patch (https://review.openstack.org/#/c/111995) to
convert the existing code in test_scrubber to use mock.

Change-Id: I106f679be96bd39167337c4e27f4046f90d7d7ff
Closes-Bug: 1280343
Merge "Refactor metadef ORM classes to use to_dict instead of as_dict"
Merge "Can not delete images if db deadlock occurs"
Merge "Add logging to image_members and image_tags"
Merge "Glance scrubber should page thru images from registry"
Remove eventlet_hub option

The option has a default value that is not portable, and therefore the
test fails on OS like Darwin. There's actually no need to specify any
hub – no other OpenStack projects as that option – as in theory Eventlet
is smart enough to pick the best implementation available anyway.

However, since Glance only works with poll or select as a hub, let's try
them in that order. That avoids a user selecting things like 'epolls'
and expecting Glance to work, whereas it would fail.

Also remove a useless cleanup() call in the failing test as the
start_servers() method already does a cleanup itself.

Change-Id: Ia7765151ebb00cdf01e96cf39f3242899d358772