5
0
mirror of git://git.proxmox.com/git/pve-storage.git synced 2025-02-12 21:57:58 +03:00

fix #2266: Diskmanage: get correct osd id

The osdid can consist of multiple digits, cope with that and add more
regression tests for this

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
This commit is contained in:
Dominik Csapak 2019-07-08 15:48:14 +02:00 committed by Thomas Lamprecht
parent 0841d128be
commit 79f4a7bfd3
13 changed files with 70 additions and 3 deletions

View File

@ -258,7 +258,7 @@ sub get_ceph_volume_infos {
if ($fields->[1] =~ m|^osd-([^-]+)-|) {
my $type = $1;
# $result autovivification is wanted, to not creating empty hashes
if (($type eq 'block' || $type eq 'data') && $fields->[2] =~ m/ceph.osd_id=([^,])/) {
if (($type eq 'block' || $type eq 'data') && $fields->[2] =~ m/ceph.osd_id=([^,]+)/) {
$result->{$dev}->{osdid} = $1;
$result->{$dev}->{bluestore} = ($type eq 'block');
} else {

View File

@ -8,3 +8,5 @@ sdg
sdh
sdi
sdj
sdk
sdl

View File

@ -152,5 +152,36 @@
"bluestore": 0,
"type" : "hdd",
"osdid" : 0
},
"sdk" : {
"serial" : "SERIAL1",
"vendor" : "ATA",
"wwn" : "0x0000000000000000",
"devpath" : "/dev/sdk",
"model" : "MODEL1",
"used" : "LVM",
"wearout" : "N/A",
"health" : "UNKNOWN",
"gpt" : 1,
"size" : 1536000,
"rpm" : 0,
"bluestore": 0,
"type" : "hdd",
"osdid" : 230
},
"sdl" : {
"serial" : "SERIAL1",
"vendor" : "ATA",
"wwn" : "0x0000000000000000",
"devpath" : "/dev/sdl",
"model" : "MODEL1",
"used" : "LVM",
"wearout" : "N/A",
"health" : "UNKNOWN",
"gpt" : 1,
"size" : 1536000,
"rpm" : 0,
"type" : "hdd",
"osdid" : -1
}
}

View File

@ -1,4 +1,6 @@
/dev/sdg(0);osd-block-01234;ceph.osd_id=1
/dev/sdh(0);osd-journal-01234;ceph.osd_id=1
/dev/sdi(0);osd-db-01234;ceph.osd_id=1
/dev/sdj(0);osd-data-01234;ceph.osd_id=0
/dev/sdi(0);osd-db-01234;ceph.osd_id=1,dasdf
/dev/sdj(0);osd-data-01234;ceph.osd_id=0,asfd
/dev/sdk(0);osd-data-231231;ceph.osd_id=230,ceph.fsid=test
/dev/sdl(0);osd-data-234132;ceph.osd_id=,bar

View File

@ -3,3 +3,5 @@
/dev/sdh
/dev/sdi
/dev/sdj
/dev/sdk
/dev/sdl

View File

@ -0,0 +1 @@
ATA

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
3000

View File

@ -0,0 +1,12 @@
E: DEVNAME=/dev/sdk
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

View File

@ -0,0 +1 @@
ATA

View File

@ -0,0 +1 @@
1

View File

@ -0,0 +1 @@
3000

View File

@ -0,0 +1,12 @@
E: DEVNAME=/dev/sdl
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