]> git.proxmox.com Git - pve-manager.git/commitdiff
ceph: improve disk usage detection
authorDietmar Maurer <dietmar@proxmox.com>
Fri, 10 Jan 2014 11:04:26 +0000 (12:04 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 10 Jan 2014 11:04:26 +0000 (12:04 +0100)
PVE/API2/Ceph.pm

index 721d7e3828cbed8ef9e5a0bed76633e583c594ab..e5fb66c08507c4c777db981d8e3b29e2c0ba5df7 100644 (file)
@@ -335,22 +335,30 @@ sub list_disks {
 
        my $journal_count = 0;
 
+       my $found_partitions;
+       my $found_lvm;
+       my $found_mountpoints;
        dir_glob_foreach("/sys/block/$dev", "$dev.+", sub {
            my ($part) = @_;
+
+           $found_partitions = 1;
+
            if (my $mp = &$dev_is_mounted("/dev/$part")) {
-               $used = 'mounted' if !$used;
+               $found_mountpoints = 1;
                if ($mp =~ m|^/var/lib/ceph/osd/ceph-(\d+)$|) {
                    $osdid = $1;
                } 
            }
            if (!&$dir_is_epmty("/sys/block/$dev/$part/holders"))  {
-               $used = 'LVM' if !$used;
+               $found_lvm = 1;
            }
-           $used = 'partitions' if !$used;
-
            $journal_count++ if $journalhash->{"/dev/$part"};
        });
 
+       $used = 'mounted' if $found_mountpoints && !$used;
+       $used = 'LVM' if $found_lvm && !$used;
+       $used = 'partitions' if $found_partitions && !$used;
+
        $disklist->{$dev}->{used} = $used if $used;
        $disklist->{$dev}->{osdid} = $osdid;
        $disklist->{$dev}->{journals} = $journal_count;