Ejemplo n.º 1
0
class HardDrive(resources.PhysicalDisk):
    class Meta:
        identifier = identifiers.ScopedId('serial_number')

    serial_number = attributes.String()
    capacity = attributes.Bytes()
    temperature = statistics.Gauge(units='C')
class Resource3(PhysicalDisk):
    serial_number = attributes.String()
    capacity = attributes.Bytes()
    temperature = statistics.Gauge(units="C")

    class Meta:
        identifier = ScopedId("serial_number")
class Resource5(LogicalDrive):
    local_id = attributes.Integer()
    capacity = attributes.Bytes()
    name = attributes.String()

    class Meta:
        identifier = ScopedId("local_id")

    def get_label(self):
        return self.name
class Resource4(StoragePool):
    local_id = attributes.Integer()
    raid_type = attributes.Enum("raid0", "raid1", "raid5", "raid6")
    capacity = attributes.Bytes()

    class Meta:
        identifier = ScopedId("local_id")

    def get_label(self):
        return self.local_id
Ejemplo n.º 5
0
class RaidPool(resources.StoragePool):
    class Meta:
        identifier = identifiers.ScopedId('local_id')

    local_id = attributes.Integer()
    raid_type = attributes.Enum('raid0', 'raid1', 'raid5', 'raid6')
    capacity = attributes.Bytes()

    def get_label(self):
        return self.local_id
Ejemplo n.º 6
0
class Disk(resources.PhysicalDisk):
    class Meta:
        identifier = GlobalId('wwid')

    lun = attributes.ResourceReference(optional=True)

    size = attributes.Bytes()
    wwid = attributes.Uuid()
    read_bytes_sec = statistics.Gauge(units="B/s", label="Read bandwidth")
    write_bytes_sec = statistics.Gauge(units="B/s", label="Write bandwidth")
class LvmGroup(resources.StoragePool):
    class Meta:
        identifier = GlobalId("uuid")
        icon = "lvm_vg"
        label = "Volume group"

    uuid = attributes.Uuid()
    name = attributes.String()
    size = attributes.Bytes()

    def get_label(self):
        return self.name
class LogicalDrive(BaseStorageResource):
    """A storage device with a fixed size that could be used for installing the Lustre software"""
    class Meta:
        icon = "virtual_disk"

    size = attributes.Bytes()
    filesystem_type = attributes.Boolean(optional=True)

    usable_for_lustre = True
    """ This has to be a class method today because at the point we call it we only has the type not the object"""

    @classmethod
    def device_type(cls):
        """ By default devices are linux block devices """
        return "linux"
class HardDrive(resources.PhysicalDisk):
    class Meta:
        identifier = identifiers.ScopedId("serial_number")

    serial_number = attributes.String()
    capacity = attributes.Bytes()
Ejemplo n.º 10
0
    def test_bytes(self):
        b = attributes.Bytes()
        self.assertEqual(b.to_markup(1024), "1.0KB")
        # NB no more thorough checks here because it's just a call through to sizeof_fmt

        self.assertEqual(b.cast('1'), 1)
Ejemplo n.º 11
0
class Resource3(PhysicalDisk):
    serial_number = attributes.String()
    capacity = attributes.Bytes()

    class Meta:
        identifier = ScopedId("serial_number")