[pve-devel] [PatchV2 pve-manager 3/3] Now pvecephy can also createmon with Infernalis and Hammer.
Wolfgang Link
w.link at proxmox.com
Tue May 24 17:18:52 CEST 2016
Ceph changed user name from root to ceph.
And for startup systemd is used instead of sysvinit.
---
PVE/API2/Ceph.pm | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 58e5b35..abf5255 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -841,6 +841,8 @@ __PACKAGE__->register_method ({
my $monaddrhash = {};
+ my $systemd = PVE::CephTools::systemd_managed();
+
foreach my $section (keys %$cfg) {
next if $section eq 'global';
my $d = $cfg->{$section};
@@ -878,6 +880,7 @@ __PACKAGE__->register_method ({
my $worker = sub {
my $upid = shift;
+ my $uid = 0;
my $pve_ckeyring_path = PVE::CephTools::get_config('pve_ckeyring_path');
@@ -888,11 +891,17 @@ __PACKAGE__->register_method ({
my $pve_mon_key_path = PVE::CephTools::get_config('pve_mon_key_path');
if (! -f $pve_mon_key_path) {
+
+ $uid = getpwnam('ceph') if $systemd;
+
run_command("cp $pve_ckeyring_path $pve_mon_key_path.tmp");
- run_command("ceph-authtool $pve_mon_key_path.tmp -n client.admin --set-uid=0 " .
+ my $cmd = "ceph-authtool $pve_mon_key_path.tmp -n client.admin --set-uid=0 " .
"--cap mds 'allow' " .
"--cap osd 'allow *' " .
- "--cap mon 'allow *'");
+ "--cap mon 'allow *' ";
+ $cmd .= "> /etc/ceph/ceph.client.admin.keyring" if $systemd;
+ run_command($cmd);
+ run_command("chown ceph:ceph /etc/ceph/ceph.client.admin.keyring") if $systemd;
run_command("ceph-authtool $pve_mon_key_path.tmp --gen-key -n mon. --cap mon 'allow *'");
run_command("mv $pve_mon_key_path.tmp $pve_mon_key_path");
}
@@ -906,6 +915,7 @@ __PACKAGE__->register_method ({
eval {
mkdir $mondir;
+ run_command("chown ceph:ceph $mondir") if $systemd;
if ($moncount > 0) {
my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
@@ -916,6 +926,8 @@ __PACKAGE__->register_method ({
}
run_command("ceph-mon --mkfs -i $monid --monmap $monmap --keyring $pve_mon_key_path");
+ run_command("chown ceph:ceph -R $mondir") if $systemd;
+
};
my $err = $@;
unlink $monmap;
--
2.1.4
More information about the pve-devel
mailing list