X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmethods%2FProvision.py;h=f9f71e41850716ed4ad22326f61cb17b0fd33ae9;hb=fd395e1944dcd49f10a4d5b27ce4983ad389fb96;hp=a94c1bc3a9df39daaeb4f9f95b7002da7fbbdc78;hpb=7e1d7d63b6e65af7451c533fda704b14e327e48f;p=sfa.git diff --git a/sfa/methods/Provision.py b/sfa/methods/Provision.py index a94c1bc3..f9f71e41 100644 --- a/sfa/methods/Provision.py +++ b/sfa/methods/Provision.py @@ -2,39 +2,48 @@ from sfa.util.faults import SfaInvalidArgument, InvalidRSpec from sfa.util.xrn import urn_to_hrn from sfa.util.method import Method from sfa.util.sfatablesRuntime import run_sfatables +from sfa.util.sfalogging import logger + from sfa.trust.credential import Credential + from sfa.storage.parameter import Parameter, Mixed + from sfa.rspecs.rspec import RSpec + class Provision(Method): """ - Request that the named geni_allocated slivers be made - geni_provisioned, instantiating or otherwise realizing the - resources, such that they have a valid geni_operational_status - and may possibly be made geni_ready for experimenter use. This - operation is synchronous, but may start a longer process, such + Request that the named geni_allocated slivers be made + geni_provisioned, instantiating or otherwise realizing the + resources, such that they have a valid geni_operational_status + and may possibly be made geni_ready for experimenter use. This + operation is synchronous, but may start a longer process, such as creating and imaging a virtual machine @param slice urns ([string]) URNs of slivers to provision to @param credentials (dict) of credentials @param options (dict) options - + """ interfaces = ['aggregate', 'slicemgr'] accepts = [ Parameter(type([str]), "URNs"), Parameter(type([dict]), "Credentials"), Parameter(dict, "options"), - ] + ] returns = Parameter(dict, "Provisioned Resources") def call(self, xrns, creds, options): - self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, xrns, self.name)) + logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s" % + (self.api.interface, xrns, self.name)) # Find the valid credentials - valid_creds = self.api.auth.checkCredentials(creds, 'createsliver', xrns, - check_sliver_callback = self.api.driver.check_sliver_credentials) + valid_creds = self.api.auth.checkCredentialsSpeaksFor( + creds, 'createsliver', xrns, + check_sliver_callback=self.api.driver.check_sliver_credentials, + options=options) origin_hrn = Credential(cred=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)) + logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s" % + (self.api.interface, origin_hrn, xrns, self.name)) result = self.api.manager.Provision(self.api, xrns, creds, options) return result