Exemple #1
0
class Snapshot(resource.Resource):
    resource_key = "snapshot"
    resources_key = "snapshots"
    base_path = "/snapshots"
    service = volume_service.VolumeService()

    # capabilities
    allow_retrieve = True
    allow_create = True
    allow_delete = True
    allow_update = True
    put_update = True

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

    #: The current status of this snapshot. Potential values are creating,
    #: available, deleting, error, and error_deleting.
    status = resource.prop("status")
    #: Description of snapshot. Default is None.
    description = resource.prop("description")
    #: The timestamp of this snapshot creation.
    created = resource.prop("created_at")
    #: Metadata associated with this snapshot.
    metadata = resource.prop("metadata", type=dict)
    #: The ID of the volume this snapshot was taken of.
    volume = resource.prop("volume_id")
    #: The size of the volume, in GBs.
    size = resource.prop("size", type=int)
    #: Indicate whether to snapshot, even if the volume is attached.
    #: Default is False.
    force = resource.prop("force", type=bool)
Exemple #2
0
 def test_service(self):
     sot = volume_service.VolumeService()
     self.assertEqual("volume", sot.service_type)
     self.assertEqual("public", sot.visibility)
     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)
class Volume(resource.Resource):
    resource_key = "volume"
    resources_key = "volumes"
    base_path = "/volumes"
    service = volume_service.VolumeService()

    # capabilities
    allow_retrieve = True
    allow_create = True
    allow_delete = True
    allow_update = True
    put_update = True

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

    #: The availability zone.
    availability_zone = resource.prop("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 = resource.prop("source_volid")
    #: The volume description.
    description = resource.prop("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 = resource.prop("snapshot_id")
    #: The size of the volume, in GBs. *Type: int*
    size = resource.prop("size", type=int)
    #: The ID of the image from which you want to create the volume.
    #: Required to create a bootable volume.
    image = resource.prop("imageRef")
    #: The associated volume type.
    type = resource.prop("volume_type")
    #: Enables or disables the bootable attribute. You can boot an
    #: instance from a bootable volume. *Type: bool*
    bootable = resource.prop("bootable", type=bool)
    #: One or more metadata key and value pairs to associate with the volume.
    metadata = resource.prop("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 = resource.prop("status")
    #: TODO(briancurtin): This is currently undocumented in the API.
    attachments = resource.prop("attachments")
    #: The time this volume was created at.
    created = resource.prop("created_at")
Exemple #4
0
    def __init__(self):
        """User preference for each service.

        Create a new :class:`~openstack.user_preference.UserPreference`
        object with no preferences defined, but knowledge of the services.
        Services are identified by their service type, e.g.: 'identity',
        'compute', etc.
        """
        self._preferences = {}
        self._services = {}
        """
        NOTE(thowe): We should probably do something more clever here rather
        than brute force create all the services.  Maybe use entry points
        or something, but I'd like to leave that work for another commit.
        """
        serv = compute_service.ComputeService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = database_service.DatabaseService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = identity_service.IdentityService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = image_service.ImageService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = metric_service.MetricService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = network_service.NetworkService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = object_store_service.ObjectStoreService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = orchestration_service.OrchestrationService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = keystore_service.KeystoreService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = telemetry_service.TelemetryService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv
        serv = volume_service.VolumeService()
        serv.set_visibility(None)
        self._services[serv.service_type] = serv

        self.service_names = sorted(self._services.keys())
Exemple #5
0
class Type(resource.Resource):
    resource_key = "volume_type"
    resources_key = "volume_types"
    base_path = "/types"
    service = volume_service.VolumeService()

    # capabilities
    allow_retrieve = True
    allow_create = True
    allow_delete = True

    # Properties
    #: A UUID representing this volume.
    id = resource.prop("id")
    #: Name of the type.
    name = resource.prop("name")
    #: A dict of extra specifications. "capabilities" is a usual key.
    extra_specs = resource.prop("extra_specs", type=dict)