[pve-devel] [PATCH storage v2 2/3] Diskmanage: add test for lsblk by simulating zfs disk

Dominik Csapak d.csapak at proxmox.com
Fri Jul 12 12:13:50 CEST 2019


Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 test/disk_tests/usages/disklist               |  1 +
 test/disk_tests/usages/disklist_expected.json | 15 +++++++++++++++
 test/disk_tests/usages/lsblk                  |  7 +++++++
 test/disk_tests/usages/partlist               |  2 ++
 test/disk_tests/usages/sdm/device/vendor      |  1 +
 test/disk_tests/usages/sdm/queue/rotational   |  1 +
 test/disk_tests/usages/sdm/size               |  1 +
 test/disk_tests/usages/sdm_udevadm            | 12 ++++++++++++
 8 files changed, 40 insertions(+)
 create mode 100644 test/disk_tests/usages/lsblk
 create mode 100644 test/disk_tests/usages/sdm/device/vendor
 create mode 100644 test/disk_tests/usages/sdm/queue/rotational
 create mode 100644 test/disk_tests/usages/sdm/size
 create mode 100644 test/disk_tests/usages/sdm_udevadm

diff --git a/test/disk_tests/usages/disklist b/test/disk_tests/usages/disklist
index ef443ed..92c3622 100644
--- a/test/disk_tests/usages/disklist
+++ b/test/disk_tests/usages/disklist
@@ -10,3 +10,4 @@ sdi
 sdj
 sdk
 sdl
+sdm
diff --git a/test/disk_tests/usages/disklist_expected.json b/test/disk_tests/usages/disklist_expected.json
index 610e80f..137385d 100644
--- a/test/disk_tests/usages/disklist_expected.json
+++ b/test/disk_tests/usages/disklist_expected.json
@@ -183,5 +183,20 @@
 	"rpm" : 0,
 	"type" : "hdd",
 	"osdid" : -1
+    },
+    "sdm" : {
+	"serial" : "SERIAL1",
+	"vendor" : "ATA",
+	"wwn" : "0x0000000000000000",
+	"devpath" : "/dev/sdm",
+	"model" : "MODEL1",
+	"used" : "ZFS",
+	"wearout" : "N/A",
+	"health" : "UNKNOWN",
+	"gpt" : 1,
+	"size" : 1536000,
+	"rpm" : 0,
+	"type" : "hdd",
+	"osdid" : -1
     }
 }
diff --git a/test/disk_tests/usages/lsblk b/test/disk_tests/usages/lsblk
new file mode 100644
index 0000000..cbb18b9
--- /dev/null
+++ b/test/disk_tests/usages/lsblk
@@ -0,0 +1,7 @@
+{
+   "blockdevices": [
+      {"path":"/dev/sdm", "parttype":null},
+      {"path":"/dev/sdm1", "parttype":"6a898cc3-1dd2-11b2-99a6-080020736631"},
+      {"path":"/dev/sdm9", "parttype":"6a945a3b-1dd2-11b2-99a6-080020736631"}
+   ]
+}
diff --git a/test/disk_tests/usages/partlist b/test/disk_tests/usages/partlist
index 8dcdefc..9fd750f 100644
--- a/test/disk_tests/usages/partlist
+++ b/test/disk_tests/usages/partlist
@@ -1,2 +1,4 @@
 sde1
 sdf1
+sdm1
+sdm9
diff --git a/test/disk_tests/usages/sdm/device/vendor b/test/disk_tests/usages/sdm/device/vendor
new file mode 100644
index 0000000..531030d
--- /dev/null
+++ b/test/disk_tests/usages/sdm/device/vendor
@@ -0,0 +1 @@
+ATA
diff --git a/test/disk_tests/usages/sdm/queue/rotational b/test/disk_tests/usages/sdm/queue/rotational
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/disk_tests/usages/sdm/queue/rotational
@@ -0,0 +1 @@
+1
diff --git a/test/disk_tests/usages/sdm/size b/test/disk_tests/usages/sdm/size
new file mode 100644
index 0000000..13de30f
--- /dev/null
+++ b/test/disk_tests/usages/sdm/size
@@ -0,0 +1 @@
+3000
diff --git a/test/disk_tests/usages/sdm_udevadm b/test/disk_tests/usages/sdm_udevadm
new file mode 100644
index 0000000..9317b9f
--- /dev/null
+++ b/test/disk_tests/usages/sdm_udevadm
@@ -0,0 +1,12 @@
+E: DEVNAME=/dev/sdm
+E: DEVTYPE=disk
+E: ID_ATA_ROTATION_RATE_RPM=0
+E: ID_BUS=ata
+E: ID_MODEL=MODEL1
+E: ID_PART_TABLE_TYPE=gpt
+E: ID_PART_TABLE_UUID=8417b93f-eff9-4e8f-8d84-dc2e77fc07a2
+E: ID_SERIAL=SERIAL1
+E: ID_SERIAL_SHORT=SERIAL1
+E: ID_TYPE=disk
+E: ID_WWN=0x0000000000000000
+E: ID_WWN_WITH_EXTENSION=0x0000000000000000
-- 
2.20.1





More information about the pve-devel mailing list