def add_image(self, image):
        """
        Add a PersistentImage-type object to this PersistenImageManager
        This should only be called with an image that has not yet been added to the store.
        To retrieve a previously persisted image use image_with_id() or image_query()

        @param image TODO 

        @return TODO
        """
        metadata = self.collection.find_one( { "_id": image.identifier } )
        if metadata:
            raise ImageFactoryException("Image %s already managed, use image_with_id() and save_image()" % (image.identifier))

        image.persistent_manager = self
        basename = self.storage_path + '/' + str(image.identifier)
        body_path = basename + BODY_EXT
        image.data = body_path
        try:
            if not os.path.isfile(body_path):
                open(body_path, 'w').close()
                self.log.debug('Created file %s' % body_path)
        except __HOLE__ as e:
            self.log.debug('Exception caught: %s' % e)

        self._save_image(image)
dataset/ETHPy150Open redhat-imaging/imagefactory/imgfac/MongoPersistentImageManager.py/MongoPersistentImageManager.add_image