def test_probe_destroy(self):
     values = get_fake_probe('1')
     probe = db_api.probe_create(self.conf, values)
     db_api.probe_destroy(self.conf, probe['id'])
     with self.assertRaises(exception.ProbeNotFound) as cm:
         db_api.probe_get(self.conf, probe['id'])
     err = cm.exception
     self.assertEqual(err.kwargs, {'probe_id': probe['id']})
Beispiel #2
0
def lb_delete_probe(conf, lb_id, probe_id):
    lb = db_api.loadbalancer_get(conf, lb_id)
    sf = db_api.serverfarm_get_all_by_lb_id(conf, lb_id)[0]
    probe = db_api.probe_get(conf, probe_id)
    db_api.probe_destroy(conf, probe_id)
    device_driver = drivers.get_device_driver(conf, lb['device_id'])
    with device_driver.request_context() as ctx:
        commands.remove_probe_from_server_farm(ctx, sf, probe)
    return probe_id
Beispiel #3
0
def lb_delete_probe(conf, lb_id, probe_id):
    balancer_instance = vserver.Balancer(conf)

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

    #Step 2: Get reader and writer
    #Step 3: Get RS object from DB
    prb = db_api.probe_get(conf, probe_id)

    #Step 4: Delete RS from DB
    db_api.probe_destroy(conf, probe_id)

    #Step 5: 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_probe_from_server_farm(ctx, balancer_instance, prb)
    return probe_id
Beispiel #4
0
 def show(self, req, tenant_id, lb_id, probe_id):
     LOG.debug("Got showProbe request. Request: %s", req)
     probe = db_api.probe_get(self.conf, probe_id, tenant_id=tenant_id)
     return {"healthMonitoring": db_api.unpack_extra(probe)}
 def test_probe_get(self):
     values = get_fake_probe('1')
     probe_ref1 = db_api.probe_create(self.conf, values)
     probe_ref2 = db_api.probe_get(self.conf, probe_ref1['id'])
     self.assertEqual(dict(probe_ref1.iteritems()),
                      dict(probe_ref2.iteritems()))
 def test_probe_get_with_tenant_fails(self):
     lb_id, sf_id = self._create_lb_and_sf('1', 'tenant1')
     probe_ref = db_api.probe_create(self.conf, get_fake_probe(sf_id))
     with self.assertRaises(exception.ProbeNotFound):
         db_api.probe_get(self.conf, probe_ref['id'], tenant_id='tenant2')
 def showProbe(self, req, lb_id, id):
     logger.debug("Got showProbe request. Request: %s", req)
     probe = db_api.probe_get(self.conf, id)
     return {"healthMonitoring": db_api.unpack_extra(probe)}