Commit 182da879 authored by Dietmar Maurer's avatar Dietmar Maurer

allow to call ceph init multiple times

parent f8609964
...@@ -508,7 +508,7 @@ __PACKAGE__->register_method ({ ...@@ -508,7 +508,7 @@ __PACKAGE__->register_method ({
name => 'init', name => 'init',
path => 'init', path => 'init',
method => 'POST', method => 'POST',
description => "Create initial ceph configuration.", description => "Create initial ceph default configuration and setup symlinks.",
proxyto => 'node', proxyto => 'node',
protected => 1, protected => 1,
parameters => { parameters => {
...@@ -526,7 +526,7 @@ __PACKAGE__->register_method ({ ...@@ -526,7 +526,7 @@ __PACKAGE__->register_method ({
pg_bits => { pg_bits => {
description => "Placement group bits, used to specify the default number of placement groups (Note: 'osd pool default pg num' does not work for deafult pools)", description => "Placement group bits, used to specify the default number of placement groups (Note: 'osd pool default pg num' does not work for deafult pools)",
type => 'integer', type => 'integer',
default => 9, default => 6,
optional => 1, optional => 1,
minimum => 6, minimum => 6,
maximum => 14, maximum => 14,
...@@ -539,11 +539,12 @@ __PACKAGE__->register_method ({ ...@@ -539,11 +539,12 @@ __PACKAGE__->register_method ({
&$check_ceph_installed(); &$check_ceph_installed();
-f $pve_ceph_cfgpath && # simply load old config if it already exists
die "configuration file '$pve_ceph_cfgpath' already exists.\n"; my $cfg = &$parse_ceph_config($pve_ceph_cfgpath);
my $pg_bits = $param->{pg_bits} || 9; my $keyring = '/etc/pve/priv/$cluster.$name.keyring';
my $size = $param->{size} || 2;
if (!$cfg->{global}) {
my $fsid; my $fsid;
my $uuid; my $uuid;
...@@ -551,26 +552,32 @@ __PACKAGE__->register_method ({ ...@@ -551,26 +552,32 @@ __PACKAGE__->register_method ({
UUID::generate($uuid); UUID::generate($uuid);
UUID::unparse($uuid, $fsid); UUID::unparse($uuid, $fsid);
my $global = { $cfg->{global} = {
'fsid' => $fsid, 'fsid' => $fsid,
'auth supported' => 'cephx', 'auth supported' => 'cephx',
'auth cluster required' => 'cephx', 'auth cluster required' => 'cephx',
'auth service required' => 'cephx', 'auth service required' => 'cephx',
'auth client required' => 'cephx', 'auth client required' => 'cephx',
'keyring' => '/etc/pve/priv/$cluster.$name.keyring',
'filestore xattr use omap' => 'true', 'filestore xattr use omap' => 'true',
'osd journal size' => '1024', 'osd journal size' => '1024',
'osd pool default size' => $size,
'osd pool default min size' => 1, 'osd pool default min size' => 1,
'osd pg bits' => $pg_bits,
'osd pgp bits' => $pg_bits,
}; };
# this does not work for default pools # this does not work for default pools
#'osd pool default pg num' => $pg_num, #'osd pool default pg num' => $pg_num,
#'osd pool default pgp num' => $pg_num, #'osd pool default pgp num' => $pg_num,
}
$cfg->{global}->{keyring} = $keyring;
$cfg->{global}->{'osd pool default size'} = $param->{size} if $param->{size};
&$write_ceph_config({global => $global}); if ($param->{pg_bits}) {
$cfg->{global}->{'osd pg bits'} = $param->{pg_bits};
$cfg->{global}->{'osd pgp bits'} = $param->{pg_bits};
}
&$write_ceph_config($cfg);
&$setup_pve_symlinks(); &$setup_pve_symlinks();
...@@ -1077,9 +1084,6 @@ __PACKAGE__->register_method ({ ...@@ -1077,9 +1084,6 @@ __PACKAGE__->register_method ({
&$check_ceph_inited(); &$check_ceph_inited();
die "not fully configured - missing '$pve_ckeyring_path'\n"
if ! -f $pve_ckeyring_path;
&$setup_pve_symlinks(); &$setup_pve_symlinks();
print "create OSD on $param->{dev}\n"; print "create OSD on $param->{dev}\n";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment