Ejemplo n.º 1
0
    def get_update_pool_flow(self):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(
            lifecycle_tasks.PoolToErrorOnRevertTask(requires=[
                constants.POOL, constants.LISTENERS, constants.LOADBALANCER
            ]))
        update_pool_flow.add(
            database_tasks.MarkPoolPendingUpdateInDB(requires=constants.POOL))
        update_pool_flow.add(
            model_tasks.UpdateAttributes(
                rebind={constants.OBJECT: constants.POOL},
                requires=[constants.UPDATE_DICT]))
        update_pool_flow.add(
            amphora_driver_tasks.ListenersUpdate(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_pool_flow.add(
            database_tasks.UpdatePoolInDB(
                requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(
            database_tasks.MarkPoolActiveInDB(requires=constants.POOL))
        update_pool_flow.add(
            database_tasks.MarkLBAndListenersActiveInDB(
                requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_pool_flow
Ejemplo n.º 2
0
    def test_update_pool_in_db(self, mock_pool_repo_update, mock_generate_uuid,
                               mock_LOG, mock_get_session,
                               mock_loadbalancer_repo_update,
                               mock_listener_repo_update,
                               mock_amphora_repo_update,
                               mock_amphora_repo_delete):

        update_pool = database_tasks.UpdatePoolInDB()
        update_pool.execute(self.pool_mock, {
            'name': 'test',
            'description': 'test2'
        })

        repo.PoolRepository.update.assert_called_once_with('TEST',
                                                           POOL_ID,
                                                           name='test',
                                                           description='test2')

        # Test the revert

        mock_pool_repo_update.reset_mock()
        update_pool.revert(self.pool_mock)

        # TODO(johnsom) fix this to set the upper ojects to ERROR
        repo.PoolRepository.update.assert_called_once_with('TEST',
                                                           POOL_ID,
                                                           enabled=0)
Ejemplo n.º 3
0
    def get_update_pool_flow(self):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(
            requires=[constants.POOL,
                      constants.LISTENERS,
                      constants.LOADBALANCER]))
        update_pool_flow.add(database_tasks.MarkPoolPendingUpdateInDB(
            requires=constants.POOL))
        update_pool_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        update_pool = service_group_tasks.PoolUpdate(
            requires=[constants.POOL, a10constants.VTHUNDER, constants.UPDATE_DICT],
            provides=constants.POOL)
        update_pool_flow.add(*self._get_sess_pers_subflow(update_pool))
        update_pool_flow.add(virtual_port_tasks.ListenersUpdate(
            requires=[constants.LOADBALANCER, constants.LISTENERS, a10constants.VTHUNDER]))
        update_pool_flow.add(database_tasks.UpdatePoolInDB(
            requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        update_pool_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))

        return update_pool_flow
Ejemplo n.º 4
0
    def get_update_pool_flow(self, topology):
        """Create a flow to update a pool

        :returns: The flow for updating a pool
        """
        update_pool_flow = linear_flow.Flow(constants.UPDATE_POOL_FLOW)
        update_pool_flow.add(lifecycle_tasks.PoolToErrorOnRevertTask(
            requires=[constants.POOL,
                      constants.LISTENERS,
                      constants.LOADBALANCER]))
        update_pool_flow.add(vthunder_tasks.VthunderInstanceBusy(
            requires=a10constants.COMPUTE_BUSY))

        update_pool_flow.add(database_tasks.MarkPoolPendingUpdateInDB(
            requires=constants.POOL))
        update_pool_flow.add(a10_database_tasks.GetVThunderByLoadBalancer(
            requires=constants.LOADBALANCER,
            provides=a10constants.VTHUNDER))
        if topology == constants.TOPOLOGY_ACTIVE_STANDBY:
            update_pool_flow.add(vthunder_tasks.GetMasterVThunder(
                name=a10constants.GET_MASTER_VTHUNDER,
                requires=a10constants.VTHUNDER,
                provides=a10constants.VTHUNDER))
        update_pool_flow.add(a10_database_tasks.GetFlavorData(
            rebind={a10constants.LB_RESOURCE: constants.POOL},
            provides=constants.FLAVOR))
        update_pool = service_group_tasks.PoolUpdate(
            requires=[constants.POOL, a10constants.VTHUNDER,
                      constants.UPDATE_DICT, constants.FLAVOR],
            provides=constants.POOL)
        update_pool_flow.add(*self._get_sess_pers_subflow(update_pool))
        update_pool_flow.add(virtual_port_tasks.ListenerUpdateForPool(
            requires=[constants.LOADBALANCER, constants.LISTENER, a10constants.VTHUNDER]))
        update_pool_flow.add(database_tasks.UpdatePoolInDB(
            requires=[constants.POOL, constants.UPDATE_DICT]))
        update_pool_flow.add(database_tasks.MarkPoolActiveInDB(
            requires=constants.POOL))
        update_pool_flow.add(database_tasks.MarkLBAndListenersActiveInDB(
            requires=[constants.LOADBALANCER, constants.LISTENERS]))
        update_pool_flow.add(vthunder_tasks.WriteMemory(
            requires=a10constants.VTHUNDER))
        update_pool_flow.add(a10_database_tasks.SetThunderUpdatedAt(
            requires=a10constants.VTHUNDER))

        return update_pool_flow