Beispiel #1
0
    def __init__(self, plugins=None):
        """User preference for each service.

        :param plugins: List of entry point namespaces to load.

        Create a new :class:`~openstack.profile.Profile`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._services = {}

        self._add_service(baremetal_service.BaremetalService(version="v1"))
        self._add_service(
            block_storage_service.BlockStorageService(version="v2"))
        self._add_service(clustering_service.ClusteringService(version="v1"))
        self._add_service(compute_service.ComputeService(version="v2"))
        self._add_service(database_service.DatabaseService(version="v1"))
        self._add_service(identity_service.IdentityService(version="v3"))
        self._add_service(image_service.ImageService(version="v2"))
        self._add_service(key_manager_service.KeyManagerService(version="v1"))
        self._add_service(lb_service.LoadBalancerService(version="v2"))
        self._add_service(message_service.MessageService(version="v1"))
        self._add_service(network_service.NetworkService(version="v2"))
        self._add_service(
            object_store_service.ObjectStoreService(version="v1"))
        self._add_service(
            orchestration_service.OrchestrationService(version="v1"))
        self._add_service(workflow_service.WorkflowService(version="v2"))

        self.service_keys = sorted(self._services.keys())
Beispiel #2
0
class Volume(resource2.Resource):
    resource_key = "volume"
    resources_key = "volumes"
    base_path = "/volumes"
    service = block_storage_service.BlockStorageService()

    _query_mapping = resource2.QueryParameters('all_tenants', 'name', 'status',
                                               'project_id')

    # capabilities
    allow_get = True
    allow_create = True
    allow_delete = True
    allow_update = True
    allow_list = True

    # Properties
    #: A ID representing this volume.
    id = resource2.Body("id")
    #: The name of this volume.
    name = resource2.Body("name")
    #: A list of links associated with this volume. *Type: list*
    links = resource2.Body("links", type=list)

    #: The availability zone.
    availability_zone = resource2.Body("availability_zone")
    #: To create a volume from an existing volume, specify the ID of
    #: the existing volume. If specified, the volume is created with
    #: same size of the source volume.
    source_volume_id = resource2.Body("source_volid")
    #: The volume description.
    description = resource2.Body("description")
    #: To create a volume from an existing snapshot, specify the ID of
    #: the existing volume snapshot. If specified, the volume is created
    #: in same availability zone and with same size of the snapshot.
    snapshot_id = resource2.Body("snapshot_id")
    #: The size of the volume, in GBs. *Type: int*
    size = resource2.Body("size", type=int)
    #: The ID of the image from which you want to create the volume.
    #: Required to create a bootable volume.
    image_id = resource2.Body("imageRef")
    #: The name of the associated volume type.
    volume_type = resource2.Body("volume_type")
    #: Enables or disables the bootable attribute. You can boot an
    #: instance from a bootable volume. *Type: bool*
    is_bootable = resource2.Body("bootable", type=format.BoolStr)
    #: One or more metadata key and value pairs to associate with the volume.
    metadata = resource2.Body("metadata")
    #: One or more metadata key and value pairs about image
    volume_image_metadata = resource2.Body("volume_image_metadata")

    #: One of the following values: creating, available, attaching, in-use
    #: deleting, error, error_deleting, backing-up, restoring-backup,
    #: error_restoring. For details on these statuses, see the
    #: Block Storage API documentation.
    status = resource2.Body("status")
    #: TODO(briancurtin): This is currently undocumented in the API.
    attachments = resource2.Body("attachments")
    #: The timestamp of this volume creation.
    created_at = resource2.Body("created_at")
 def test_service(self):
     sot = block_storage_service.BlockStorageService()
     self.assertEqual("volume", sot.service_type)
     self.assertEqual("public", sot.interface)
     self.assertIsNone(sot.region)
     self.assertIsNone(sot.service_name)
     self.assertEqual(1, len(sot.valid_versions))
     self.assertEqual("v2", sot.valid_versions[0].module)
     self.assertEqual("v2", sot.valid_versions[0].path)
Beispiel #4
0
class Pools(resource.Resource):
    resource_key = "pool"
    resources_key = "pools"
    base_path = "/scheduler-stats/get_pools?detail=True"
    service = block_storage_service.BlockStorageService()

    # capabilities
    allow_get = False
    allow_create = False
    allow_delete = False
    allow_list = True

    # Properties
    #: The Cinder name for the pool
    name = resource.Body("name")
    #: returns a dict with information about the pool
    capabilities = resource.Body("capabilities", type=dict)
class Type(resource2.Resource):
    resource_key = "volume_type"
    resources_key = "volume_types"
    base_path = "/types"
    service = block_storage_service.BlockStorageService()

    # capabilities
    allow_get = True
    allow_create = True
    allow_delete = True
    allow_list = True

    # Properties
    #: A ID representing this type.
    id = resource2.Body("id")
    #: Name of the type.
    name = resource2.Body("name")
    #: A dict of extra specifications. "capabilities" is a usual key.
    extra_specs = resource2.Body("extra_specs", type=dict)
Beispiel #6
0
class Snapshot(resource.Resource):
    resource_key = "snapshot"
    resources_key = "snapshots"
    base_path = "/snapshots"
    service = block_storage_service.BlockStorageService()

    _query_mapping = resource.QueryParameters(
        'all_tenants', 'name', 'status', 'volume_id')

    # capabilities
    allow_fetch = True
    allow_create = True
    allow_delete = True
    allow_commit = True
    allow_list = True

    # Properties
    #: A ID representing this snapshot.
    id = resource.Body("id")
    #: Name of the snapshot. Default is None.
    name = resource.Body("name")

    #: The current status of this snapshot. Potential values are creating,
    #: available, deleting, error, and error_deleting.
    status = resource.Body("status")
    #: Description of snapshot. Default is None.
    description = resource.Body("description")
    #: The timestamp of this snapshot creation.
    created_at = resource.Body("created_at")
    #: Metadata associated with this snapshot.
    metadata = resource.Body("metadata", type=dict)
    #: The ID of the volume this snapshot was taken of.
    volume_id = resource.Body("volume_id")
    #: The size of the volume, in GBs.
    size = resource.Body("size", type=int)
    #: Indicate whether to create snapshot, even if the volume is attached.
    #: Default is ``False``. *Type: bool*
    is_forced = resource.Body("force", type=format.BoolStr)
Beispiel #7
0
class ServicesMixin(object):

    identity = identity_service.IdentityService(service_type='identity')

    compute = compute_service.ComputeService(service_type='compute')

    image = image_service.ImageService(service_type='image')

    load_balancer = load_balancer_service.LoadBalancerService(
        service_type='load-balancer')

    object_store = object_store_service.ObjectStoreService(
        service_type='object-store')

    clustering = clustering_service.ClusteringService(
        service_type='clustering')
    resource_cluster = clustering
    cluster = clustering

    data_processing = service_description.ServiceDescription(
        service_type='data-processing')

    baremetal = baremetal_service.BaremetalService(service_type='baremetal')
    bare_metal = baremetal

    baremetal_introspection = baremetal_introspection_service.BaremetalIntrospectionService(
        service_type='baremetal-introspection')

    key_manager = key_manager_service.KeyManagerService(
        service_type='key-manager')

    resource_optimization = service_description.ServiceDescription(
        service_type='resource-optimization')
    infra_optim = resource_optimization

    message = message_service.MessageService(service_type='message')
    messaging = message

    application_catalog = service_description.ServiceDescription(
        service_type='application-catalog')

    container_infrastructure_management = service_description.ServiceDescription(
        service_type='container-infrastructure-management')
    container_infrastructure = container_infrastructure_management
    container_infra = container_infrastructure_management

    search = service_description.ServiceDescription(service_type='search')

    dns = dns_service.DnsService(service_type='dns')

    workflow = workflow_service.WorkflowService(service_type='workflow')

    rating = service_description.ServiceDescription(service_type='rating')

    operator_policy = service_description.ServiceDescription(
        service_type='operator-policy')
    policy = operator_policy

    shared_file_system = service_description.ServiceDescription(
        service_type='shared-file-system')
    share = shared_file_system

    data_protection_orchestration = service_description.ServiceDescription(
        service_type='data-protection-orchestration')

    orchestration = orchestration_service.OrchestrationService(
        service_type='orchestration')

    block_storage = block_storage_service.BlockStorageService(
        service_type='block-storage')
    block_store = block_storage
    volume = block_storage

    alarm = service_description.ServiceDescription(service_type='alarm')
    alarming = alarm

    meter = service_description.ServiceDescription(service_type='meter')
    metering = meter
    telemetry = meter

    event = service_description.ServiceDescription(service_type='event')
    events = event

    application_deployment = service_description.ServiceDescription(
        service_type='application-deployment')
    application_deployment = application_deployment

    multi_region_network_automation = service_description.ServiceDescription(
        service_type='multi-region-network-automation')
    tricircle = multi_region_network_automation

    database = database_service.DatabaseService(service_type='database')

    application_container = service_description.ServiceDescription(
        service_type='application-container')
    container = application_container

    root_cause_analysis = service_description.ServiceDescription(
        service_type='root-cause-analysis')
    rca = root_cause_analysis

    nfv_orchestration = service_description.ServiceDescription(
        service_type='nfv-orchestration')

    network = network_service.NetworkService(service_type='network')

    backup = service_description.ServiceDescription(service_type='backup')

    monitoring_logging = service_description.ServiceDescription(
        service_type='monitoring-logging')
    monitoring_log_api = monitoring_logging

    monitoring = service_description.ServiceDescription(
        service_type='monitoring')

    monitoring_events = service_description.ServiceDescription(
        service_type='monitoring-events')

    placement = service_description.ServiceDescription(
        service_type='placement')

    instance_ha = instance_ha_service.InstanceHaService(
        service_type='instance-ha')
    ha = instance_ha

    reservation = service_description.ServiceDescription(
        service_type='reservation')

    function_engine = service_description.ServiceDescription(
        service_type='function-engine')

    accelerator = accelerator_service.AcceleratorService(
        service_type='accelerator')

    admin_logic = service_description.ServiceDescription(
        service_type='admin-logic')
    registration = admin_logic