]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge PR #30882 into master
authorSage Weil <sage@redhat.com>
Wed, 23 Oct 2019 20:18:26 +0000 (15:18 -0500)
committerSage Weil <sage@redhat.com>
Wed, 23 Oct 2019 20:18:26 +0000 (15:18 -0500)
* refs/pull/30882/head:
ceph-daemon: deploy a logrotate.d config file for each cluster

Reviewed-by: Sebastian Wagner <swagner@suse.com>
1  2 
src/ceph-daemon

diff --cc src/ceph-daemon
index b7b25edc149a0189baba88e774f0c9032a167c4b,0fd9904127d71e41b4885510ea45de3d78b7bd9b..486d978e9ef69a1b6ba4c5a84d7f7eb411288ae8
@@@ -505,9 -398,34 +506,34 @@@ def install_base_units(fsid)
          os.rename(args.unit_dir + '/ceph-%s.target.new' % fsid,
                    args.unit_dir + '/ceph-%s.target' % fsid)
      if not existed:
 -        subprocess.check_output(['systemctl', 'enable', 'ceph-%s.target' % fsid])
 -        subprocess.check_output(['systemctl', 'start', 'ceph-%s.target' % fsid])
 +        call_throws(['systemctl', 'enable', 'ceph-%s.target' % fsid])
 +        call_throws(['systemctl', 'start', 'ceph-%s.target' % fsid])
  
+     # logrotate for the cluster
+     with open(args.logrotate_dir + '/ceph-%s' % fsid, 'w') as f:
+         """
+         This is a bit sloppy in that the killall/pkill will touch all ceph daemons
+         in all containers, but I don't see an elegant way to send SIGHUP *just* to
+         the daemons for this cluster.  (1) systemd kill -s will get the signal to
+         podman, but podman will exit.  (2) podman kill will get the signal to the
+         first child (bash), but that isn't the ceph daemon.  This is simpler and
+         should be harmless.
+         """
+         f.write("""# created by ceph-daemon
+ /var/log/ceph/%s/*.log {
+     rotate 7
+     daily
+     compress
+     sharedscripts
+     postrotate
+         killall -q -1 ceph-mon ceph-mgr ceph-mds ceph-osd ceph-fuse radosgw || pkill -1 -x "ceph-mon|ceph-mgr|ceph-mds|ceph-osd|ceph-fuse|radosgw" || true
+     endscript
+     missingok
+     notifempty
+     su root ceph
+ }
+ """ % fsid)
  def deploy_crash(fsid, uid, gid, config, keyring):
      crash_dir = os.path.join(args.data_dir, fsid, 'crash')
      makedirs(crash_dir, uid, gid, DATA_DIR_MODE)
@@@ -1302,20 -1152,22 +1327,22 @@@ def command_rm_cluster()
      # FIXME: stop + disable individual daemon units, too?
  
      # rm units
 -    subprocess.check_output(['rm', '-f', args.unit_dir +
 +    call_throws(['rm', '-f', args.unit_dir +
                               '/ceph-%s@.service' % args.fsid])
 -    subprocess.check_output(['rm', '-f', args.unit_dir +
 -                             '/ceph-%s-crash.service' % args.fsid])
 -    subprocess.check_output(['rm', '-f', args.unit_dir +
 +    call_throws(['rm', '-f', args.unit_dir +
 +                             '/ceph-%s-crash@.service' % args.fsid])
 +    call_throws(['rm', '-f', args.unit_dir +
                               '/ceph-%s.target' % args.fsid])
 -    subprocess.check_output(['rm', '-rf',
 +    call_throws(['rm', '-rf',
                    args.unit_dir + '/ceph-%s.target.wants' % args.fsid])
      # rm data
 -    subprocess.check_output(['rm', '-rf', args.data_dir + '/' + args.fsid])
 +    call_throws(['rm', '-rf', args.data_dir + '/' + args.fsid])
      # rm logs
 -    subprocess.check_output(['rm', '-rf', args.log_dir + '/' + args.fsid])
 -    subprocess.check_output(['rm', '-rf', args.log_dir +
 +    call_throws(['rm', '-rf', args.log_dir + '/' + args.fsid])
 +    call_throws(['rm', '-rf', args.log_dir +
                               '/*.wants/ceph-%s@*' % args.fsid])
+     # rm logrotate config
+     call_throws(['rm', '-f', args.logrotate_dir + '/ceph-%s' % args.fsid])
  
  
  ##################################