示例#1
0
 def test_update_load_balancer_http_servers(self):
     fake_module = FakeModule()
     self.mox.StubOutWithMock(protocol, 'get_protocol_module')
     protocol.get_protocol_module(self.protocol).AndReturn(fake_module)
     self.mox.ReplayAll()
     r = api.update_load_balancer_http_servers(self.context, **self.kwargs)
     self.mox.VerifyAll()
     self.assertEqual(r, None)
示例#2
0
 def test_create_load_balancer(self):
     fake_module = FakeModule(self.lb_uuid)
     self.mox.StubOutWithMock(protocol, 'get_protocol_module')
     self.mox.StubOutWithMock(db, 'load_balancer_get_by_uuid')
     self.lb_ref.config = self.config_ref
     protocol.get_protocol_module(self.protocol).AndReturn(fake_module)
     db.load_balancer_get_by_uuid(
         self.context, self.lb_uuid).AndReturn(self.lb_ref)
     self.mox.ReplayAll()
     r = api.create_load_balancer(self.context, **self.kwargs)
     self.mox.VerifyAll()
     self.assertEqual(r['data']['uuid'], self.lb_uuid)
示例#3
0
文件: api.py 项目: ljjjustin/nozzle
def create_load_balancer(context, **kwargs):
    try:
        module = protocol.get_protocol_module(kwargs['protocol'])
        module_func = getattr(module, 'create_load_balancer')
        result = module_func(context, **kwargs)
        uuid = result['data']['uuid']
        load_balancer_ref = db.load_balancer_get_by_uuid(context, uuid)
        notify(context, load_balancer_ref, 'loadbalancer.create.start')
        result = format_msg_to_client(load_balancer_ref)
    except Exception, exp:
        raise exception.CreateLoadBalancerFailed(msg=str(exp))
示例#4
0
文件: api.py 项目: ljjjustin/nozzle
def update_load_balancer_http_servers(context, **kwargs):
    try:
        module = protocol.get_protocol_module(kwargs['protocol'])
        module_func = getattr(module, 'update_load_balancer_http_servers')
    except Exception, exp:
        raise exception.UpdateLoadBalancerFailed(msg=str(exp))