From: root Date: Fri, 24 Aug 2012 15:28:24 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/geni-v3' into geni-v3 X-Git-Tag: sfa-3.0-0~134 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=7fa748355d1af0ed4de2f8817cd648484e9043f2;hp=2bde17df128f0111df994c6269ed2f42ff566b0b;p=sfa.git Merge remote-tracking branch 'origin/geni-v3' into geni-v3 --- diff --git a/sfa/managers/aggregate_manager.py b/sfa/managers/aggregate_manager.py index d947c3ff..9ec3775c 100644 --- a/sfa/managers/aggregate_manager.py +++ b/sfa/managers/aggregate_manager.py @@ -120,7 +120,7 @@ class AggregateManager: return self.driver.describe(urns, rspec_version, options) - def Status (self, api, urns, options): + def Status (self, api, urns, creds, options): call_id = options.get('call_id') if Callids().already_handled(call_id): return {} return self.driver.status (urns, options=options) @@ -135,7 +135,7 @@ class AggregateManager: if Callids().already_handled(call_id): return "" return self.driver.allocate(xrn, creds, rspec_string, options) - def Provision(self, api, xrns, options): + def Provision(self, api, xrns, creds, options): """ Create the sliver[s] (slice) at this aggregate. Verify HRN and initialize the slice record in PLC if necessary. @@ -144,22 +144,22 @@ class AggregateManager: if Callids().already_handled(call_id): return "" return self.driver.provision(xrns, creds, options) - def Delete(self, api, xrns, options): + def Delete(self, api, xrns, creds, options): call_id = options.get('call_id') if Callids().already_handled(call_id): return True return self.driver.delete_sliver (xrns, options) - def Renew(self, api, xrns, expiration_time, options): + def Renew(self, api, xrns, creds, expiration_time, options): call_id = options.get('call_id') if Callids().already_handled(call_id): return True return self.driver.renew(xrns, expiration_time, options) - def PerformOperationalAction(self, api, xrns, action, options={}): + def PerformOperationalAction(self, api, xrns, creds, action, options={}): call_id = options.get('call_id') if Callids().already_handled(call_id): return True return self.driver.performOperationalAction(xrns, action, options) - def Shutdown(self, api, xrn, options={}): + def Shutdown(self, api, xrn, creds, options={}): call_id = options.get('call_id') if Callids().already_handled(call_id): return True return self.driver.shutdown(xrn, options) diff --git a/sfa/managers/slice_manager.py b/sfa/managers/slice_manager.py index dcd5e5e0..0e758ab6 100644 --- a/sfa/managers/slice_manager.py +++ b/sfa/managers/slice_manager.py @@ -519,11 +519,10 @@ class SliceManager: threads.get_results() return 1 - def stop_slice(self, api, xrn, creds): - hrn, type = urn_to_hrn(xrn) - + def Shutdown(self, api, xrn, creds, options={}): + xrn = Xrn(xrn) # get the callers hrn - valid_cred = api.auth.checkCredentials(creds, 'stopslice', hrn)[0] + valid_cred = api.auth.checkCredentials(creds, 'stopslice', xrn.hrn)[0] caller_hrn = Credential(string=valid_cred).get_gid_caller().get_hrn() # attempt to use delegated credential first @@ -538,25 +537,7 @@ class SliceManager: continue interface = api.aggregates[aggregate] server = api.server_proxy(interface, cred) - threads.run(server.Stop, xrn, cred) + threads.run(server.Shutdown, xrn.urn, cred) threads.get_results() return 1 - def reset_slice(self, api, xrn): - """ - Not implemented - """ - return 1 - - def shutdown(self, api, xrn, creds): - """ - Not implemented - """ - return 1 - - def status(self, api, xrn, creds): - """ - Not implemented - """ - return 1 - diff --git a/sfa/methods/Delete.py b/sfa/methods/Delete.py index 9dfebda6..dd6cceb4 100644 --- a/sfa/methods/Delete.py +++ b/sfa/methods/Delete.py @@ -17,8 +17,7 @@ class Delete(Method): accepts = [ Parameter([str], "Human readable name of slice to delete (hrn or urn)"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), + Parameter(dict), "Credentials")), Parameter(dict, "options"), ] @@ -31,6 +30,6 @@ class Delete(Method): origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, xrns, self.name)) - self.api.manager.Delete(self.api, xrns, options) + self.api.manager.Delete(self.api, xrns, creds, options) return 1 diff --git a/sfa/methods/Renew.py b/sfa/methods/Renew.py index ee951c0c..5de53800 100644 --- a/sfa/methods/Renew.py +++ b/sfa/methods/Renew.py @@ -42,5 +42,5 @@ class Renew(Method): raise InsufficientRights('Renewsliver: Credential expires before requested expiration time') if requested_time > datetime.datetime.utcnow() + datetime.timedelta(days=max_renew_days): raise Exception('Cannot renew > %s days from now' % max_renew_days) - return self.api.manager.Renew(self.api, urns, expiration_time, options) + return self.api.manager.Renew(self.api, urns, creds, expiration_time, options) diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index 17c66368..d2880362 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -13,7 +13,7 @@ class Shutdown(Method): interfaces = ['aggregate', 'slicemgr'] accepts = [ Parameter(str, "Slice URN"), - Parameter(type([str]), "List of credentials"), + Parameter(type(dict), "Credentials"), ] returns = Parameter(bool, "Success or Failure") diff --git a/sfa/methods/Status.py b/sfa/methods/Status.py index 6935d016..951871d0 100644 --- a/sfa/methods/Status.py +++ b/sfa/methods/Status.py @@ -12,20 +12,15 @@ class Status(Method): """ interfaces = ['aggregate', 'slicemgr', 'component'] accepts = [ - Parameter(str, "Slice URN"), - Mixed(Parameter(str, "Credential string"), - Parameter(type([str]), "List of credentials")), + Parameter([str], "Slice or sliver URNs"), + Parameter(dict), "credentials")), Parameter(dict, "Options") ] returns = Parameter(dict, "Status details") - def call(self, slice_xrn, creds, options): - hrn, type = urn_to_hrn(slice_xrn) - valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', hrn) + def call(self, xrns, creds, options): + valid_creds = self.api.auth.checkCredentials(creds, 'sliverstatus', xrns) - self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name)) - - status = self.api.manager.Status(self.api, hrn, valid_creds, options) - - return status + self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name)) + return self.api.manager.Status(self.api, xrns, creds, options)