[pve-devel] [PATCH storage] add info about bluestore to disklist
Fabian Grünbichler
f.gruenbichler at proxmox.com
Fri Aug 4 12:07:19 CEST 2017
On Tue, Aug 01, 2017 at 03:34:44PM +0200, Dominik Csapak wrote:
> this patch adds information about bluestore/db/wal to the disklist,
> and we set the journal count only when we have at least one journal on
> the disk
>
> also adapt the regression tests
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> PVE/Diskmanage.pm | 32 +++++++++++++++++++----
> test/disk_tests/cciss/disklist_expected.json | 1 -
> test/disk_tests/hdd_smart/disklist_expected.json | 2 --
> test/disk_tests/nvme_smart/disklist_expected.json | 1 -
> test/disk_tests/sas/disklist_expected.json | 1 -
> test/disk_tests/ssd_smart/disklist_expected.json | 7 +----
> test/disk_tests/usages/disklist_expected.json | 7 +----
> 7 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
> index 6dd12f7..ed40b2e 100644
> --- a/PVE/Diskmanage.pm
> +++ b/PVE/Diskmanage.pm
> @@ -209,11 +209,22 @@ sub get_ceph_journals {
> my $journalhash = {};
>
> my $journal_uuid = '45b0969e-9b03-4f30-b4c6-b4b80ceff106';
> + my $db_uuid = '30cd0809-c2b2-499c-8879-2d6b78529876';
> + my $wal_uuid = '5ce17fce-4087-4169-b7ff-056cc58473f9';
> + my $block_uuid = 'cafecafe-9b03-4f30-b4c6-b4b80ceff106';
>
> - dir_glob_foreach('/dev/disk/by-parttypeuuid', "$journal_uuid\..+", sub {
> - my ($entry) = @_;
> + dir_glob_foreach('/dev/disk/by-parttypeuuid', "($journal_uuid|$db_uuid|$wal_uuid|$block_uuid)\..+", sub {
> + my ($entry, $type) = @_;
> my $real_dev = abs_path("/dev/disk/by-parttypeuuid/$entry");
> - $journalhash->{$real_dev} = 1;
> + if ($type eq $journal_uuid) {
> + $journalhash->{$real_dev} = 1;
> + } elsif ($type eq $db_uuid) {
> + $journalhash->{$real_dev} = 2;
> + } elsif ($type eq $wal_uuid) {
> + $journalhash->{$real_dev} = 3;
> + } elsif ($type eq $block_uuid) {
> + $journalhash->{$real_dev} = 4;
> + }
> });
>
> return $journalhash;
> @@ -460,8 +471,11 @@ sub get_disks {
> };
>
> my $osdid = -1;
> + my $bluestore = 0;
>
> my $journal_count = 0;
> + my $db_count = 0;
> + my $wal_count = 0;
>
> my $found_partitions;
> my $found_lvm;
> @@ -495,7 +509,12 @@ sub get_disks {
> $found_zfs = 1;
> }
>
> - $journal_count++ if $journalhash->{"$partpath/$part"};
> + if ($journalhash->{"$partpath/$part"}) {
> + $journal_count++ if $journalhash->{"$partpath/$part"} == 1;
> + $db_count++ if $journalhash->{"$partpath/$part"} == 2;
> + $wal_count++ if $journalhash->{"$partpath/$part"} == 3;
> + $bluestore = 1 if $journalhash->{"$partpath/$part"} == 4;
> + }
>
> if (!dir_is_empty("$sysdir/$part/holders") && !$found_lvm) {
> $found_dm = 1;
> @@ -515,7 +534,10 @@ sub get_disks {
>
> $disklist->{$dev}->{used} = $used if $used;
> $disklist->{$dev}->{osdid} = $osdid;
> - $disklist->{$dev}->{journals} = $journal_count;
> + $disklist->{$dev}->{journals} = $journal_count if $journal_count;
> + $disklist->{$dev}->{bluestore} = $bluestore if $osdid != -1;
> + $disklist->{$dev}->{db} = $db_count if $db_count;
> + $disklist->{$dev}->{wal} = $wal_count if $db_count;
s/db_count/wal_count/
> });
>
> return $disklist;
> diff --git a/test/disk_tests/cciss/disklist_expected.json b/test/disk_tests/cciss/disklist_expected.json
> index fb071ef..61f60bf 100644
> --- a/test/disk_tests/cciss/disklist_expected.json
> +++ b/test/disk_tests/cciss/disklist_expected.json
> @@ -10,7 +10,6 @@
> "model" : "LOGICAL_VOLUME",
> "size" : 5120,
> "wwn" : "0x0000000000000000",
> - "journals" : 0,
> "gpt" : 1,
> "devpath" : "/dev/cciss/c0d0"
> }
> diff --git a/test/disk_tests/hdd_smart/disklist_expected.json b/test/disk_tests/hdd_smart/disklist_expected.json
> index 7685f5f..02a341e 100644
> --- a/test/disk_tests/hdd_smart/disklist_expected.json
> +++ b/test/disk_tests/hdd_smart/disklist_expected.json
> @@ -10,7 +10,6 @@
> "health" : "PASSED",
> "type" : "hdd",
> "wwn" : "0x0000000000000000",
> - "journals" : 0,
> "wearout" : "N/A",
> "serial" : "00000000"
> },
> @@ -26,7 +25,6 @@
> "vendor" : "ATA",
> "serial" : "00000000",
> "wearout" : "N/A",
> - "journals" : 0,
> "wwn" : "0x0000000000000000"
> }
> }
> diff --git a/test/disk_tests/nvme_smart/disklist_expected.json b/test/disk_tests/nvme_smart/disklist_expected.json
> index ac34d0f..e50e4a3 100644
> --- a/test/disk_tests/nvme_smart/disklist_expected.json
> +++ b/test/disk_tests/nvme_smart/disklist_expected.json
> @@ -3,7 +3,6 @@
> "wearout" : "N/A",
> "vendor" : "unknown",
> "size" : 512000,
> - "journals" : 0,
> "health" : "PASSED",
> "serial" : "unknown",
> "model" : "NVME MODEL 1",
> diff --git a/test/disk_tests/sas/disklist_expected.json b/test/disk_tests/sas/disklist_expected.json
> index 77f7d33..7814765 100644
> --- a/test/disk_tests/sas/disklist_expected.json
> +++ b/test/disk_tests/sas/disklist_expected.json
> @@ -6,7 +6,6 @@
> "model" : "MODEL1",
> "health" : "UNKNOWN",
> "osdid" : -1,
> - "journals" : 0,
> "wwn" : "0x0000000000000000",
> "vendor" : "VENDOR1",
> "rpm" : -1,
> diff --git a/test/disk_tests/ssd_smart/disklist_expected.json b/test/disk_tests/ssd_smart/disklist_expected.json
> index 1a89a84..d84b9dc 100644
> --- a/test/disk_tests/ssd_smart/disklist_expected.json
> +++ b/test/disk_tests/ssd_smart/disklist_expected.json
> @@ -5,7 +5,6 @@
> "rpm" : 0,
> "gpt" : 1,
> "health" : "PASSED",
> - "journals" : 0,
> "wearout" : "100",
> "osdid" : -1,
> "size" : 512000,
> @@ -26,7 +25,6 @@
> "vendor" : "ATA",
> "serial" : "000000000000000000",
> "wearout" : "97",
> - "journals" : 0,
> "health" : "PASSED"
> },
> "sdc" : {
> @@ -37,7 +35,6 @@
> "type" : "ssd",
> "size" : 512000,
> "wearout" : "99",
> - "journals" : 0,
> "health" : "PASSED",
> "gpt" : 1,
> "rpm" : 0,
> @@ -49,7 +46,6 @@
> "gpt" : 1,
> "serial" : "000000000000",
> "vendor" : "ATA",
> - "journals" : 0,
> "wearout" : "100",
> "health" : "PASSED",
> "devpath" : "/dev/sdd",
> @@ -71,7 +67,6 @@
> "gpt" : 1,
> "rpm" : 0,
> "health" : "PASSED",
> - "wearout" : "91",
> - "journals" : 0
> + "wearout" : "91"
> }
> }
> diff --git a/test/disk_tests/usages/disklist_expected.json b/test/disk_tests/usages/disklist_expected.json
> index 3d1241c..3205bbf 100644
> --- a/test/disk_tests/usages/disklist_expected.json
> +++ b/test/disk_tests/usages/disklist_expected.json
> @@ -5,10 +5,10 @@
> "size" : 1536000,
> "type" : "hdd",
> "osdid" : "444",
> + "bluestore" : "0",
> "health" : "UNKNOWN",
> "model" : "MODEL1",
> "used" : "mounted",
> - "journals" : 0,
> "wearout" : "N/A",
> "wwn" : "0x0000000000000000",
> "devpath" : "/dev/sdf",
> @@ -28,7 +28,6 @@
> "type" : "hdd",
> "model" : "MODEL1",
> "used" : "Device Mapper",
> - "journals" : 0,
> "wearout" : "N/A"
> },
> "sdb" : {
> @@ -38,7 +37,6 @@
> "devpath" : "/dev/sdb",
> "model" : "MODEL1",
> "used" : "LVM",
> - "journals" : 0,
> "wearout" : "N/A",
> "health" : "UNKNOWN",
> "gpt" : 1,
> @@ -50,7 +48,6 @@
> "sda" : {
> "model" : "MODEL1",
> "used" : "mounted",
> - "journals" : 0,
> "wearout" : "N/A",
> "health" : "UNKNOWN",
> "gpt" : 1,
> @@ -69,7 +66,6 @@
> "devpath" : "/dev/sdc",
> "wwn" : "0x0000000000000000",
> "used" : "ZFS",
> - "journals" : 0,
> "wearout" : "N/A",
> "model" : "MODEL1",
> "health" : "UNKNOWN",
> @@ -81,7 +77,6 @@
> },
> "sdd" : {
> "model" : "MODEL1",
> - "journals" : 0,
> "wearout" : "N/A",
> "health" : "UNKNOWN",
> "size" : 1536000,
> --
> 2.11.0
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
More information about the pve-devel
mailing list