'Replace the contents of the given image with the new data.
:raises: ImageNotFound if the image does not exist.'

def update(self, context, image_id, metadata, data=None, purge_props=False):

    if (not self.images.get(image_id)):
        raise exception.ImageNotFound(image_id=image_id)
    if purge_props:
        self.images[image_id] = copy.deepcopy(metadata)
    else:
        image = self.images[image_id]
        try:
            image['properties'].update(metadata.pop('properties'))
        except KeyError:
            pass
        image.update(metadata)
    return self.images[image_id]
