code: def remove_router_from_hosting_device(self, context, hosting_device_id,
                                            router_id):
          
          e_context = context.elevated()
          r_hd_binding_db = self._get_router_binding_info(e_context, router_id)
          if r_hd_binding_db.hosting_device_id != hosting_device_id:
              raise routertypeawarescheduler.RouterNotHostedByHostingDevice(
                  router_id=router_id, hosting_device_id=hosting_device_id)
          router = self.get_router(context, router_id)
          self.add_type_and_hosting_device_info(
              e_context, router, r_hd_binding_db, schedule=False)
          # conditionally remove router from backlog ensure it does not get
          # scheduled automatically
          self.remove_router_from_backlog(id)
          l3_cfg_notifier = self.agent_notifiers.get(AGENT_TYPE_L3_CFG)
          if l3_cfg_notifier:
              l3_cfg_notifier.router_removed_from_hosting_device(context, router)
          LOG.debug("Unscheduling router %s", r_hd_binding_db.router_id)
          self.unschedule_router_from_hosting_device(context, r_hd_binding_db)
          # now unbind the router from the hosting device
          with e_context.session.begin(subtransactions=True):
              r_hd_binding_db.hosting_device_id = None
              e_context.session.add(r_hd_binding_db)
docs: Remove the router from hosting device.
  
          After removal, the router will be non-hosted until there is update
          which leads to re-schedule or be added to another hosting device
          manually.