[pve-devel] [PATCH V2 pve-manager 3/3] Now pveceph can also createmon with Infernalis and Hammer.
Wolfgang Link
w.link at proxmox.com
Tue Jun 7 13:24:07 CEST 2016
Ceph changed user name from root to ceph.
And for startup systemd is used instead of sysvinit.
---
PVE/API2/Ceph.pm | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/PVE/API2/Ceph.pm b/PVE/API2/Ceph.pm
index 58e5b35..4f85860 100644
--- a/PVE/API2/Ceph.pm
+++ b/PVE/API2/Ceph.pm
@@ -841,6 +841,8 @@ __PACKAGE__->register_method ({
my $monaddrhash = {};
+ my $systemd_managed = PVE::CephTools::systemd_managed();
+
foreach my $section (keys %$cfg) {
next if $section eq 'global';
my $d = $cfg->{$section};
@@ -893,8 +895,12 @@ __PACKAGE__->register_method ({
"--cap mds 'allow' " .
"--cap osd 'allow *' " .
"--cap mon 'allow *'");
+
+ run_command("cp $pve_mon_key_path.tmp /etc/ceph/ceph.client.admin.keyring") if $systemd_managed;
+ run_command("chown ceph:ceph /etc/ceph/ceph.client.admin.keyring") if $systemd_managed;
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");
+
}
my $ccname = PVE::CephTools::get_config('ccname');
@@ -906,6 +912,7 @@ __PACKAGE__->register_method ({
eval {
mkdir $mondir;
+ run_command("chown ceph:ceph $mondir") if $systemd_managed;
if ($moncount > 0) {
my $rados = PVE::RADOS->new(timeout => PVE::CephTools::get_config('long_rados_timeout'));
@@ -916,6 +923,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_managed;
+
};
my $err = $@;
unlink $monmap;
--
2.1.4
More information about the pve-devel
mailing list