def create_pool(self, context, pool):
        LOG.debug("MidonetPluginV2.create_pool called: %(pool)r",
                  {'pool': pool})

        router_id = pool['pool'].get(rsi.ROUTER_ID)
        if not router_id:
            msg = _("router_id is required for pool")
            raise n_exc.BadRequest(resource='router', msg=msg)

        if self._get_resource_router_id_binding(context, loadbalancer_db.Pool,
                                                router_id=router_id):
            msg = _("A pool is already associated with the router")
            raise n_exc.BadRequest(resource='router', msg=msg)

        with context.session.begin(subtransactions=True):
            p = super(MidonetPluginV2, self).create_pool(context, pool)
            res = {
                'id': p['id'],
                rsi.ROUTER_ID: router_id
            }
            self._process_create_resource_router_id(context, res,
                                                    loadbalancer_db.Pool)
            p[rsi.ROUTER_ID] = router_id

            self.api_cli.create_pool(p)

            p['status'] = constants.ACTIVE
            self.update_status(context, loadbalancer_db.Pool, p['id'],
                               p['status'])

        LOG.debug("MidonetPluginV2.create_pool exiting: %(pool)r",
                  {'pool': p})
        return p