- fres_resource_manager_cancel_contracts(resource->mng, &ids, ev);
-err_free_fcb_contract:
- fcb_contract_destroy(fcb_contract);
-err:
- return ret;
-}
-
-CORBA_long cancel_contract(fres_contract_broker obj,
- const fres_contract_id_t* id,
- CORBA_Environment *ev)
-{
- struct fcb *fcb = o2fcb(obj);
- struct fcb_contract *fcb_contract;
- struct resource *resource;
- struct res_alloc *ra;
- fres_contract_id_t id_buffer[1] = { *id };
- fres_contract_id_seq ids;
- forb_server_id app;
- int ret;
-
- fcb_contract = fcb_contract_find(fcb, &id_buffer[0]); /* FIXME: id */
- if (!fcb_contract) {
- ret = FRSH_ERR_NOT_CONTRACTED_VRES;
- goto err;
- }
-
- resource = get_resource(fcb, fcb_contract->user_contract);
- if (!resource) {
- ret = FRSH_ERR_RESOURCE_ID_INVALID;
- goto err;
- }
-
- forb_get_req_source(obj, &app);
- ra = fcb_alloc_find(resource, &app);
- if (!ra) {
- char str[60];
- forb_server_id_to_string(str, &app, sizeof(str));
- ul_logerr("No resource allocator found for %d.%d and %s\n",
- resource->key.type, resource->key.id, str);
- ret = -1;
- goto err;
- }
-
- ids._length = ids._maximum = 1;
- ids._buffer = id_buffer;
- ret = fres_resource_allocator_cancel_vreses(ra->ra, &ids, ev);
- if (ret) {
- ul_logerr("Cannot cancel vres\n");
- goto err;
- }
- fres_resource_manager_cancel_contracts(resource->mng, &ids, ev);
-
- return 0;