X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=blobdiff_plain;f=sfa%2Fmethods%2FShutdown.py;h=c4452151df699123376c60247efa3f09370d61af;hp=00142b64d989288a00306fcffa8b8433b0849f14;hb=HEAD;hpb=99e9f96209b9ebfd1853e7b8902a1a0fe893eaa2 diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index 00142b64..c4452151 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -1,24 +1,32 @@ -from sfa.util.faults import * +from sfa.storage.parameter import Parameter +from sfa.trust.credential import Credential from sfa.util.method import Method -from sfa.util.parameter import Parameter -from sfa.methods.Stop import Stop +from sfa.util.sfalogging import logger -class Shutdown(Stop): + +class Shutdown(Method): """ - Perform an emergency shut down of a sliver. This operation is intended for administrative use. + Perform an emergency shut down of a sliver. This operation is intended for administrative use. The sliver is shut down but remains available for further forensics. @param slice_urn (string) URN of slice to renew - @param credentials ([string]) of credentials + @param credentials ([string]) of credentials """ - interfaces = ['aggregate', 'slicemgr'] + interfaces = ['aggregate'] accepts = [ Parameter(str, "Slice URN"), - Parameter(type([str]), "List of credentials"), - ] + Parameter(type([dict]), "Credentials"), + ] returns = Parameter(bool, "Success or Failure") - def call(self, slice_xrn, creds): + def call(self, xrn, creds): + + valid_creds = self.api.auth.checkCredentials( + creds, 'stopslice', xrn, + check_sliver_callback=self.api.driver.check_sliver_credentials) + # log the call + origin_hrn = Credential(cred=valid_creds[0]).get_gid_caller().get_hrn() + logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" % + (self.api.interface, origin_hrn, xrn, self.name)) - return Stop.call(self, slice_xrn, creds) - + return self.api.manager.Shutdown(self.api, xrn, creds)