Merge lp:~niedbalski/charms/trusty/ceph/sysctl-update into lp:~openstack-charmers-archive/charms/trusty/ceph/next

Proposed by Jorge Niedbalski
Status: Superseded
Proposed branch: lp:~niedbalski/charms/trusty/ceph/sysctl-update
Merge into: lp:~openstack-charmers-archive/charms/trusty/ceph/next
Diff against target: 83 lines (+51/-1) (has conflicts)
3 files modified
config.yaml (+7/-1)
hooks/charmhelpers/core/sysctl.py (+34/-0)
hooks/hooks.py (+10/-0)
Conflict adding file hooks/charmhelpers/core/sysctl.py.  Moved existing file to hooks/charmhelpers/core/sysctl.py.moved.
Text conflict in hooks/hooks.py
To merge this branch: bzr merge lp:~niedbalski/charms/trusty/ceph/sysctl-update
Reviewer Review Type Date Requested Status
Corey Bryant (community) Approve
OpenStack Charmers Pending
Edward Hope-Morley Pending
Review via email: mp+237379@code.launchpad.net

This proposal supersedes a proposal from 2014-09-23.

This proposal has been superseded by a proposal from 2014-11-20.

Description of the change

- Added a sysctl configuration option for passing ceph specific
runtime flags.
       - Modified config.yaml to expose this option, by default is ""
       - Modified utils.py to add the update_sysctl function

To post a comment you must log in.
Revision history for this message
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal

Few nits inline, othwerwise looks ok.

review: Needs Fixing
Revision history for this message
Edward Hope-Morley (hopem) : Posted in a previous version of this proposal
Revision history for this message
Corey Bryant (corey.bryant) wrote : Posted in a previous version of this proposal

Tested and works good for me. I do have a few comments inline though.

review: Needs Fixing
Revision history for this message
Corey Bryant (corey.bryant) wrote : Posted in a previous version of this proposal

2 more nits from my end. After that I'll approve.

Revision history for this message
Corey Bryant (corey.bryant) : Posted in a previous version of this proposal
review: Needs Fixing
Revision history for this message
Corey Bryant (corey.bryant) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal

LGTM

review: Approve
Revision history for this message
Edward Hope-Morley (hopem) wrote : Posted in a previous version of this proposal

@niedbalski this patch will also need to land in the ceph osd charm. Ceph hosts that acting as scale-out for OSDs will not necessarily have the ceph charm installed. The update_sysctl() function should therefore go to charm-helpers.

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Hey Jorge, Looks good and is basically the same code I tested prior to the shift to charm-helpers.

review: Approve
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

> Hey Jorge, Looks good and is basically the same code I tested prior to the
> shift to charm-helpers.

Thanks Corey. Could you also review https://code.launchpad.net/~niedbalski/charms/trusty/ceph-osd/sysctl-param/+merge/237381 ?

Revision history for this message
Corey Bryant (corey.bryant) wrote :

> > Hey Jorge, Looks good and is basically the same code I tested prior to the
> > shift to charm-helpers.
>
> Thanks Corey. Could you also review
> https://code.launchpad.net/~niedbalski/charms/trusty/ceph-osd/sysctl-
> param/+merge/237381 ?

No problem Jorge. Done.

Revision history for this message
James Page (james-page) wrote :

See comments re sane default in ceph-osd review - can we do something better than providing a tuning knob?

Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

Hello @jamespage

Any chance to get this merged?

87. By Jorge Niedbalski

[config] removed empty string from sysctl config param

88. By Jorge Niedbalski

[all] sync charmhelpers

89. By Jorge Niedbalski

[all] sync charmhelpers

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'config.yaml'
2--- config.yaml 2014-10-06 22:07:41 +0000
3+++ config.yaml 2014-11-20 21:25:15 +0000
4@@ -154,4 +154,10 @@
5 NOTE: these charms do not currently support IPv6 privacy extension. In
6 order for this charm to function correctly, the privacy extension must be
7 disabled and a non-temporary address must be configured/available on
8- your network interface.
9+ your network interface.
10+ sysctl:
11+ type: string
12+ default:
13+ description: |
14+ YAML formatted associative array of sysctl values, e.g.:
15+ '{ kernel.pid_max : 4194303 }'
16
17=== added file 'hooks/charmhelpers/core/sysctl.py'
18--- hooks/charmhelpers/core/sysctl.py 1970-01-01 00:00:00 +0000
19+++ hooks/charmhelpers/core/sysctl.py 2014-11-20 21:25:15 +0000
20@@ -0,0 +1,34 @@
21+#!/usr/bin/env python
22+# -*- coding: utf-8 -*-
23+
24+__author__ = 'Jorge Niedbalski R. <jorge.niedbalski@canonical.com>'
25+
26+import yaml
27+
28+from subprocess import check_call
29+
30+from charmhelpers.core.hookenv import (
31+ log,
32+ DEBUG,
33+)
34+
35+
36+def create(sysctl_dict, sysctl_file):
37+ """Creates a sysctl.conf file from a YAML associative array
38+
39+ :param sysctl_dict: a dict of sysctl options eg { 'kernel.max_pid': 1337 }
40+ :type sysctl_dict: dict
41+ :param sysctl_file: path to the sysctl file to be saved
42+ :type sysctl_file: str or unicode
43+ :returns: None
44+ """
45+ sysctl_dict = yaml.load(sysctl_dict)
46+
47+ with open(sysctl_file, "w") as fd:
48+ for key, value in sysctl_dict.items():
49+ fd.write("{}={}\n".format(key, value))
50+
51+ log("Updating sysctl_file: %s values: %s" % (sysctl_file, sysctl_dict),
52+ level=DEBUG)
53+
54+ check_call(["sysctl", "-p", sysctl_file])
55
56=== renamed file 'hooks/charmhelpers/core/sysctl.py' => 'hooks/charmhelpers/core/sysctl.py.moved'
57=== modified file 'hooks/hooks.py'
58--- hooks/hooks.py 2014-11-19 21:33:12 +0000
59+++ hooks/hooks.py 2014-11-20 21:25:15 +0000
60@@ -45,6 +45,12 @@
61 get_ipv6_addr,
62 format_ipv6_addr
63 )
64+<<<<<<< TREE
65+=======
66+
67+from charmhelpers.core.sysctl import create as create_sysctl
68+
69+>>>>>>> MERGE-SOURCE
70 from utils import (
71 render_template,
72 get_public_addr,
73@@ -122,6 +128,10 @@
74 log('Invalid OSD disk format configuration specified', level=ERROR)
75 sys.exit(1)
76
77+ sysctl_dict = config('sysctl')
78+ if sysctl_dict:
79+ create_sysctl(sysctl_dict, '/etc/sysctl.d/50-ceph-charm.conf')
80+
81 emit_cephconf()
82
83 e_mountpoint = config('ephemeral-unmount')

Subscribers

People subscribed via source and target branches