コード例 #1
0
 def _send_lb_config_uve(self, lb_id, deleted):
     lb = LoadbalancerSM.get(lb_id)
     if not lb:
         return
     sandesh = self._svc_mon.logger._sandesh
     if deleted == True:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb,
                                                sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
         return
     uve_lb = UveLoadbalancerConfig()
     uve_lb.name = lb.uuid
     uve_lb.listener = {}
     uve_lb.pool = {}
     pool_found = False
     for ll_id in lb.loadbalancer_listeners:
         ll = LoadbalancerListenerSM.get(ll_id)
         if not ll:
             continue
         if not ll.params['admin_state']:
             continue
         ll_uuid = ll.uuid
         pools = []
         pool = LoadbalancerPoolSM.get(ll.loadbalancer_pool)
         if pool and pool.params['admin_state']:
             pools.append(pool.uuid)
             uve_lb_listener = LoadbalancerConfig()
             uve_lb_listener.pool_uuid = pools
             uve_lb.listener[ll_uuid] = uve_lb_listener
             pool_uuid = pool.uuid
             pool_found = True
             members = []
             uve_lb_pool = LoadbalancerConfig()
             for member_id in pool.members:
                 member = LoadbalancerMemberSM.get(member_id)
                 members.append(member.uuid)
             uve_lb_pool.member_uuid = members
             uve_lb.pool[pool_uuid] = uve_lb_pool
     if pool_found == True:
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb,
                                                sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     else:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb,
                                                sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     return
コード例 #2
0
 def _send_lb_config_uve(self, lb_id, deleted):
     lb = LoadbalancerSM.get(lb_id)
     if not lb:
         return
     sandesh = self._svc_mon.logger._sandesh
     if deleted == True:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
         return
     uve_lb = UveLoadbalancerConfig()
     uve_lb.name = lb.uuid
     uve_lb.listener = {}
     uve_lb.pool = {}
     pool_found = False
     for ll_id in lb.loadbalancer_listeners:
         ll = LoadbalancerListenerSM.get(ll_id)
         if not ll:
             continue
         if not ll.params['admin_state']:
             continue
         ll_uuid = ll.uuid
         pools = []
         pool =  LoadbalancerPoolSM.get(ll.loadbalancer_pool)
         if pool and pool.params['admin_state']:
             pools.append(pool.uuid)
             uve_lb_listener = LoadbalancerConfig()
             uve_lb_listener.pool_uuid = pools
             uve_lb.listener[ll_uuid] = uve_lb_listener
             pool_uuid = pool.uuid
             pool_found = True
             members = []
             uve_lb_pool = LoadbalancerConfig()
             for member_id in pool.members:
                 member = LoadbalancerMemberSM.get(member_id)
                 members.append(member.uuid)
             uve_lb_pool.member_uuid = members
             uve_lb.pool[pool_uuid] = uve_lb_pool
     if pool_found == True:
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     else:
         uve_lb = UveLoadbalancerConfig(name=lb.uuid, deleted=True)
         uve_lb.listener = {}
         uve_lb.pool = {}
         uve_trace = UveLoadbalancerConfigTrace(data=uve_lb, sandesh=sandesh)
         uve_trace.send(sandesh=sandesh)
     return