Merge lp:~freyes/charms/trusty/hacluster/lp1444361 into lp:~openstack-charmers/charms/trusty/hacluster/next

Proposed by Felipe Reyes
Status: Superseded
Proposed branch: lp:~freyes/charms/trusty/hacluster/lp1444361
Merge into: lp:~openstack-charmers/charms/trusty/hacluster/next
Diff against target: 107 lines (+72/-2)
3 files modified
config.yaml (+13/-0)
hooks/hooks.py (+16/-2)
unit_tests/test_hacluster_hooks.py (+43/-0)
To merge this branch: bzr merge lp:~freyes/charms/trusty/hacluster/lp1444361
Reviewer Review Type Date Requested Status
Billy Olsen Disapprove
Jorge Niedbalski (community) Needs Information
OpenStack Charmers Pending
Review via email: mp+256272@code.launchpad.net

Description of the change

Dear OpenStack Charmers,

This patch exposes the default resource stickiness as a configuration option, this will allow to tweak the cluster depending on the resources are being deployed. Some resources are more expensive to migrate or have bigger impact on the system, so having the option to tweak those is necessary.

Best Regards,

To post a comment you must log in.
Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_lint_check #3382 hacluster-next for freyes mp256272
    LINT OK: passed

Build: http://10.245.162.77:8080/job/charm_lint_check/3382/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_unit_test #3170 hacluster-next for freyes mp256272
    UNIT OK: passed

Build: http://10.245.162.77:8080/job/charm_unit_test/3170/

Revision history for this message
uosci-testing-bot (uosci-testing-bot) wrote :

charm_amulet_test #3163 hacluster-next for freyes mp256272
    AMULET FAIL: amulet-test missing

AMULET Results (max last 2 lines):
INFO:root:Search string not found in makefile target commands.
ERROR:root:No make target was executed.

Full amulet test output: http://paste.ubuntu.com/10825848/
Build: http://10.245.162.77:8080/job/charm_amulet_test/3163/

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

Looks good to me, overall. Minor README clarifications.

review: Needs Information
Revision history for this message
Billy Olsen (billy-olsen) wrote :

Felipe, as always, thanks for the submission!

I think this is great as we can set the default resource stickiness. As we discussed, pacemaker accepts the string values of INFINITY and -INFINITY when defining resource weights. I think we should consider using a string instead of an int (preferred), or clearly documenting how the concepts of INFINITY and -INFINITY can be supplied via integer values.

As I think about this more, it is the service charms themselves [keystone, mysql, etc, etc] that define the pacemaker resources. These services should theoretically know about the resource stickiness values for the various resources which are being monitored via pacemaker and therefore it should be up to that service to help define the resource stickiness. Allowing the user to configure the default resource stickiness could actually interfere with what the service knows to be best. Rather than set it for the resources as the default - your cases such as the single nova console auth needs to be able to specify the resource-stickiness on the resource creation.

I think the best place is to do it on the services where the resources are defined and not the default. We can discuss more if you like, but for now I'm -1 on this due to the ability to interfere with the 'best decisions of the charms'.

review: Disapprove
Revision history for this message
Billy Olsen (billy-olsen) wrote :

I recognize my last comment may be mildly confusing (sorry). I wrote the first paragraph whilst doing an initial scan of the code but apparently didn't save the comment.

My current stance starts with the 'As I think about this more...' part in which I feel that the services defining the resources know better what the stickiness values should be.

Revision history for this message
Felipe Reyes (freyes) wrote :

Billy,

I agree with you that the charm (keystone, percona, etc..) knows better which value is better for each pacemaker resource, but here we are talking about the *default* resource stickiness, which is global to the cluster itself, charms still can override this during the creation of a resource.

The only thing this patch does is "let's remove the hardcoded value (100) and leave it as a config option".

At a later step we can extend each charm to expose an option to tweak each resource stickiness value (today they rely in the default), this will allow a more granular configuration or fine-tunning(tm) :)

Best,

46. By Felipe Reyes

Change type to string and accept INFINITY as a valid value

Unmerged revisions

46. By Felipe Reyes

Change type to string and accept INFINITY as a valid value

45. By Felipe Reyes

Expose default resource stickiness as a config option

Fixed LP #1444361

44. By Edward Hope-Morley

[gnuoy,r=hopem]

Allow corosync.conf netmtu to be set regardless of inet
mode (ipv4/ipv6).

43. By Billy Olsen

[freyes,r=wolsen,niedbalski]

Check the output of 'crm resource status' to determine if service is running

Fixes-Bug: #1433377

42. By James Page

[freyes,r=james-page]

Add support for location configuration

Tidy logging.

41. By Liam Young

Fix charm-helpers.yaml and charmhelper sync

40. By Edward Hope-Morley

[hopem,r=niedbalski,tinoco,wolsen]

Don't upgrade pacemaker packages. This restriction
can be removed once 1382842 is fixed but for the
moment we can't allow upgrades due to issues with
pacemaker dependencies.

Closes-Bug: 1382842

39. By Edward Hope-Morley

[freyes,r=hopem]

Add debug option to config.yaml and optionally enable
debug logging in corosync.conf

38. By James Page

Merge in bundle tests from master charm

37. By Edward Hope-Morley

[wolsen,r=hopem]

Specify the vote count for multicast quorum to be the number of nodes
which are configured. Additionally, specify the two_node value in the
quorum section when there are 2 nodes configured.

Closes-Bug: 1394008

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 2015-04-14 10:16:50 +0000
3+++ config.yaml 2015-04-16 07:50:01 +0000
4@@ -97,3 +97,16 @@
5 default: False
6 type: boolean
7 description: Enable debug logging
8+ default-resource-stickiness:
9+ type: string
10+ default: '100'
11+ description: |
12+ Controls the number of seconds before considering to migrate again the
13+ resource. This value is expressed in seconds and can go from 0 to 1000000
14+ (INFINITY)
15+ .
16+ In some circumstances, it is highly desirable to prevent healthy
17+ resources from being moved around the cluster. Moving resources almost
18+ always requires a period of downtime.
19+ .
20+ More info at http://clusterlabs.org/doc/en-US/Pacemaker/1.1-plugin/html/Clusters_from_Scratch/ch05s03s02.html
21
22=== modified file 'hooks/hooks.py'
23--- hooks/hooks.py 2015-04-14 10:16:50 +0000
24+++ hooks/hooks.py 2015-04-16 07:50:01 +0000
25@@ -70,6 +70,7 @@
26
27 PACKAGES = ['corosync', 'pacemaker', 'python-netaddr', 'ipmitool']
28 SUPPORTED_TRANSPORTS = ['udp', 'udpu', 'multicast', 'unicast']
29+INFINITY = 1000000
30
31
32 @hooks.hook()
33@@ -293,8 +294,21 @@
34 cmd = "crm configure property no-quorum-policy=ignore"
35 pcmk.commit(cmd)
36
37- cmd = 'crm configure rsc_defaults $id="rsc-options"' \
38- ' resource-stickiness="100"'
39+ stickiness = config('default-resource-stickiness')
40+ try:
41+ stickiness = int(stickiness)
42+
43+ if stickiness < 0 or stickiness >= INFINITY:
44+ stickiness = 'INFINITY'
45+ except ValueError:
46+ stickiness = stickiness.strip().upper()
47+ if stickiness != 'INFINITY':
48+ log(("Value '%s' isn't valid for resource stickiness, using "
49+ "default" % config('default-resource-stickiness')))
50+ stickiness = 100
51+
52+ cmd = ('crm configure rsc_defaults $id="rsc-options"'
53+ ' resource-stickiness="%s"' % stickiness)
54 pcmk.commit(cmd)
55
56
57
58=== modified file 'unit_tests/test_hacluster_hooks.py'
59--- unit_tests/test_hacluster_hooks.py 2015-03-06 14:58:15 +0000
60+++ unit_tests/test_hacluster_hooks.py 2015-04-16 07:50:01 +0000
61@@ -173,3 +173,46 @@
62 else:
63 commit.assert_any_call(
64 'crm -w -F configure %s %s %s' % (kw, name, params))
65+
66+ @mock.patch('pcmk.commit')
67+ @mock.patch('hooks.config')
68+ def test_configure_cluster_global(self, config, commit):
69+ cfg = {'debug': False,
70+ 'prefer-ipv6': False,
71+ 'corosync_transport': 'udpu',
72+ 'corosync_mcastaddr': 'corosync_mcastaddr',
73+ 'cluster_count': 3,
74+ 'default-resource-stickiness': '101'}
75+
76+ def c(k):
77+ return cfg.get(k)
78+
79+ config.side_effect = c
80+
81+ # check a value different from default
82+ hacluster_hooks.configure_cluster_global()
83+
84+ commit.assert_any_call("crm configure property no-quorum-policy=stop")
85+ commit.assert_any_call(('crm configure rsc_defaults $id="rsc-options"'
86+ ' resource-stickiness="101"'))
87+ commit.reset_mock()
88+
89+ # setting it to infinity
90+ cfg['default-resource-stickiness'] = 'infinity '
91+ hacluster_hooks.configure_cluster_global()
92+ commit.assert_any_call(('crm configure rsc_defaults $id="rsc-options"'
93+ ' resource-stickiness="INFINITY"'))
94+ commit.reset_mock()
95+
96+ # a value bigger than 1000000 is inifity
97+ cfg['default-resource-stickiness'] = '100000000'
98+ hacluster_hooks.configure_cluster_global()
99+ commit.assert_any_call(('crm configure rsc_defaults $id="rsc-options"'
100+ ' resource-stickiness="INFINITY"'))
101+ commit.reset_mock()
102+
103+ # check invalid value and to make it fallback to default value
104+ cfg['default-resource-stickiness'] = 'sdflkm4l'
105+ hacluster_hooks.configure_cluster_global()
106+ commit.assert_any_call(('crm configure rsc_defaults $id="rsc-options"'
107+ ' resource-stickiness="100"'))

Subscribers

People subscribed via source and target branches