mirror of
git://git.proxmox.com/git/pve-storage.git
synced 2025-01-18 06:03:59 +03:00
disks: get: add osdid-list return parameter
It is possible to run multiple OSD daemons on one disk. The new 'osdid-list' parameter returns an array of all OSD IDs found on the disk. The old 'osdid' parameter is kept for compatibility. We might want to deprecate / remove it in the future. Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
This commit is contained in:
parent
29ca4abaee
commit
e1348a2792
@ -124,7 +124,11 @@ __PACKAGE__->register_method ({
|
||||
gpt => { type => 'boolean' },
|
||||
mounted => { type => 'boolean' },
|
||||
size => { type => 'integer'},
|
||||
osdid => { type => 'integer'},
|
||||
osdid => { type => 'integer'}, # TODO: deprecate / remove in PVE 9?
|
||||
'osdid-list' => {
|
||||
type => 'array',
|
||||
items => { type => 'integer' },
|
||||
},
|
||||
vendor => { type => 'string', optional => 1 },
|
||||
model => { type => 'string', optional => 1 },
|
||||
serial => { type => 'string', optional => 1 },
|
||||
|
@ -286,6 +286,10 @@ sub get_ceph_volume_infos {
|
||||
# $result autovivification is wanted, to not creating empty hashes
|
||||
if (($type eq 'block' || $type eq 'data') && $fields->[2] =~ m/ceph.osd_id=([^,]+)/) {
|
||||
$result->{$dev}->{osdid} = $1;
|
||||
if ( !defined($result->{$dev}->{'osdid-list'}) ) {
|
||||
$result->{$dev}->{'osdid-list'} = [];
|
||||
}
|
||||
push($result->{$dev}->{'osdid-list'}->@*, $1);
|
||||
$result->{$dev}->{bluestore} = ($type eq 'block');
|
||||
if ($fields->[2] =~ m/ceph\.encrypted=1/) {
|
||||
$result->{$dev}->{encrypted} = 1;
|
||||
@ -584,6 +588,7 @@ sub get_disks {
|
||||
$disklist->{$dev}->{by_id_link} = $by_id_link if defined($by_id_link);
|
||||
|
||||
my ($osdid, $bluestore, $osdencrypted) = (-1, 0, 0);
|
||||
my $osdid_list;
|
||||
my ($journal_count, $db_count, $wal_count) = (0, 0, 0);
|
||||
|
||||
my $partpath = $devpath;
|
||||
@ -624,6 +629,7 @@ sub get_disks {
|
||||
$wal_count += $ceph_volume->{wal} // 0;
|
||||
if (defined($ceph_volume->{osdid})) {
|
||||
$osdid = $ceph_volume->{osdid};
|
||||
$osdid_list = $ceph_volume->{'osdid-list'};
|
||||
$bluestore = 1 if $ceph_volume->{bluestore};
|
||||
$osdencrypted = 1 if $ceph_volume->{encrypted};
|
||||
}
|
||||
@ -648,6 +654,7 @@ sub get_disks {
|
||||
$partitions->{$part}->{size} = get_sysdir_size("$sysdir/$part") // 0;
|
||||
$partitions->{$part}->{used} = $determine_usage->("$partpath/$part", "$sysdir/$part", 1);
|
||||
$partitions->{$part}->{osdid} //= -1;
|
||||
$partitions->{$part}->{'osdid-list'} //= undef;
|
||||
|
||||
# avoid counting twice (e.g. partition with the LVM for the DB OSD is in $journalhash)
|
||||
return if $lvm_based_osd;
|
||||
@ -657,6 +664,8 @@ sub get_disks {
|
||||
if ($mp =~ m|^/var/lib/ceph/osd/ceph-(\d+)$|) {
|
||||
$osdid = $1;
|
||||
$partitions->{$part}->{osdid} = $osdid;
|
||||
$osdid_list = [$1]; # assuming only one OSD per disk
|
||||
$partitions->{$part}->{'osdid-list'} = $osdid_list;
|
||||
}
|
||||
}
|
||||
|
||||
@ -693,6 +702,7 @@ sub get_disks {
|
||||
$collect_ceph_info->($devpath);
|
||||
|
||||
$disklist->{$dev}->{osdid} = $osdid;
|
||||
$disklist->{$dev}->{'osdid-list'} = $osdid_list;
|
||||
$disklist->{$dev}->{journals} = $journal_count if $journal_count;
|
||||
$disklist->{$dev}->{bluestore} = $bluestore if $osdid != -1;
|
||||
$disklist->{$dev}->{osdencrypted} = $osdencrypted if $osdid != -1;
|
||||
|
@ -6,6 +6,7 @@
|
||||
"type" : "unknown",
|
||||
"serial" : "SER111",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"health" : "UNKNOWN",
|
||||
"model" : "LOGICAL_VOLUME",
|
||||
"size" : 5120,
|
||||
|
@ -4,6 +4,7 @@
|
||||
"size" : 1024000,
|
||||
"gpt" : 1,
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"rpm" : 7200,
|
||||
"model" : "ST4000NM0033-9ZM170",
|
||||
"vendor" : "ATA",
|
||||
@ -15,6 +16,7 @@
|
||||
},
|
||||
"sda" : {
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"size" : 1024000,
|
||||
"gpt" : 1,
|
||||
"devpath" : "/dev/sda",
|
||||
|
@ -8,6 +8,7 @@
|
||||
"model" : "NVME MODEL 1",
|
||||
"rpm" : 0,
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"devpath" : "/dev/nvme0n1",
|
||||
"gpt" : 0,
|
||||
"wwn" : "unknown",
|
||||
|
@ -6,6 +6,7 @@
|
||||
"model" : "MODEL1",
|
||||
"health" : "UNKNOWN",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"wwn" : "0x0000000000000000",
|
||||
"vendor" : "VENDOR1",
|
||||
"rpm" : -1,
|
||||
|
@ -6,6 +6,7 @@
|
||||
"model" : "MODEL1",
|
||||
"health" : "OK",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"wwn" : "0x0000000000000000",
|
||||
"vendor" : "VENDOR1",
|
||||
"rpm" : 0,
|
||||
|
@ -7,6 +7,7 @@
|
||||
"health" : "PASSED",
|
||||
"wearout" : "100",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"size" : 512000,
|
||||
"type" : "ssd",
|
||||
"devpath" : "/dev/sda",
|
||||
@ -17,6 +18,7 @@
|
||||
"model" : "INTEL_SSDSC2BB080G6",
|
||||
"devpath" : "/dev/sdb",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"type" : "ssd",
|
||||
"size" : 512000,
|
||||
"wwn" : "0x0000000000000000",
|
||||
@ -32,6 +34,7 @@
|
||||
"devpath" : "/dev/sdc",
|
||||
"model" : "Samsung SSD 850 PRO 512GB",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"type" : "ssd",
|
||||
"size" : 512000,
|
||||
"wearout" : "99",
|
||||
@ -52,12 +55,14 @@
|
||||
"model" : "SanDisk SD8SB8U1T001122",
|
||||
"size" : 512000,
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"type" : "ssd",
|
||||
"wwn" : "0x0000000000000000"
|
||||
},
|
||||
"sde" : {
|
||||
"type" : "ssd",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"size" : 512000,
|
||||
"model" : "KINGSTON SHFS37A120G",
|
||||
"devpath" : "/dev/sde",
|
||||
|
@ -6,6 +6,7 @@
|
||||
"type" : "hdd",
|
||||
"osdencrypted": 0,
|
||||
"osdid" : "444",
|
||||
"osdid-list" : ["444"],
|
||||
"bluestore" : "0",
|
||||
"health" : "UNKNOWN",
|
||||
"model" : "MODEL1",
|
||||
@ -26,6 +27,7 @@
|
||||
"size" : 1536000,
|
||||
"gpt" : 1,
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"type" : "hdd",
|
||||
"model" : "MODEL1",
|
||||
"used" : "Device Mapper",
|
||||
@ -44,7 +46,8 @@
|
||||
"size" : 1536000,
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
},
|
||||
"sda" : {
|
||||
"model" : "MODEL1",
|
||||
@ -57,6 +60,7 @@
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"serial" : "SERIAL1",
|
||||
"vendor" : "ATA",
|
||||
"wwn" : "0x0000000000000000",
|
||||
@ -73,6 +77,7 @@
|
||||
"health" : "UNKNOWN",
|
||||
"type" : "hdd",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"gpt" : 1,
|
||||
"rpm" : 0,
|
||||
"size" : 1536000
|
||||
@ -86,6 +91,7 @@
|
||||
"gpt" : 1,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null,
|
||||
"serial" : "SERIAL1",
|
||||
"used": "ZFS",
|
||||
"vendor" : "ATA",
|
||||
@ -107,7 +113,8 @@
|
||||
"type" : "hdd",
|
||||
"bluestore": 1,
|
||||
"osdencrypted": 0,
|
||||
"osdid" : 1
|
||||
"osdid" : 1,
|
||||
"osdid-list" : [1]
|
||||
},
|
||||
"sdh" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -123,7 +130,8 @@
|
||||
"size" : 1536000,
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
},
|
||||
"sdi" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -139,7 +147,8 @@
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"db": 1,
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
},
|
||||
"sdj" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -156,7 +165,8 @@
|
||||
"bluestore": 0,
|
||||
"type" : "hdd",
|
||||
"osdencrypted": 1,
|
||||
"osdid" : 0
|
||||
"osdid" : 0,
|
||||
"osdid-list" : [0]
|
||||
},
|
||||
"sdk" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -173,7 +183,8 @@
|
||||
"bluestore": 0,
|
||||
"type" : "hdd",
|
||||
"osdencrypted": 0,
|
||||
"osdid" : 230
|
||||
"osdid" : 230,
|
||||
"osdid-list": [230]
|
||||
},
|
||||
"sdl" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -188,7 +199,8 @@
|
||||
"size" : 1536000,
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
},
|
||||
"sdm" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -203,7 +215,8 @@
|
||||
"size" : 1536000,
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
},
|
||||
"sdn" : {
|
||||
"serial" : "SERIAL1",
|
||||
@ -218,6 +231,7 @@
|
||||
"size" : 1536000,
|
||||
"rpm" : 0,
|
||||
"type" : "hdd",
|
||||
"osdid" : -1
|
||||
"osdid" : -1,
|
||||
"osdid-list" : null
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user