Example #1
0
    def update_access_info(self, context, access_info):
        """Validate and update access information."""
        helper.encrypt_password(context, access_info)
        driver = self.driver_manager.get_driver(context,
                                                cache_on_load=False,
                                                **access_info)
        storage_new = driver.get_storage(context)

        # Need to validate storage response from driver
        storage_id = access_info['storage_id']
        helper.check_storage_consistency(context, storage_id, storage_new)
        access_info = db.access_info_update(context, storage_id, access_info)
        db.storage_update(context, storage_id, storage_new)

        LOG.info("Access information updated successfully.")
        return access_info
Example #2
0
    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