def CreateSliver(self, slice_urn, credentials, rspec, users):
        """Create a sliver with the given URN from the resources in 
        the given RSpec.
        Return an RSpec of the actually allocated resources.
        users argument provides extra information on configuring the resources
        for runtime access.
        """
        self.logger.info('CreateSliver(%r)' % (slice_urn))
        # Note this list of privileges is really the name of an operation
        # from the privilege_table in sfa/trust/rights.py
        # Credentials will specify a list of privileges, each of which
        # confers the right to perform a list of operations.
        # EG the 'info' privilege in a credential allows the operations
        # listslices, listnodes, policy
        privileges = (CREATESLIVERPRIV,)
        # Note that verify throws an exception on failure.
        # Use the client PEM format cert as retrieved
        # from the https connection by the SecureXMLRPCServer
        # to identify the caller.
        creds = self._cred_verifier.verify_from_strings(self._server.pem_cert,
                                                        credentials,
                                                        slice_urn,
                                                        privileges)
        # If we get here, the credentials give the caller
        # all needed privileges to act on the given target.
        if slice_urn in self._slivers:
            self.logger.error('Sliver %s already exists.' % slice_urn)
            raise Exception('Sliver %s already exists.' % slice_urn)

        rspec_dom = None
        try:
            rspec_dom = minidom.parseString(rspec)
        except Exception, exc:
            self.logger.error("Cant create sliver %s. Exception parsing rspec: %s" % (slice_urn, exc))
            raise Exception((slice_urn, exc) % "Cant create sliver %s. Exception parsing rspec: %s")


        # Look at the version of the input request RSpec
        # Make sure it is supported
        # Then make sure that you return an RSpec in the same format
        # EG if both V1 and V2 are supported, and the user gives V2 request,
        # then you must return a V2 request and not V1

        resources = list()
        for elem in rspec_dom.documentElement.getElementsByTagName('resource'):
            resource = None
            try:
                resource = Resource.fromdom(elem)
            except Exception, exc:
                import traceback
                self.logger.warning("Failed to parse resource from RSpec dom: %s", traceback.format_exc())
                raise Exception("Cant create sliver %s. Exception parsing rspec: %s" % (slice_urn, exc))

            if resource not in self._resources:
                self.logger.info("Requested resource %d not available" % resource._id)
                raise Exception('Resource %d not available' % resource._id)
            resources.append(resource)

        # determine max expiration time from credentials
        # do not create a sliver that will outlive the slice!
        expiration = datetime.datetime.utcnow() + self.max_lease
        for cred in creds:
            credexp = self._naiveUTC(cred.expiration)
            if credexp < expiration:
                expiration = credexp

        sliver = Sliver(slice_urn, expiration)

        # remove resources from available list
        for resource in resources:
            sliver.resources.append(resource)
            self._resources.remove(resource)
            resource.available = False
            resource.status = Resource.STATUS_READY

        self._slivers[slice_urn] = sliver

        self.logger.info("Created new sliver for slice %s" % slice_urn)
        return ('<rspec type="GCF">' + ''.join([x.toxml() for x in sliver.resources])
                + '</rspec>')

    # The list of credentials are options - some single cred
    # must give the caller required permissions.
    # The semantics of the API are unclear on this point, so 
    # this is just the current implementation
dataset/ETHPy150Open fp7-ofelia/ocf/ofam/src/src/ext/geni/am.py/ReferenceAggregateManager.CreateSliver/swapped operands of `%`