|
| 1 | +# |
| 2 | +# storage_base.py |
| 3 | +# |
| 4 | +# Base class for implementing common SSD health features |
| 5 | +# |
| 6 | + |
| 7 | + |
| 8 | +class StorageBase(object): |
| 9 | + """ |
| 10 | + Base class for interfacing with a SSD |
| 11 | + """ |
| 12 | + def __init__(self, diskdev): |
| 13 | + """ |
| 14 | + Constructor |
| 15 | +
|
| 16 | + Args: |
| 17 | + diskdev: Linux device name to get parameters for |
| 18 | + """ |
| 19 | + pass |
| 20 | + |
| 21 | + def get_health(self): |
| 22 | + """ |
| 23 | + Retrieves current disk health in percentages |
| 24 | +
|
| 25 | + Returns: |
| 26 | + A float number of current ssd health |
| 27 | + e.g. 83.5 |
| 28 | + """ |
| 29 | + raise NotImplementedError |
| 30 | + |
| 31 | + def get_temperature(self): |
| 32 | + """ |
| 33 | + Retrieves current disk temperature in Celsius |
| 34 | +
|
| 35 | + Returns: |
| 36 | + A float number of current temperature in Celsius |
| 37 | + e.g. 40.1 |
| 38 | + """ |
| 39 | + raise NotImplementedError |
| 40 | + |
| 41 | + def get_model(self): |
| 42 | + """ |
| 43 | + Retrieves model for the given disk device |
| 44 | +
|
| 45 | + Returns: |
| 46 | + A string holding disk model as provided by the manufacturer |
| 47 | + """ |
| 48 | + raise NotImplementedError |
| 49 | + |
| 50 | + def get_firmware(self): |
| 51 | + """ |
| 52 | + Retrieves firmware version for the given disk device |
| 53 | +
|
| 54 | + Returns: |
| 55 | + A string holding disk firmware version as provided by the manufacturer |
| 56 | + """ |
| 57 | + raise NotImplementedError |
| 58 | + |
| 59 | + def get_serial(self): |
| 60 | + """ |
| 61 | + Retrieves serial number for the given disk device |
| 62 | +
|
| 63 | + Returns: |
| 64 | + A string holding disk serial number as provided by the manufacturer |
| 65 | + """ |
| 66 | + raise NotImplementedError |
| 67 | + |
| 68 | + def get_vendor_output(self): |
| 69 | + """ |
| 70 | + Retrieves vendor specific data for the given disk device |
| 71 | +
|
| 72 | + Returns: |
| 73 | + A string holding some vendor specific disk information |
| 74 | + """ |
| 75 | + raise NotImplementedError |
| 76 | + |
| 77 | + def get_disk_io_reads(self): |
| 78 | + """ |
| 79 | + Retrieves the total number of Input/Output (I/O) reads done on a storage disk |
| 80 | +
|
| 81 | + Returns: |
| 82 | + An integer value of the total number of I/O reads |
| 83 | + """ |
| 84 | + raise NotImplementedError |
| 85 | + |
| 86 | + def get_disk_io_writes(self): |
| 87 | + """ |
| 88 | + Retrieves the total number of Input/Output (I/O) writes done on a storage disk |
| 89 | +
|
| 90 | + Returns: |
| 91 | + An integer value of the total number of I/O writes |
| 92 | + """ |
| 93 | + raise NotImplementedError |
| 94 | + |
| 95 | + def get_reserved_blocks(self): |
| 96 | + """ |
| 97 | + Retrieves the total number of reserved blocks in an storage disk |
| 98 | +
|
| 99 | + Returns: |
| 100 | + An integer value of the total number of reserved blocks |
| 101 | + """ |
| 102 | + raise NotImplementedError |
0 commit comments