Exemplo n.º 1
0
class ConnectedEntityCollectionField(rsd_lib_base.ReferenceableMemberField):
    """ConnectedEntity field

       Represents a remote resource that is connected to the network
       accessible to this endpoint.
    """

    entity_type = base.Field("EntityType")
    """The type of the connected entity."""

    entity_role = base.Field("EntityRole")
    """The role of the connected entity."""

    entity_link = base.Field("EntityLink",
                             adapter=rsd_lib_utils.get_resource_identity)
    """A link to the associated entity."""

    entity_pci_id = PciIdField("EntityPciId")
    """The PCI ID of the connected entity."""

    pci_function_number = base.Field("PciFunctionNumber",
                                     adapter=rsd_lib_utils.num_or_none)
    """The PCI ID of the connected entity."""

    pci_class_code = base.Field("PciClassCode")
    """The Class Code and Subclass code of this PCIe function."""

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """Identifiers for the remote entity."""
Exemplo n.º 2
0
class StorageControllerCollectionField(rsd_lib_base.ReferenceableMemberField):
    """StorageController field

       This schema defines a storage controller and its respective properties.
       A storage controller represents a storage device (physical or virtual)
       that produces Volumes.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    speed_gbps = base.Field("SpeedGbps", adapter=rsd_lib_utils.num_or_none)
    """The speed of the storage controller interface."""

    firmware_version = base.Field("FirmwareVersion")
    """The firmware version of this storage Controller"""

    manufacturer = base.Field("Manufacturer")
    """This is the manufacturer of this storage controller."""

    model = base.Field("Model")
    """This is the model number for the storage controller."""

    sku = base.Field("SKU")
    """This is the SKU for this storage controller."""

    serial_number = base.Field("SerialNumber")
    """The serial number for this storage controller."""

    part_number = base.Field("PartNumber")
    """The part number for this storage controller."""

    asset_tag = base.Field("AssetTag")
    """The user assigned asset tag for this storage controller."""

    supported_controller_protocols = base.Field("SupportedControllerProtocols")
    """This represents the protocols by which this storage controller can be
       communicated to.
    """

    supported_device_protocols = base.Field("SupportedDeviceProtocols")
    """This represents the protocols which the storage controller can use to
       communicate with attached devices.
    """

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """The Durable names for the storage controller"""

    links = StorageControllerLinksField("Links")
    """Contains references to other resources that are related to this
Exemplo n.º 3
0
class Volume(rsd_lib_base.ResourceBase):
    """Volume resource class

       Volume contains properties used to describe a volume, virtual disk,
       LUN, or other logical storage entity for any system.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    capacity_bytes = base.Field("CapacityBytes",
                                adapter=rsd_lib_utils.num_or_none)
    """The size in bytes of this Volume"""

    volume_type = base.Field("VolumeType")
    """The type of this volume"""

    encrypted = base.Field("Encrypted", adapter=bool)
    """Is this Volume encrypted"""

    encryption_types = base.Field("EncryptionTypes")
    """The types of encryption used by this Volume"""

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """The Durable names for the volume"""

    block_size_bytes = base.Field("BlockSizeBytes",
                                  adapter=rsd_lib_utils.num_or_none)
    """The size of the smallest addressible unit (Block) of this volume in
       bytes
    """

    operations = OperationsCollectionField("Operations")
    """The operations currently running on the Volume"""

    optimum_io_size_bytes = base.Field("OptimumIOSizeBytes",
                                       adapter=rsd_lib_utils.num_or_none)
    """The size in bytes of this Volume's optimum IO size."""

    links = LinksField("Links")
    """Contains references to other resources that are related to this
Exemplo n.º 4
0
class Endpoint(rsd_lib_base.ResourceBase):
    """Endpoint resource class

       This is the schema definition for the Endpoint resource. It represents
       the properties of an entity that sends or receives protocol defined
       messages over a transport.
    """

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    endpoint_protocol = base.Field("EndpointProtocol")
    """The protocol supported by this endpoint."""

    connected_entities = ConnectedEntityCollectionField("ConnectedEntities")
    """All the entities connected to this endpoint."""

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """Identifiers for this endpoint"""

    pci_id = PciIdField("PciId")
    """The PCI ID of the endpoint."""

    host_reservation_memory_bytes = base.Field(
        "HostReservationMemoryBytes", adapter=rsd_lib_utils.num_or_none)
    """The amount of memory in Bytes that the Host should allocate to connect
       to this endpoint.
    """

    links = LinksField("Links")
    """The links object contains the links to other resources that are related
       to this resource.
    """

    redundancy = redundancy.RedundancyCollectionField("Redundancy")
    """Redundancy information for the lower level endpoints supporting this
Exemplo n.º 5
0
class Drive(rsd_lib_base.ResourceBase):
    """Drive resource class

       Drive contains properties describing a single physical disk drive for
       any system, along with links to associated Volumes.
    """

    status_indicator = base.Field("StatusIndicator")
    """The state of the status indicator, used to communicate status
       information about this drive.
    """

    indicator_led = base.Field("IndicatorLED")
    """The state of the indicator LED, used to identify the drive."""

    model = base.Field("Model")
    """This is the model number for the drive."""

    revision = base.Field("Revision")
    """The revision of this Drive"""

    status = rsd_lib_base.StatusField("Status")
    """This indicates the known state of the resource, such as if it is
       enabled.
    """

    capacity_bytes = base.Field("CapacityBytes",
                                adapter=rsd_lib_utils.num_or_none)
    """The size in bytes of this Drive"""

    failure_predicted = base.Field("FailurePredicted", adapter=bool)
    """Is this drive currently predicting a failure in the near future"""

    protocol = base.Field("Protocol")
    """The protocol this drive is using to communicate to the storage
       controller
    """

    media_type = base.Field("MediaType")
    """The type of media contained in this drive"""

    manufacturer = base.Field("Manufacturer")
    """This is the manufacturer of this drive."""

    sku = base.Field("SKU")
    """This is the SKU for this drive."""

    serial_number = base.Field("SerialNumber")
    """The serial number for this drive."""

    part_number = base.Field("PartNumber")
    """The part number for this drive."""

    asset_tag = base.Field("AssetTag")
    """The user assigned asset tag for this drive."""

    identifiers = rsd_lib_base.IdentifierCollectionField("Identifiers")
    """The Durable names for the drive"""

    location = rsd_lib_base.LocationCollectionField("Location")
    """The Location of the drive"""

    hotspare_type = base.Field("HotspareType")
    """The type of hotspare this drive is currently serving as"""

    encryption_ability = base.Field("EncryptionAbility")
    """The encryption abilities of this drive"""

    encryption_status = base.Field("EncryptionStatus")
    """The status of the encryption of this drive"""

    rotation_speed_rpm = base.Field("RotationSpeedRPM",
                                    adapter=rsd_lib_utils.num_or_none)
    """The rotation speed of this Drive in Revolutions per Minute (RPM)"""

    block_size_bytes = base.Field("BlockSizeBytes",
                                  adapter=rsd_lib_utils.num_or_none)
    """The size of the smallest addressible unit (Block) of this drive in bytes
    """

    capable_speed_gbs = base.Field("CapableSpeedGbs",
                                   adapter=rsd_lib_utils.num_or_none)
    """The speed which this drive can communicate to a storage controller in
       ideal conditions in Gigabits per second
    """

    negotiated_speed_gbs = base.Field("NegotiatedSpeedGbs",
                                      adapter=rsd_lib_utils.num_or_none)
    """The speed which this drive is currently communicating to the storage
       controller in Gigabits per second
    """

    predicted_media_life_left_percent = base.Field(
        "PredictedMediaLifeLeftPercent", adapter=rsd_lib_utils.num_or_none)
    """The percentage of reads and writes that are predicted to still be
       available for the media
    """

    links = LinksField("Links")
    """Contains references to other resources that are related to this
       resource.
    """

    operations = volume.OperationsCollectionField("Operations")
    """The operations currently running on the Drive."""

    oem = OemField("Oem")
    """Oem specific properties."""

    _actions = ActionsField("Actions")

    def _get_secure_erase_action_element(self):
        secure_erase_action = self._actions.secure_erase

        if not secure_erase_action:
            raise exceptions.MissingActionError(action="#Drive.SecureErase",
                                                resource=self._path)
        return secure_erase_action

    def secure_erase(self):
        """Secure erase the drive.

        :raises: MissingActionError, if no secure erase action exists.
        """
        target_uri = self._get_secure_erase_action_element().target_uri

        self._conn.post(target_uri, data={})

    def update(self, asset_tag=None, erase_on_detach=None, erased=None):
        """Update drive properties

        :param asset_tag: The user assigned asset tag for this drive
        :param erase_on_detach: Indicates if drive should be erased when
                                detached from Composed Node.
        :param erased: Indicate whether drive was cleared after assignment to
                       composed node
        :raises: InvalidParameterValueError if one param is incorrect
        """

        data = {}

        if asset_tag is not None:
            data["AssetTag"] = asset_tag

        if erase_on_detach is not None or erased is not None:
            data["Oem"] = {"Intel_RackScale": {}}

            if erase_on_detach is not None:
                if not isinstance(erase_on_detach, bool):
                    raise exceptions.InvalidParameterValueError(
                        parameter="erase_on_detach",
                        value=erase_on_detach,
                        valid_values=[True, False],
                    )
                else:
                    data["Oem"]["Intel_RackScale"][
                        "EraseOnDetach"] = erase_on_detach

            if erased is not None:
                if not isinstance(erased, bool):
                    raise exceptions.InvalidParameterValueError(
                        parameter="erased",
                        value=erased,
                        valid_values=[True, False],
                    )
                else:
                    data["Oem"]["Intel_RackScale"]["DriveErased"] = erased

        self._conn.patch(self.path, data=data)