예제 #1
0
파일: api.py 프로젝트: zhilong-xu/delfin
    def discover_storage(self, context, access_info):
        """Discover a storage system with access information."""
        helper.encrypt_password(context, access_info)
        if 'storage_id' not in access_info:
            access_info['storage_id'] = six.text_type(
                uuidutils.generate_uuid())

        driver = self.driver_manager.get_driver(context,
                                                cache_on_load=False,
                                                **access_info)
        storage = driver.get_storage(context)

        # Need to validate storage response from driver
        helper.check_storage_repetition(context, storage)
        access_info = db.access_info_create(context, access_info)
        storage['id'] = access_info['storage_id']
        storage = db.storage_create(context, storage)

        LOG.info("Storage found successfully.")
        return storage
예제 #2
0
def create_storage(context, storage):
    return db.storage_create(context, storage)