Exemple #1
0
    def list(self, limit=None, marker=None):
        cb_itypes = [
            OpenStackInstanceType(self.provider, obj)
            for obj in self.provider.nova.flavors.list(
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_itypes, limit)
Exemple #2
0
    def list(self, limit=None, marker=None):
        cb_itypes = [
            OpenStackInstanceType(self.provider, obj)
            for obj in self.provider.nova.flavors.list(
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_itypes, limit)
Exemple #3
0
 def list(self, limit=None, marker=None):
     """
     List all containers.
     """
     _, container_list = self.provider.swift.get_account(
         limit=oshelpers.os_result_limit(self.provider, limit),
         marker=marker)
     cb_buckets = [OpenStackBucket(self.provider, c)
                   for c in container_list]
     return oshelpers.to_server_paged_list(self.provider, cb_buckets, limit)
Exemple #4
0
 def list(self, limit=None, marker=None):
     """
     List all instances.
     """
     cb_insts = [
         OpenStackInstance(self.provider, inst)
         for inst in self.provider.nova.servers.list(
             limit=oshelpers.os_result_limit(self.provider, limit),
             marker=marker)]
     return oshelpers.to_server_paged_list(self.provider, cb_insts, limit)
Exemple #5
0
 def list(self, limit=None, marker=None):
     """
     List all containers.
     """
     _, container_list = self.provider.swift.get_account(
         limit=oshelpers.os_result_limit(self.provider, limit),
         marker=marker)
     cb_buckets = [OpenStackBucket(self.provider, c)
                   for c in container_list]
     return oshelpers.to_server_paged_list(self.provider, cb_buckets, limit)
    def find(self, name, limit=None, marker=None):
        """
        Searches for an image by a given list of attributes
        """
        regex = fnmatch.translate(name)
        cb_images = [
            img for img in self if img.name and re.search(regex, img.name)
        ]

        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)
Exemple #7
0
 def list(self, limit=None, marker=None):
     """
     List all instances.
     """
     cb_insts = [
         OpenStackInstance(self.provider, inst)
         for inst in self.provider.nova.servers.list(
             limit=oshelpers.os_result_limit(self.provider, limit),
             marker=marker)]
     return oshelpers.to_server_paged_list(self.provider, cb_insts, limit)
Exemple #8
0
 def list(self, limit=None, marker=None):
     """
     List all snapshot.
     """
     cb_snaps = [
         OpenStackSnapshot(self.provider, snap) for
         snap in self.provider.cinder.volume_snapshots.list(
             search_opts={'limit': oshelpers.os_result_limit(self.provider,
                                                             limit),
                          'marker': marker})]
     return oshelpers.to_server_paged_list(self.provider, cb_snaps, limit)
Exemple #9
0
 def find(self, name, limit=None, marker=None):
     """
     Searches for a bucket by a given list of attributes.
     """
     _, container_list = self.provider.swift.get_account(
         limit=oshelpers.os_result_limit(self.provider, limit),
         marker=marker)
     cb_buckets = [OpenStackBucket(self.provider, c)
                   for c in container_list
                   if name in c.get("name")]
     return oshelpers.to_server_paged_list(self.provider, cb_buckets, limit)
Exemple #10
0
    def find(self, name, limit=None, marker=None):
        """
        Searches for an image by a given list of attributes
        """
        regex = fnmatch.translate(name)
        cb_images = [
            OpenStackMachineImage(self.provider, img)
            for img in self
            if img.name and re.search(regex, img.name)]

        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)
Exemple #11
0
    def list(self, limit=None, marker=None):
        """
        List all volumes.
        """
        cb_vols = [
            OpenStackVolume(self.provider, vol)
            for vol in self.provider.cinder.volumes.list(
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_vols, limit)
Exemple #12
0
 def find(self, name, limit=None, marker=None):
     """
     Searches for a bucket by a given list of attributes.
     """
     _, container_list = self.provider.swift.get_account(
         limit=oshelpers.os_result_limit(self.provider, limit),
         marker=marker)
     cb_buckets = [OpenStackBucket(self.provider, c)
                   for c in container_list
                   if name in c.get("name")]
     return oshelpers.to_server_paged_list(self.provider, cb_buckets, limit)
Exemple #13
0
    def list(self, limit=None, marker=None):
        """
        List all volumes.
        """
        cb_vols = [
            OpenStackVolume(self.provider, vol)
            for vol in self.provider.cinder.volumes.list(
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_vols, limit)
Exemple #14
0
 def list(self, limit=None, marker=None):
     """
     List all snapshot.
     """
     cb_snaps = [
         OpenStackSnapshot(self.provider, snap) for
         snap in self.provider.cinder.volume_snapshots.list(
             search_opts={'limit': oshelpers.os_result_limit(self.provider,
                                                             limit),
                          'marker': marker})]
     return oshelpers.to_server_paged_list(self.provider, cb_snaps, limit)
Exemple #15
0
 def find(self, name, limit=None, marker=None):
     """
     Searches for an instance by a given list of attributes.
     """
     search_opts = {'name': name}
     cb_insts = [
         OpenStackInstance(self.provider, inst)
         for inst in self.provider.nova.servers.list(
             search_opts=search_opts,
             limit=oshelpers.os_result_limit(self.provider, limit),
             marker=marker)]
     return oshelpers.to_server_paged_list(self.provider, cb_insts, limit)
Exemple #16
0
 def find(self, name, limit=None, marker=None):
     """
     Searches for an instance by a given list of attributes.
     """
     search_opts = {'name': name}
     cb_insts = [
         OpenStackInstance(self.provider, inst)
         for inst in self.provider.nova.servers.list(
             search_opts=search_opts,
             limit=oshelpers.os_result_limit(self.provider, limit),
             marker=marker)]
     return oshelpers.to_server_paged_list(self.provider, cb_insts, limit)
Exemple #17
0
    def list(self, limit=None, marker=None):
        """
        List all images.
        """
        os_images = self.provider.nova.images.list(
            limit=oshelpers.os_result_limit(self.provider, limit),
            marker=marker)

        cb_images = [
            OpenStackMachineImage(self.provider, img) for img in os_images
        ]
        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)
Exemple #18
0
    def find(self, name, limit=None, marker=None):
        """
        Searches for a volume by a given list of attributes.
        """
        search_opts = {'name': name}
        cb_vols = [
            OpenStackVolume(self.provider, vol)
            for vol in self.provider.cinder.volumes.list(
                search_opts=search_opts,
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_vols, limit)
Exemple #19
0
    def find(self, name, limit=None, marker=None):
        """
        Searches for a volume by a given list of attributes.
        """
        search_opts = {'name': name}
        cb_vols = [
            OpenStackVolume(self.provider, vol)
            for vol in self.provider.cinder.volumes.list(
                search_opts=search_opts,
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)]

        return oshelpers.to_server_paged_list(self.provider, cb_vols, limit)
Exemple #20
0
    def find(self, name, limit=None, marker=None):
        """
        Searches for a volume by a given list of attributes.
        """
        search_opts = {'name': name,  # TODO: Cinder is ignoring name
                       'limit': oshelpers.os_result_limit(self.provider,
                                                          limit),
                       'marker': marker}
        cb_snaps = [
            OpenStackSnapshot(self.provider, snap) for
            snap in self.provider.cinder.volume_snapshots.list(search_opts)
            if snap.name == name]

        return oshelpers.to_server_paged_list(self.provider, cb_snaps, limit)
Exemple #21
0
    def find(self, name, limit=None, marker=None):
        """
        Searches for a volume by a given list of attributes.
        """
        search_opts = {'name': name,  # TODO: Cinder is ignoring name
                       'limit': oshelpers.os_result_limit(self.provider,
                                                          limit),
                       'marker': marker}
        cb_snaps = [
            OpenStackSnapshot(self.provider, snap) for
            snap in self.provider.cinder.volume_snapshots.list(search_opts)
            if snap.name == name]

        return oshelpers.to_server_paged_list(self.provider, cb_snaps, limit)
Exemple #22
0
    def find(self, **kwargs):
        name = kwargs.pop('name', None)

        # All kwargs should have been popped at this time.
        if len(kwargs) > 0:
            raise TypeError("Unrecognised parameters for search: %s."
                            " Supported attributes: %s" % (kwargs, 'name'))

        log.debug("Searching for the OpenStack image with the name: %s", name)
        regex = fnmatch.translate(name)
        cb_images = [
            img for img in self if img.name and re.search(regex, img.name)
        ]

        return oshelpers.to_server_paged_list(self.provider, cb_images)
Exemple #23
0
    def list(self, limit=None, marker=None):
        """
        List all images.
        """
        if marker is None:
            os_images = self.provider.nova.images.list(
                limit=oshelpers.os_result_limit(self.provider, limit))
        else:
            os_images = self.provider.nova.images.list(
                limit=oshelpers.os_result_limit(self.provider, limit),
                marker=marker)

        cb_images = [
            OpenStackMachineImage(self.provider, img)
            for img in os_images]
        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)
Exemple #24
0
    def list(self, filter_by_owner=True, limit=None, marker=None):
        """
        List all images.
        """
        project_id = None
        if filter_by_owner:
            project_id = self.provider.os_conn.session.get_project_id()
        os_images = self.provider.os_conn.image.images(
            owner=project_id,
            limit=oshelpers.os_result_limit(self.provider, limit),
            marker=marker)

        cb_images = [
            OpenStackMachineImage(self.provider, img) for img in os_images
        ]
        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)
    def find(self, **kwargs):
        name = kwargs.pop('name', None)

        # All kwargs should have been popped at this time.
        if len(kwargs) > 0:
            raise TypeError("Unrecognised parameters for search: %s."
                            " Supported attributes: %s" % (kwargs, 'name'))

        search_opts = {'name': name}
        cb_insts = [
            OpenStackInstance(self.provider, inst)
            for inst in self.provider.nova.servers.list(
                search_opts=search_opts,
                limit=oshelpers.os_result_limit(self.provider),
                marker=None)]
        return oshelpers.to_server_paged_list(self.provider, cb_insts)
Exemple #26
0
    def find(self, **kwargs):
        name = kwargs.pop('name', None)

        # All kwargs should have been popped at this time.
        if len(kwargs) > 0:
            raise TypeError("Unrecognised parameters for search: %s."
                            " Supported attributes: %s" % (kwargs, 'name'))

        log.debug("Searching for the OpenStack Bucket with the name: %s", name)
        _, container_list = self.provider.swift.get_account(
            limit=oshelpers.os_result_limit(self.provider), marker=None)
        cb_buckets = [
            OpenStackBucket(self.provider, c) for c in container_list
            if name in c.get("name")
        ]
        return oshelpers.to_server_paged_list(self.provider, cb_buckets)
Exemple #27
0
    def list(self, limit=None, marker=None):
        """
        List all objects within this bucket.

        :rtype: BucketObject
        :return: List of all available BucketObjects within this bucket.
        """
        _, object_list = self._provider.swift.get_container(
            self.name, limit=oshelpers.os_result_limit(self._provider, limit),
            marker=marker)
        cb_objects = [OpenStackBucketObject(
            self._provider, self, obj) for obj in object_list]

        return oshelpers.to_server_paged_list(
            self._provider,
            cb_objects,
            limit)
Exemple #28
0
    def list(self, limit=None, marker=None, prefix=None):
        """
        List all objects within this bucket.

        :rtype: BucketObject
        :return: List of all available BucketObjects within this bucket.
        """
        _, object_list = self._provider.swift.get_container(
            self.name, limit=oshelpers.os_result_limit(self._provider, limit),
            marker=marker, prefix=prefix)
        cb_objects = [OpenStackBucketObject(
            self._provider, self, obj) for obj in object_list]

        return oshelpers.to_server_paged_list(
            self._provider,
            cb_objects,
            limit)
    def find(self, **kwargs):
        name = kwargs.pop('name', None)

        # All kwargs should have been popped at this time.
        if len(kwargs) > 0:
            raise TypeError("Unrecognised parameters for search: %s."
                            " Supported attributes: %s" % (kwargs, 'name'))

        log.debug("Searching for an OpenStack Volume with the name %s", name)
        search_opts = {'name': name}
        cb_vols = [
            OpenStackVolume(self.provider, vol)
            for vol in self.provider.cinder.volumes.list(
                search_opts=search_opts,
                limit=oshelpers.os_result_limit(self.provider),
                marker=None)]

        return oshelpers.to_server_paged_list(self.provider, cb_vols)
    def find(self, **kwargs):
        name = kwargs.pop('name', None)

        # All kwargs should have been popped at this time.
        if len(kwargs) > 0:
            raise TypeError("Unrecognised parameters for search: %s."
                            " Supported attributes: %s" % (kwargs, 'name'))

        search_opts = {'name': name,  # TODO: Cinder is ignoring name
                       'limit': oshelpers.os_result_limit(self.provider),
                       'marker': None}
        log.debug("Searching for an OpenStack volume with the following "
                  "params: %s", search_opts)
        cb_snaps = [
            OpenStackSnapshot(self.provider, snap) for
            snap in self.provider.cinder.volume_snapshots.list(search_opts)
            if snap.name == name]

        return oshelpers.to_server_paged_list(self.provider, cb_snaps)
Exemple #31
0
    def list(self, filter_by_owner=True, limit=None, marker=None):
        """
        List all images.
        """
        project_id = None
        if filter_by_owner:
            try:
                project_id = self.provider.keystone.projects.list(
                    name=self.provider.project_name)[0].id
            except IndexError:
                pass
        os_images = self.provider.os_conn.image.images(
            owner=project_id,
            limit=oshelpers.os_result_limit(self.provider, limit),
            marker=marker)

        cb_images = [
            OpenStackMachineImage(self.provider, img) for img in os_images
        ]
        return oshelpers.to_server_paged_list(self.provider, cb_images, limit)