def _get_image(image_id): cache = _get_cache() key = _make_image_key(image_id) image = cache.get(key) if not image: image = glance.image_get(image_id, cfg.CONF.billing.region_name).as_dict() if not image: msg = 'Error to fetch image: %s' % image_id LOG.exception(msg) raise exception.GringottsException(message=msg) cache.set(key, image, 86400) return image
def get_resource_volume(self, env, body): base_image_id = env.get('HTTP_X_IMAGE_META_PROPERTY_BASE_IMAGE_REF') if not base_image_id: return 0 image = glance.image_get(base_image_id, cfg.CONF.billing.region_name) return int(image.size) / (1024 ** 3)
def get_resource_volume(self, env, body): base_image_id = env.get('HTTP_X_IMAGE_META_PROPERTY_BASE_IMAGE_REF') if not base_image_id: return 0 image = glance.image_get(base_image_id, cfg.CONF.billing.region_name) return int(image.size) / (1024**3)