public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage 1/2] tests: add ssd sas disk
@ 2020-12-11 13:52 Dominik Csapak
  2020-12-11 13:52 ` [pve-devel] [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk Dominik Csapak
  2020-12-15 13:42 ` [pve-devel] applied: [PATCH storage 1/2] tests: add ssd sas disk Thomas Lamprecht
  0 siblings, 2 replies; 4+ messages in thread
From: Dominik Csapak @ 2020-12-11 13:52 UTC (permalink / raw)
  To: pve-devel

copied from test 'sas' with rotational set to 0
this has then the type 'ssd', rpm: 0, and health: 'OK'

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 test/disk_tests/sas_ssd/disklist              |  1 +
 .../disk_tests/sas_ssd/disklist_expected.json | 17 ++++++++++
 test/disk_tests/sas_ssd/sda/device/model      |  1 +
 test/disk_tests/sas_ssd/sda/device/vendor     |  1 +
 test/disk_tests/sas_ssd/sda/queue/rotational  |  1 +
 test/disk_tests/sas_ssd/sda/size              |  1 +
 test/disk_tests/sas_ssd/sda_smart             | 20 ++++++++++++
 .../sas_ssd/sda_smart_expected.json           |  5 +++
 test/disk_tests/sas_ssd/sda_udevadm           | 31 +++++++++++++++++++
 9 files changed, 78 insertions(+)
 create mode 100644 test/disk_tests/sas_ssd/disklist
 create mode 100644 test/disk_tests/sas_ssd/disklist_expected.json
 create mode 100644 test/disk_tests/sas_ssd/sda/device/model
 create mode 100644 test/disk_tests/sas_ssd/sda/device/vendor
 create mode 100644 test/disk_tests/sas_ssd/sda/queue/rotational
 create mode 100644 test/disk_tests/sas_ssd/sda/size
 create mode 100644 test/disk_tests/sas_ssd/sda_smart
 create mode 100644 test/disk_tests/sas_ssd/sda_smart_expected.json
 create mode 100644 test/disk_tests/sas_ssd/sda_udevadm

diff --git a/test/disk_tests/sas_ssd/disklist b/test/disk_tests/sas_ssd/disklist
new file mode 100644
index 0000000..9191c61
--- /dev/null
+++ b/test/disk_tests/sas_ssd/disklist
@@ -0,0 +1 @@
+sda
diff --git a/test/disk_tests/sas_ssd/disklist_expected.json b/test/disk_tests/sas_ssd/disklist_expected.json
new file mode 100644
index 0000000..9e7ada3
--- /dev/null
+++ b/test/disk_tests/sas_ssd/disklist_expected.json
@@ -0,0 +1,17 @@
+{
+    "sda" : {
+	"gpt" : 1,
+	"devpath" : "/dev/sda",
+	"type" : "ssd",
+	"model" : "MODEL1",
+	"health" : "OK",
+	"osdid" : -1,
+	"wwn" : "0x0000000000000000",
+	"vendor" : "VENDOR1",
+	"rpm" : 0,
+	"size" : 5120000,
+	"serial" : "SER2",
+	"wearout" : "N/A",
+	"by_id_link" : "/dev/disk/by-id/scsi-00000000000000000"
+    }
+}
diff --git a/test/disk_tests/sas_ssd/sda/device/model b/test/disk_tests/sas_ssd/sda/device/model
new file mode 100644
index 0000000..6b69674
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda/device/model
@@ -0,0 +1 @@
+MODEL1
diff --git a/test/disk_tests/sas_ssd/sda/device/vendor b/test/disk_tests/sas_ssd/sda/device/vendor
new file mode 100644
index 0000000..a7894eb
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda/device/vendor
@@ -0,0 +1 @@
+VENDOR1
diff --git a/test/disk_tests/sas_ssd/sda/queue/rotational b/test/disk_tests/sas_ssd/sda/queue/rotational
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda/queue/rotational
@@ -0,0 +1 @@
+0
diff --git a/test/disk_tests/sas_ssd/sda/size b/test/disk_tests/sas_ssd/sda/size
new file mode 100644
index 0000000..5caff40
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda/size
@@ -0,0 +1 @@
+10000
diff --git a/test/disk_tests/sas_ssd/sda_smart b/test/disk_tests/sas_ssd/sda_smart
new file mode 100644
index 0000000..856af39
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda_smart
@@ -0,0 +1,20 @@
+=== START OF READ SMART DATA SECTION ===
+SMART Health Status: OK
+
+Percentage used endurance indicator: 0%
+Current Drive Temperature:     20 C
+Drive Trip Temperature:        70 C
+
+Manufactured in week 47 of year 2012
+Specified cycle count over device lifetime:  0
+Accumulated start-stop cycles:  0
+Specified load-unload count over device lifetime:  0
+Accumulated load-unload cycles:  0
+Elements in grown defect list: 0
+
+Vendor (Seagate) cache information
+  Blocks sent to initiator = 1286675833552896
+
+Vendor (Seagate/Hitachi) factory information
+  number of hours powered up = 7127.12
+  number of minutes until next internal SMART test = 0
diff --git a/test/disk_tests/sas_ssd/sda_smart_expected.json b/test/disk_tests/sas_ssd/sda_smart_expected.json
new file mode 100644
index 0000000..e096c8b
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda_smart_expected.json
@@ -0,0 +1,5 @@
+{
+    "health" : "OK",
+    "text" : "\nPercentage used endurance indicator: 0%\nCurrent Drive Temperature:     20 C\nDrive Trip Temperature:        70 C\n\nManufactured in week 47 of year 2012\nSpecified cycle count over device lifetime:  0\nAccumulated start-stop cycles:  0\nSpecified load-unload count over device lifetime:  0\nAccumulated load-unload cycles:  0\nElements in grown defect list: 0\n\nVendor (Seagate) cache information\n  Blocks sent to initiator = 1286675833552896\n\nVendor (Seagate/Hitachi) factory information\n  number of hours powered up = 7127.12\n  number of minutes until next internal SMART test = 0\n",
+    "type" : "text"
+}
diff --git a/test/disk_tests/sas_ssd/sda_udevadm b/test/disk_tests/sas_ssd/sda_udevadm
new file mode 100644
index 0000000..ac0744d
--- /dev/null
+++ b/test/disk_tests/sas_ssd/sda_udevadm
@@ -0,0 +1,31 @@
+P: /devices/pci0000:00/0000:00:03.0/0000:02:00.0/host4/port-4:0/end_device-4:0/target4:0:0/4:0:0:0/block/sda
+N: sda
+S: disk/by-id/scsi-00000000000000000
+S: disk/by-id/wwn-0x0000000000000000
+S: disk/by-path/pci-0000:02:00.0-sas-0x0000000000000000-lun-0
+E: DEVLINKS=/dev/disk/by-id/scsi-00000000000000000 /dev/disk/by-id/wwn-0x0000000000000000 /dev/disk/by-path/pci-0000:02:00.0-sas-0x0000000000000000-lun-0
+E: DEVNAME=/dev/sda
+E: DEVPATH=/devices/pci0000:00/0000:00:03.0/0000:02:00.0/host4/port-4:0/end_device-4:0/target4:0:0/4:0:0:0/block/sda
+E: DEVTYPE=disk
+E: ID_BUS=scsi
+E: ID_MODEL=MODEL1
+E: ID_MODEL_ENC=MODEL1\x20\x20\x20\x20\x20\x20
+E: ID_PART_TABLE_TYPE=gpt
+E: ID_PART_TABLE_UUID=605740f0-44a1-4dc5-9fea-bde166df963e
+E: ID_PATH=pci-0000:02:00.0-sas-0x0000000000000000-lun-0
+E: ID_PATH_TAG=pci-0000_02_00_0-sas-0x0000000000000000-lun-0
+E: ID_REVISION=ES64
+E: ID_SCSI=1
+E: ID_SCSI_SERIAL=SERIAL
+E: ID_SERIAL=SERIAL2
+E: ID_SERIAL_SHORT=SER2
+E: ID_TYPE=disk
+E: ID_VENDOR=VENDOR1
+E: ID_VENDOR_ENC=VENDOR1\x20
+E: ID_WWN=0x0000000000000000
+E: ID_WWN_WITH_EXTENSION=0x0000000000000000
+E: MAJOR=8
+E: MINOR=0
+E: SUBSYSTEM=block
+E: TAGS=:systemd:
+E: USEC_INITIALIZED=667541
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk
  2020-12-11 13:52 [pve-devel] [PATCH storage 1/2] tests: add ssd sas disk Dominik Csapak
@ 2020-12-11 13:52 ` Dominik Csapak
  2020-12-15 13:42   ` [pve-devel] applied: " Thomas Lamprecht
  2020-12-15 13:42 ` [pve-devel] applied: [PATCH storage 1/2] tests: add ssd sas disk Thomas Lamprecht
  1 sibling, 1 reply; 4+ messages in thread
From: Dominik Csapak @ 2020-12-11 13:52 UTC (permalink / raw)
  To: pve-devel

for some controllers/disks there the line is
Percentage used endurance indicator: x%

so extend the regex for that possibilty.
We even had a test-case for SAS but did not notice we could extract
that info from there...

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 PVE/Diskmanage.pm                               | 4 ++--
 test/disk_tests/sas/sda_smart_expected.json     | 3 ++-
 test/disk_tests/sas_ssd/disklist_expected.json  | 2 +-
 test/disk_tests/sas_ssd/sda_smart_expected.json | 3 ++-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index a46cc73..116a99a 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -134,8 +134,8 @@ sub get_smart_data {
 	    } elsif (defined($type) && $type eq 'text') {
 		$smartdata->{text} = '' if !defined $smartdata->{text};
 		$smartdata->{text} .= "$line\n";
-		# extract wearout from nvme text, allow for decimal values
-		if ($line =~ m/Percentage Used:\s*(\d+(?:\.\d+)?)\%/i) {
+		# extract wearout from nvme/sas text, allow for decimal values
+		if ($line =~ m/Percentage Used(?: endurance indicator)?:\s*(\d+(?:\.\d+)?)\%/i) {
 		    $smartdata->{wearout} = 100 - $1;
 		}
 	    } elsif ($line =~ m/SMART Disabled/) {
diff --git a/test/disk_tests/sas/sda_smart_expected.json b/test/disk_tests/sas/sda_smart_expected.json
index e096c8b..2964372 100644
--- a/test/disk_tests/sas/sda_smart_expected.json
+++ b/test/disk_tests/sas/sda_smart_expected.json
@@ -1,5 +1,6 @@
 {
     "health" : "OK",
     "text" : "\nPercentage used endurance indicator: 0%\nCurrent Drive Temperature:     20 C\nDrive Trip Temperature:        70 C\n\nManufactured in week 47 of year 2012\nSpecified cycle count over device lifetime:  0\nAccumulated start-stop cycles:  0\nSpecified load-unload count over device lifetime:  0\nAccumulated load-unload cycles:  0\nElements in grown defect list: 0\n\nVendor (Seagate) cache information\n  Blocks sent to initiator = 1286675833552896\n\nVendor (Seagate/Hitachi) factory information\n  number of hours powered up = 7127.12\n  number of minutes until next internal SMART test = 0\n",
-    "type" : "text"
+    "type" : "text",
+    "wearout": 100
 }
diff --git a/test/disk_tests/sas_ssd/disklist_expected.json b/test/disk_tests/sas_ssd/disklist_expected.json
index 9e7ada3..dd9b748 100644
--- a/test/disk_tests/sas_ssd/disklist_expected.json
+++ b/test/disk_tests/sas_ssd/disklist_expected.json
@@ -11,7 +11,7 @@
 	"rpm" : 0,
 	"size" : 5120000,
 	"serial" : "SER2",
-	"wearout" : "N/A",
+	"wearout" : 100,
 	"by_id_link" : "/dev/disk/by-id/scsi-00000000000000000"
     }
 }
diff --git a/test/disk_tests/sas_ssd/sda_smart_expected.json b/test/disk_tests/sas_ssd/sda_smart_expected.json
index e096c8b..2964372 100644
--- a/test/disk_tests/sas_ssd/sda_smart_expected.json
+++ b/test/disk_tests/sas_ssd/sda_smart_expected.json
@@ -1,5 +1,6 @@
 {
     "health" : "OK",
     "text" : "\nPercentage used endurance indicator: 0%\nCurrent Drive Temperature:     20 C\nDrive Trip Temperature:        70 C\n\nManufactured in week 47 of year 2012\nSpecified cycle count over device lifetime:  0\nAccumulated start-stop cycles:  0\nSpecified load-unload count over device lifetime:  0\nAccumulated load-unload cycles:  0\nElements in grown defect list: 0\n\nVendor (Seagate) cache information\n  Blocks sent to initiator = 1286675833552896\n\nVendor (Seagate/Hitachi) factory information\n  number of hours powered up = 7127.12\n  number of minutes until next internal SMART test = 0\n",
-    "type" : "text"
+    "type" : "text",
+    "wearout": 100
 }
-- 
2.20.1





^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied:  [PATCH storage 1/2] tests: add ssd sas disk
  2020-12-11 13:52 [pve-devel] [PATCH storage 1/2] tests: add ssd sas disk Dominik Csapak
  2020-12-11 13:52 ` [pve-devel] [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk Dominik Csapak
@ 2020-12-15 13:42 ` Thomas Lamprecht
  1 sibling, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-12-15 13:42 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 11.12.20 14:52, Dominik Csapak wrote:
> copied from test 'sas' with rotational set to 0
> this has then the type 'ssd', rpm: 0, and health: 'OK'
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  test/disk_tests/sas_ssd/disklist              |  1 +
>  .../disk_tests/sas_ssd/disklist_expected.json | 17 ++++++++++
>  test/disk_tests/sas_ssd/sda/device/model      |  1 +
>  test/disk_tests/sas_ssd/sda/device/vendor     |  1 +
>  test/disk_tests/sas_ssd/sda/queue/rotational  |  1 +
>  test/disk_tests/sas_ssd/sda/size              |  1 +
>  test/disk_tests/sas_ssd/sda_smart             | 20 ++++++++++++
>  .../sas_ssd/sda_smart_expected.json           |  5 +++
>  test/disk_tests/sas_ssd/sda_udevadm           | 31 +++++++++++++++++++
>  9 files changed, 78 insertions(+)
>  create mode 100644 test/disk_tests/sas_ssd/disklist
>  create mode 100644 test/disk_tests/sas_ssd/disklist_expected.json
>  create mode 100644 test/disk_tests/sas_ssd/sda/device/model
>  create mode 100644 test/disk_tests/sas_ssd/sda/device/vendor
>  create mode 100644 test/disk_tests/sas_ssd/sda/queue/rotational
>  create mode 100644 test/disk_tests/sas_ssd/sda/size
>  create mode 100644 test/disk_tests/sas_ssd/sda_smart
>  create mode 100644 test/disk_tests/sas_ssd/sda_smart_expected.json
>  create mode 100644 test/disk_tests/sas_ssd/sda_udevadm
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [pve-devel] applied: [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk
  2020-12-11 13:52 ` [pve-devel] [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk Dominik Csapak
@ 2020-12-15 13:42   ` Thomas Lamprecht
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Lamprecht @ 2020-12-15 13:42 UTC (permalink / raw)
  To: Proxmox VE development discussion, Dominik Csapak

On 11.12.20 14:52, Dominik Csapak wrote:
> for some controllers/disks there the line is
> Percentage used endurance indicator: x%
> 
> so extend the regex for that possibilty.
> We even had a test-case for SAS but did not notice we could extract
> that info from there...
> 
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  PVE/Diskmanage.pm                               | 4 ++--
>  test/disk_tests/sas/sda_smart_expected.json     | 3 ++-
>  test/disk_tests/sas_ssd/disklist_expected.json  | 2 +-
>  test/disk_tests/sas_ssd/sda_smart_expected.json | 3 ++-
>  4 files changed, 7 insertions(+), 5 deletions(-)
> 
>

applied, thanks!




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-15 13:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 13:52 [pve-devel] [PATCH storage 1/2] tests: add ssd sas disk Dominik Csapak
2020-12-11 13:52 ` [pve-devel] [PATCH storage 2/2] Diskmanage: extend wearout detection for SAS disk Dominik Csapak
2020-12-15 13:42   ` [pve-devel] applied: " Thomas Lamprecht
2020-12-15 13:42 ` [pve-devel] applied: [PATCH storage 1/2] tests: add ssd sas disk Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal