[pve-devel] [PATCH manager 2/3] fix #1099: get correct info on disks in createosd

Dominik Csapak d.csapak at proxmox.com
Wed Oct 5 15:32:39 CEST 2016


instead of getting all disks, only get the info
from the one we get as parameter
and use the 'devname' value for the
ceph commands instead of the parameter itself
(this fixes the cciss!cXdY cciss/cXdY mismatch)

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/API2/Ceph.pm | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 7a19810..030664a 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -203,11 +203,11 @@ __PACKAGE__->register_method ({
 
         $param->{dev} = PVE::Diskmanage::verify_blockdev_path($param->{dev});
 
-	my $disklist = PVE::Diskmanage::get_disks();
-
 	my $devname = $param->{dev};
 	$devname =~ s|/dev/||;
-       
+
+	my $disklist = PVE::Diskmanage::get_disks($devname, 1);
+
 	my $diskinfo = $disklist->{$devname};
 	die "unable to get device info for '$devname'\n"
 	    if !$diskinfo;
@@ -215,6 +215,7 @@ __PACKAGE__->register_method ({
 	die "device '$param->{dev}' is in use\n" 
 	    if $diskinfo->{used};
 
+	my $devpath = $diskinfo->{devpath};
 	my $rados = PVE::RADOS->new();
 	my $monstat = $rados->mon_command({ prefix => 'mon_status' });
 	die "unable to get fsid\n" if !$monstat->{monmap} || !$monstat->{monmap}->{fsid};
@@ -234,7 +235,7 @@ __PACKAGE__->register_method ({
 
 	    my $fstype = $param->{fstype} || 'xfs';
 
-	    print "create OSD on $param->{dev} ($fstype)\n";
+	    print "create OSD on $devpath ($fstype)\n";
 
 	    my $ccname = PVE::CephTools::get_config('ccname');
 
@@ -243,9 +244,9 @@ __PACKAGE__->register_method ({
 
 	    if ($journal_dev) {
 		print "using device '$journal_dev' for journal\n";
-		push @$cmd, '--journal-dev', $param->{dev}, $journal_dev;
+		push @$cmd, '--journal-dev', $devpath, $journal_dev;
 	    } else {
-		push @$cmd, $param->{dev};
+		push @$cmd, $devpath;
 	    }
 	    
 	    run_command($cmd);
-- 
2.1.4





More information about the pve-devel mailing list