when compiling the disk list add a property with a stable /dev/disk/by-id/ path for a block device when available. This is needed to create zpools with the stable by-id links The /dev/disk/by-id/ directory can contain multiple links to the same device (e.g. when it's used as a LVM PV, or one for the wwn/nvme-eui in addition to the one with vendor and serial). We take the first one which matches the bus where the disk is attached. For nvme disks we exclude the one containing the nvme-eui. The patch assumes that not all disks need to have such a link (e.g. virtio-block devices as we pass them to guests). Additionally the tests were adapted to run successfully. Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
18 lines
324 B
JSON
18 lines
324 B
JSON
{
|
|
"sda" : {
|
|
"gpt" : 1,
|
|
"devpath" : "/dev/sda",
|
|
"type" : "unknown",
|
|
"model" : "MODEL1",
|
|
"health" : "UNKNOWN",
|
|
"osdid" : -1,
|
|
"wwn" : "0x0000000000000000",
|
|
"vendor" : "VENDOR1",
|
|
"rpm" : -1,
|
|
"size" : 5120000,
|
|
"serial" : "SER2",
|
|
"wearout" : "N/A",
|
|
"by_id_link" : "/dev/disk/by-id/scsi-00000000000000000"
|
|
}
|
|
}
|