'Get image metadata from glance image.
Extract metadata from image and convert it\'s properties
to type cinder expected.
:param image: glance image object
:return: image metadata dictionary'

def _translate_from_glance(self, context, image):

    if (CONF.glance_api_version == 2):
        if (self._image_schema is None):
            self._image_schema = self._client.call(context, 'get', controller='schemas', schema_name='image', version=2)
        image_meta = {key: getattr(image, key) for key in image.keys() if ((self._image_schema.is_base_property(key) is True) and (key != 'schema'))}
        image_meta['properties'] = {key: getattr(image, key) for key in image.keys() if (self._image_schema.is_base_property(key) is False)}
    else:
        image_meta = _extract_attributes(image)
    image_meta = _convert_timestamps_to_datetimes(image_meta)
    image_meta = _convert_from_string(image_meta)
    return image_meta
