code: def schedule_hosting_device(self, plugin, context, hosting_device):
          
          active_cfg_agents = plugin.get_cfg_agents(context, active=True)
          if not active_cfg_agents:
              LOG.warning('There are no active Cisco cfg agents')
              # No worries, once a Cisco cfg agent is started and
              # announces itself any "dangling" hosting devices
              # will be scheduled to it.
              return
          LOG.debug('Randomly selecting a Cisco cfg agent among %d candidates' %
                    len(active_cfg_agents))
          return random.choice(active_cfg_agents)
docs: Selects Cisco cfg agent that will configure <hosting_device>.