Merge "Add ceph-pool-weight option for calculating pgs"

This commit is contained in:
Jenkins 2016-07-14 20:21:11 +00:00 committed by Gerrit Code Review
commit c8cd75ba92
4 changed files with 28 additions and 1 deletions

1
.gitignore vendored
View File

@ -10,3 +10,4 @@ xenial/
precise/
tests/cirros-*-disk.img
.unit-state.db
.idea

View File

@ -268,6 +268,21 @@ options:
rbd pool has been created, changing this value will not have any
effect (although it can be changed in ceph by manually configuring
your ceph cluster).
ceph-pool-weight:
type: int
default: 30
description: |
Defines a relative weighting of the pool as a percentage of the total
amount of data in the Ceph cluster. This effectively weights the number
of placement groups for the pool created to be appropriately portioned
to the amount of data expected. For example, if the ephemeral volumes
for the OpenStack compute instances are expected to take up 20% of the
overall configuration then this value would be specified as 20. Note -
it is important to choose an appropriate value for the pool weight as
this directly affects the number of placement groups which will be
created for the pool. The number of placement groups for a pool can
only be increased, never decreased - so it is important to identify the
percent of data that will likely reside in the pool.
# Other configuration options
sysctl:
type: string

View File

@ -332,8 +332,10 @@ def ceph_joined():
def get_ceph_request():
rq = CephBrokerRq()
name = config('rbd-pool')
replicas = config('ceph-osd-replication-count')
rq.add_op_create_pool(name=config('rbd-pool'), replica_count=replicas)
weight = config('ceph-pool-weight')
rq.add_op_create_pool(name=name, replica_count=replicas, weight=weight)
return rq

View File

@ -500,6 +500,15 @@ class NovaComputeRelationsTests(CharmTestCase):
self.assertEquals(ex, configs.write.call_args_list)
self.service_restart.assert_called_with('nova-compute')
@patch('charmhelpers.contrib.storage.linux.ceph.CephBrokerRq'
'.add_op_create_pool')
def test_get_ceph_request(self, mock_add_op):
self.test_config.set('rbd-pool', 'nova')
self.test_config.set('ceph-osd-replication-count', 3)
self.test_config.set('ceph-pool-weight', 28)
hooks.get_ceph_request()
mock_add_op.assert_called_with(name='nova', replica_count=3, weight=28)
@patch.object(hooks, 'CONFIGS')
def test_neutron_plugin_changed(self, configs):
self.nova_metadata_requirement.return_value = (True,