Example #1
0
 def __init__(self, host, etcd_client_factory, tsw, tfw):
     self._port_key_space = LEADIN + '/state/%s/ports' % (host)
     self.etcd_client = etcd_client_factory.client()
     self._host = host
     self._tsw = tsw
     self._tfw = tfw
     etcd_helper = etcdutils.EtcdHelper(self.etcd_client)
     etcd_helper.ensure_dir(self._port_key_space)
     super(TaasPortAgentWatcher, self).__init__(self.etcd_client, self.path,
                                                self._port_key_space)
Example #2
0
 def __init__(self, host, etcd_client_factory, vppf):
     self._node_key_space = LEADIN + '/nodes/%s/%s' % (host, self.path)
     self._state_key_space = LEADIN + \
         '/state_taas/%s/%s' % (host, self.path)
     self.etcd_client = etcd_client_factory.client()
     self.vppf = vppf
     self._host = host
     etcd_helper = etcdutils.EtcdHelper(self.etcd_client)
     etcd_helper.ensure_dir(self._node_key_space)
     etcd_helper.ensure_dir(self._state_key_space)
     super(TaasServiceAgentWatcher,
           self).__init__(self.etcd_client, self.path, self._node_key_space)
Example #3
0
    def __init__(self, notify_bound):
        super(EtcdAgentCommunicator, self).__init__()
        LOG.debug("Using etcd host:%s port:%s user:%s",
                  cfg.CONF.ml2_vpp.etcd_host, cfg.CONF.ml2_vpp.etcd_port,
                  cfg.CONF.ml2_vpp.etcd_user)

        # This is a function that is called when a port has been
        # notified from the agent via etcd as completely attached.

        # We call this when we're certain that the VPP on the far end
        # has definitely bound the port, and has dropped a vhost-user
        # socket where it can be found.

        # This is more important than it seems, becaus libvirt will
        # hang, because qemu ignores its monitor port, when qemu is
        # waiting for a partner to connect with on its vhost-user
        # interfaces.  It can't start the VM - that requires
        # information from its partner it can't guess at - but it
        # shouldn't hang the monitor - nevertheless...  So we notify
        # when the port is there and ready, and qemu is never put into
        # this state by Nova.
        self.notify_bound = notify_bound

        # We need certain directories to exist
        self.state_key_space = LEADIN + '/state'
        self.port_key_space = LEADIN + '/nodes'
        self.secgroup_key_space = LEADIN + '/global/secgroups'
        self.remote_group_key_space = LEADIN + '/global/remote_group'
        self.gpe_key_space = LEADIN + '/global/networks/gpe'

        etcd_client = self.client_factory.client()
        etcd_helper = etcdutils.EtcdHelper(etcd_client)
        etcd_helper.ensure_dir(self.state_key_space)
        etcd_helper.ensure_dir(self.port_key_space)
        etcd_helper.ensure_dir(self.secgroup_key_space)
        etcd_helper.ensure_dir(self.election_key_space)
        etcd_helper.ensure_dir(self.remote_group_key_space)

        self.secgroup_enabled = cfg.CONF.SECURITYGROUP.enable_security_group
        if self.secgroup_enabled:
            self.register_secgroup_event_handler()

        # TODO(ijw): .../state/<host> lists all known hosts, and they
        # heartbeat when they're functioning

        # From this point on, there are multiple threads: ensure that
        # we don't re-use the etcd_client from multiple threads
        # simultaneously
        etcd_helper = None
        etcd_client = None

        registry.subscribe(self.start_threads, resources.PROCESS,
                           events.AFTER_SPAWN)
    def __init__(self, service_plugin):
        LOG.debug("Loading TaasEtcdDriver.")
        super(TaasEtcdDriver, self).__init__(service_plugin)

        self.client_factory = etcdutils.EtcdClientFactory(cfg.CONF.ml2_vpp)
        etcd_client = self.client_factory.client()
        etcd_helper = etcdutils.EtcdHelper(etcd_client)
        etcd_helper.ensure_dir(LEADIN + '/state_taas')

        self.taas_service = FeatureTaasService(service_plugin,
                                               self.client_factory.client(),
                                               'TaasService',
                                               LEADIN + '/state_taas')
        self.taas_flow = FeatureTaasFlow(service_plugin,
                                         self.client_factory.client(),
                                         'TaasFlow', LEADIN + '/state_taas')

        eventlet.spawn(self.taas_service.watch_forever)
        eventlet.spawn(self.taas_flow.watch_forever)
Example #5
0
    def __init__(self, host, etcd_client_factory, vppf):
        self._node_key_space = LEADIN + '/nodes/%s/%s' % (host, self.path)
        self._state_key_space = LEADIN + \
            '/state_taas/%s/%s' % (host, self.path)
        self.etcd_client = etcd_client_factory.client()
        self.vppf = vppf
        self._host = host
        etcd_helper = etcdutils.EtcdHelper(self.etcd_client)
        etcd_helper.ensure_dir(self._node_key_space)
        etcd_helper.ensure_dir(self._state_key_space)
        self.iputils = ip_lib.IPWrapper()

        # ERSPan IP address/prefix len
        self.esp_src_cidr = cfg.CONF.ml2_vpp.esp_src_cidr
        if self.esp_src_cidr is not None and self.esp_src_cidr != '':
            (self.esp_src_addr, esp_plen) = self.esp_src_cidr.split('/')
        self.esp_plen = int(esp_plen)

        # Name of the ERspan physnet
        self.esp_physnet = cfg.CONF.ml2_vpp.esp_physnet

        super(TaasFlowAgentWatcher, self).__init__(self.etcd_client, self.path,
                                                   self._node_key_space)
Example #6
0
 def ensure_gpe_dir(self):
     etcd_client = self.client_factory.client()
     etcd_helper = etcdutils.EtcdHelper(etcd_client)
     etcd_helper.ensure_dir(GPE_KEY_SPACE)