X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Fslice_manager_pl.py;h=7ed75ed974ca81bdc6007f253ff5726db38b1161;hb=de690ffbd12e0fc667351057994f3ac86854b58e;hp=e8baada06f8b922a5951f441a1588231582d6738;hpb=8d68545c818393944bf6dbc7afd9ca9074a03a10;p=sfa.git diff --git a/sfa/managers/slice_manager_pl.py b/sfa/managers/slice_manager_pl.py index e8baada0..7ed75ed9 100644 --- a/sfa/managers/slice_manager_pl.py +++ b/sfa/managers/slice_manager_pl.py @@ -16,6 +16,7 @@ from sfa.util.specdict import * from sfa.util.faults import * from sfa.util.record import SfaRecord from sfa.rspecs.rspec_converter import RSpecConverter +from sfa.client.client_helper import sfa_to_pg_users_arg from sfa.rspecs.version_manager import VersionManager from sfa.rspecs.rspec import RSpec from sfa.util.policy import Policy @@ -122,7 +123,7 @@ def ListResources(api, creds, options, call_id): rspec = server.ListResources(*args) return {"aggregate": aggregate, "rspec": rspec, "elapsed": time.time()-tStart, "status": "success"} except Exception, e: - api.logger.warn("ListResources failed at %s: %s" %(server.url, str(e))) + api.logger.log_exc("ListResources failed at %s" %(server.url)) return {"aggregate": aggregate, "elapsed": time.time()-tStart, "status": "exception"} if Callids().already_handled(call_id): return "" @@ -194,11 +195,16 @@ def CreateSliver(api, xrn, creds, rspec_str, users, call_id): # Need to call GetVersion at an aggregate to determine the supported # rspec type/format beofre calling CreateSliver at an Aggregate. server_version = api.get_cached_server_version(server) + requested_users = users if 'sfa' not in server_version and 'geni_api' in server_version: # sfa aggregtes support both sfa and pg rspecs, no need to convert # if aggregate supports sfa rspecs. otherwise convert to pg rspec - rspec = RSpecConverter.to_pg_rspec(rspec) - args = [xrn, credential, rspec, users] + rspec = RSpec(RSpecConverter.to_pg_rspec(rspec, 'request')) + filter = {'component_manager_id': server_version['urn']} + rspec.filter(filter) + rspec = rspec.toxml() + requested_users = sfa_to_pg_users_arg(users) + args = [xrn, credential, rspec, requested_users] if _call_id_supported(api, server): args.append(call_id) rspec = server.CreateSliver(*args) @@ -243,13 +249,13 @@ def CreateSliver(api, xrn, creds, rspec_str, users, call_id): manifest_version = version_manager._get_version(rspec.version.type, rspec.version.version, 'manifest') result_rspec = RSpec(version=manifest_version) for result in results: - add_slicemgr_stat(rspec, "CreateSliver", result["aggregate"], result["elapsed"], result["status"]) + add_slicemgr_stat(result_rspec, "CreateSliver", result["aggregate"], result["elapsed"], result["status"]) if result["status"]=="success": try: result_rspec.version.merge(result["rspec"]) except: api.logger.log_exc("SM.CreateSliver: Failed to merge aggregate rspec") - return rspec.toxml() + return result_rspec.toxml() def RenewSliver(api, xrn, creds, expiration_time, call_id): def _RenewSliver(server, xrn, creds, expiration_time, call_id):