diff --git a/config.yaml b/config.yaml index 7284030a..9b78a4f2 100644 --- a/config.yaml +++ b/config.yaml @@ -239,3 +239,11 @@ options: . Increasing this value will increase instance density on compute nodes at the expense of instance performance. + ram-allocation-ratio: + type: float + default: 1.5 + description: | + The physical ram -> virtual ram ratio to use in the Nova scheduler. + . + Increasing this value will increase instance density on compute nodes + at the potential expense of instance performance. diff --git a/hooks/nova_cc_context.py b/hooks/nova_cc_context.py index 2bf9cda0..599e9967 100644 --- a/hooks/nova_cc_context.py +++ b/hooks/nova_cc_context.py @@ -269,6 +269,7 @@ class NovaConfigContext(WorkerConfigContext): def __call__(self): ctxt = super(NovaConfigContext, self).__call__() ctxt['cpu_allocation_ratio'] = config('cpu-allocation-ratio') + ctxt['ram_allocation_ratio'] = config('ram-allocation-ratio') return ctxt diff --git a/hooks/nova_cc_hooks.py b/hooks/nova_cc_hooks.py index f874e91a..85dff31a 100755 --- a/hooks/nova_cc_hooks.py +++ b/hooks/nova_cc_hooks.py @@ -566,7 +566,7 @@ def cluster_changed(): relation_settings={'private-address': addr}) CONFIGS.write_all() - if is_relation_made('cluster'): + if relation_ids('cluster'): peer_echo(includes='dbsync_state') dbsync_state = peer_retrieve('dbsync_state') if dbsync_state == 'complete': diff --git a/hooks/nova_cc_utils.py b/hooks/nova_cc_utils.py index 714ab8e4..a3ec6f64 100644 --- a/hooks/nova_cc_utils.py +++ b/hooks/nova_cc_utils.py @@ -555,7 +555,7 @@ def migrate_database(): log('Migrating the nova database.', level=INFO) cmd = ['nova-manage', 'db', 'sync'] subprocess.check_output(cmd) - if is_relation_made('cluster'): + if relation_ids('cluster'): log('Informing peers that dbsync is complete', level=INFO) peer_store('dbsync_state', 'complete') log('Enabling services', level=INFO) diff --git a/templates/icehouse/nova.conf b/templates/icehouse/nova.conf index a7c21ab5..a601a3d0 100644 --- a/templates/icehouse/nova.conf +++ b/templates/icehouse/nova.conf @@ -33,6 +33,7 @@ ec2_workers = {{ workers }} scheduler_default_filters = RetryFilter,AvailabilityZoneFilter,CoreFilter,RamFilter,ComputeFilter,ComputeCapabilitiesFilter,ImagePropertiesFilter,ServerGroupAntiAffinityFilter,ServerGroupAffinityFilter cpu_allocation_ratio = {{ cpu_allocation_ratio }} +ram_allocation_ratio = {{ ram_allocation_ratio }} use_syslog={{ use_syslog }} diff --git a/unit_tests/test_nova_cc_utils.py b/unit_tests/test_nova_cc_utils.py index 128a37a8..914502fd 100644 --- a/unit_tests/test_nova_cc_utils.py +++ b/unit_tests/test_nova_cc_utils.py @@ -594,7 +594,7 @@ class NovaCCUtilsTests(CharmTestCase): @patch('subprocess.check_output') def test_migrate_database(self, check_output): "Migrate database with nova-manage" - self.is_relation_made.return_value = False + self.relation_ids.return_value = [] utils.migrate_database() check_output.assert_called_with(['nova-manage', 'db', 'sync']) self.enable_services.assert_called() @@ -603,7 +603,7 @@ class NovaCCUtilsTests(CharmTestCase): @patch('subprocess.check_output') def test_migrate_database_cluster(self, check_output): "Migrate database with nova-manage in a clustered env" - self.is_relation_made.return_value = True + self.relation_ids.return_value = ['cluster:1'] utils.migrate_database() check_output.assert_called_with(['nova-manage', 'db', 'sync']) self.peer_store.assert_called_with('dbsync_state', 'complete')