[pve-devel] [PATCH storage] fix missing osd info for osd 0

Dominik Csapak d.csapak at proxmox.com
Wed Jul 3 08:43:12 CEST 2019


0 is falsy, we have to check for definedness
also adapt the tests so we test for this

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Diskmanage.pm                             | 2 +-
 test/disk_tests/usages/disklist_expected.json | 2 +-
 test/disk_tests/usages/lvs                    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 41158f4..f446269 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -602,7 +602,7 @@ sub get_disks {
 	    $journal_count += $ceph_volume->{journal} // 0;
 	    $db_count += $ceph_volume->{db} // 0;
 	    $wal_count += $ceph_volume->{wal} // 0;
-	    if ($ceph_volume->{osdid}) {
+	    if (defined($ceph_volume->{osdid})) {
 		$osdid = $ceph_volume->{osdid};
 		$bluestore = 1 if $ceph_volume->{bluestore};
 	    }
diff --git a/test/disk_tests/usages/disklist_expected.json b/test/disk_tests/usages/disklist_expected.json
index 4f9f5cc..9829339 100644
--- a/test/disk_tests/usages/disklist_expected.json
+++ b/test/disk_tests/usages/disklist_expected.json
@@ -151,6 +151,6 @@
 	"rpm" : 0,
 	"bluestore": 0,
 	"type" : "hdd",
-	"osdid" : 2
+	"osdid" : 0
     }
 }
diff --git a/test/disk_tests/usages/lvs b/test/disk_tests/usages/lvs
index b3fad43..393dcd3 100644
--- a/test/disk_tests/usages/lvs
+++ b/test/disk_tests/usages/lvs
@@ -1,4 +1,4 @@
 /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=2
+/dev/sdj(0);osd-data-01234;ceph.osd_id=0
-- 
2.20.1





More information about the pve-devel mailing list