X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FShutdown.py;h=a1acf9a8c35644a88c16a2c1ae7b8e567fb46de7;hb=479fe75aba4509060c663c0025dac7398269f7ff;hp=273b99149c5c82f2123ec82f5386967b16069d35;hpb=d58bbc6238ee07a3e386b2627aa64ccb2dce352f;p=sfa.git diff --git a/sfa/methods/Shutdown.py b/sfa/methods/Shutdown.py index 273b9914..a1acf9a8 100644 --- a/sfa/methods/Shutdown.py +++ b/sfa/methods/Shutdown.py @@ -1,23 +1,32 @@ from sfa.storage.parameter import Parameter +from sfa.trust.credential import Credential +from sfa.util.method import Method +from sfa.util.sfalogging import logger -from sfa.methods.Stop import Stop -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'] 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): - return Stop.call(self, slice_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 self.api.manager.Shutdown(self.api, xrn, creds)