Beispiel #1
0
    def update(self, name, **kwargs):
        """Updates the weight, uris, and/or options of this pool

        :param name: Name of the pool
        :type name: text
        :param kwargs: one of: `uri`, `weight`, `options`
        :type kwargs: dict
        :raises: PoolDoesNotExist
        """
        uri = kwargs.get('uri')
        if uri and not self._check_capabilities(uri, name=name):
            raise errors.PoolCapabilitiesMismatch()

        return self._update(name, **kwargs)
Beispiel #2
0
    def create(self, name, weight, uri, group=None, options=None):
        """Registers a pool entry.

        :param name: The name of this pool
        :type name: six.text_type
        :param weight: the likelihood that this pool will be used
        :type weight: int
        :param uri: A URI that can be used by a storage client
            (e.g., pymongo) to access this pool.
        :type uri: six.text_type
        :param group: The group of this pool
        :type group: six.text_type
        :param options: Options used to configure this pool
        :type options: dict
        """
        if not self._check_capabilities(uri, group=group):
            raise errors.PoolCapabilitiesMismatch()

        return self._create(name, weight, uri, group, options)
Beispiel #3
0
    def create(self, name, weight, uri, flavor=None, options=None):
        """Registers a pool entry.

        :param name: The name of this pool
        :type name: six.text_type
        :param weight: the likelihood that this pool will be used
        :type weight: int
        :param uri: A URI that can be used by a storage client
            (e.g., pymongo) to access this pool.
        :type uri: six.text_type
        :param flavor: The flavor of this pool
        :type flavor: six.text_type
        :param options: Options used to configure this pool
        :type options: dict
        """
        flavor_obj = {}
        if flavor is not None:
            flavor_obj["name"] = flavor
        if not self._check_capabilities(uri, flavor=flavor_obj):
            raise errors.PoolCapabilitiesMismatch()

        return self._create(name, weight, uri, flavor, options)