def _send_loadbalancer_uve(self):
        try:
            pool_uuids = os.listdir(LB_BASE_DIR)
        except OSError:
            return

        # delete stale uves
        for pool_uuid in self.old_pool_uuids:
            if pool_uuid not in pool_uuids:
                uve_lb = UveLoadbalancer(name=pool_uuid, deleted=True)
                uve_trace = UveLoadbalancerTrace(data=uve_lb)
                uve_trace.send()
        self.old_pool_uuids = pool_uuids

        # send stats
        for pool_uuid in pool_uuids:
            stats = self.driver.get_stats(pool_uuid)
            if not len(stats) or not stats.get('vip') or not stats.get('pool'):
                continue

            uve_lb = UveLoadbalancer()
            uve_lb.name = pool_uuid
            uve_lb.virtual_ip_stats = self._uve_get_stats(stats['vip'])
            uve_lb.pool_stats = self._uve_get_stats(stats['pool'])
            uve_lb.member_stats = self._uve_get_member_stats(stats['members'])
            uve_trace = UveLoadbalancerTrace(data=uve_lb)
            uve_trace.send()
def _send_loadbalancer_uve(driver):
    for pool_uuid in os.listdir(LB_BASE_DIR):
        stats = driver.get_stats(pool_uuid)
        if not len(stats) or not stats.get('vip') or not stats.get('pool'):
            continue

        uve_lb = UveLoadbalancer()
        uve_lb.name = pool_uuid
        uve_lb.virtual_ip_stats = _uve_get_stats(stats['vip'])
        uve_lb.pool_stats = _uve_get_stats(stats['pool'])
        uve_lb.member_stats = _uve_get_member_stats(stats['members'])
        uve_trace = UveLoadbalancerTrace(data=uve_lb)
        uve_trace.send()
Ejemplo n.º 3
0
    def _send_loadbalancer_uve(self):
        try:
            pool_uuids = os.listdir(self.driver.lbaas_dir)
        except OSError:
            return

        # delete stale uves
        for pool_uuid in self.old_pool_uuids:
            if pool_uuid not in pool_uuids:
                uve_lb = UveLoadbalancerStats(name=pool_uuid, deleted=True)
                uve_lb.listener = {}
                uve_lb.pool = {}
                uve_lb.member = {}
                uve_trace = UveLoadbalancerTrace(data=uve_lb)
                uve_trace.send()
        self.old_pool_uuids = pool_uuids

        # send stats
        for pool_uuid in pool_uuids:
            lb_stats = self.driver.get_stats(pool_uuid)
            if not 'listener' in lb_stats or not len(lb_stats['listener']):
                uve_lb = UveLoadbalancerStats(name=pool_uuid, deleted=True)
                uve_lb.listener = {}
                uve_lb.pool = {}
                uve_lb.member = {}
                uve_trace = UveLoadbalancerTrace(data=uve_lb)
                uve_trace.send()
                continue

            uve_lb = UveLoadbalancerStats()
            uve_lb.name = pool_uuid
            uve_lb.listener = {}
            uve_lb.pool = {}
            uve_lb.member = {}
            count = 0
            total_items = len(lb_stats['listener'])
            while (total_items > count):
                lb_stat = lb_stats['listener'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.listener[name] = value
                count = count + 1
            count = 0
            total_items = len(lb_stats['pool'])
            while (total_items > count):
                lb_stat = lb_stats['pool'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.pool[name] = value
                count = count + 1
            count = 0
            total_items = len(lb_stats['member'])
            while (total_items > count):
                lb_stat = lb_stats['member'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.member[name] = value
                count = count + 1
            uve_trace = UveLoadbalancerTrace(data=uve_lb)
            uve_trace.send()
    def _send_loadbalancer_uve(self):
        try:
            pool_uuids = os.listdir(self.driver.lbaas_dir)
        except OSError:
            return

        # delete stale uves
        for pool_uuid in self.old_pool_uuids:
            if pool_uuid not in pool_uuids:
                uve_lb = UveLoadbalancerStats(name=pool_uuid, deleted=True)
                uve_lb.listener = {}
                uve_lb.pool = {}
                uve_lb.member = {}
                uve_trace = UveLoadbalancerTrace(data=uve_lb)
                uve_trace.send()
        self.old_pool_uuids = pool_uuids

        # send stats
        for pool_uuid in pool_uuids:
            lb_stats = self.driver.get_stats(pool_uuid)
            if not 'listener' in lb_stats or not len(lb_stats['listener']):
                uve_lb = UveLoadbalancerStats(name=pool_uuid, deleted=True)
                uve_lb.listener = {}
                uve_lb.pool = {}
                uve_lb.member = {}
                uve_trace = UveLoadbalancerTrace(data=uve_lb)
                uve_trace.send()
                continue

            uve_lb = UveLoadbalancerStats()
            uve_lb.name = pool_uuid
            uve_lb.listener = {}
            uve_lb.pool = {}
            uve_lb.member = {}
            count = 0
            total_items = len(lb_stats['listener'])
            while (total_items > count):
                lb_stat = lb_stats['listener'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.listener[name] = value
                count = count + 1
            count = 0
            total_items = len(lb_stats['pool'])
            while (total_items > count):
                lb_stat = lb_stats['pool'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.pool[name] = value
                count = count + 1
            count = 0
            total_items = len(lb_stats['member'])
            while (total_items > count):
                lb_stat = lb_stats['member'][count]
                name = lb_stat['name']
                value = self._uve_get_stats(lb_stat)
                uve_lb.member[name] = value
                count = count + 1
            uve_trace = UveLoadbalancerTrace(data=uve_lb)
            uve_trace.send()