Exemplo n.º 1
0
 def test_sticky_destroy(self):
     values = get_fake_sticky('1')
     sticky = db_api.sticky_create(self.conf, values)
     db_api.sticky_destroy(self.conf, sticky['id'])
     with self.assertRaises(exception.StickyNotFound) as cm:
         db_api.sticky_get(self.conf, sticky['id'])
     err = cm.exception
     self.assertEqual(err.kwargs, {'sticky_id': sticky['id']})
Exemplo n.º 2
0
def lb_delete_sticky(conf, lb_id, sticky_id):
    lb = db_api.loadbalancer_get(conf, lb_id)
    sticky = db_api.sticky_get(conf, sticky_id)
    device_driver = drivers.get_device_driver(conf, lb['device_id'])
    with device_driver.request_context() as ctx:
        commands.remove_sticky_from_loadbalancer(ctx, lb, sticky)
    db_api.sticky_destroy(conf, sticky_id)
    return sticky_id
Exemplo n.º 3
0
def lb_delete_sticky(conf, lb_id, sticky_id):
    balancer_instance = vserver.Balancer(conf)

    #Step 1: Load balancer from DB
    balancer_instance.loadFromDB(lb_id)

    #Step 3: Get sticky object from DB
    st = db_api.sticky_get(conf, sticky_id)

    #Step 4: Delete real server from device
    device_driver = drivers.get_device_driver(conf,
                        balancer_instance.lb['device_id'])
    with device_driver.request_context() as ctx:
        commands.remove_sticky_from_loadbalancer(ctx, balancer_instance, st)

    #Step 5: Delete sticky from DB
    db_api.sticky_destroy(conf, sticky_id)
    return sticky_id