diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-04-27 16:14:26 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-04-27 16:14:26 +0000 |
| commit | a2249f187caed7c97934cea6fce50ae5360bd0aa (patch) | |
| tree | f0a6bd93d6b373ae741d02913d935680ca0f4764 /nova/compute | |
| parent | 8972e9544dead61c198037f24eecf0f04558a914 (diff) | |
| parent | bd30eb36bbf2c5164ac47256355c543f6b77e064 (diff) | |
Merge "Add additional capabilities for computes"
Diffstat (limited to 'nova/compute')
| -rw-r--r-- | nova/compute/manager.py | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/nova/compute/manager.py b/nova/compute/manager.py index 0fe261948..0366b4568 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -124,7 +124,15 @@ compute_opts = [ cfg.IntOpt("heal_instance_info_cache_interval", default=60, help="Number of seconds between instance info_cache self " - "healing updates") + "healing updates"), + cfg.ListOpt('additional_compute_capabilities', + default=[], + help='a list of additional capabilities for this compute ' + 'host to advertise. Valid entries are name=value pairs ' + 'this functionality will be replaced when HostAggregates ' + 'become more funtional for general grouping in Folsom. (see: ' + 'http://etherpad.openstack.org/FolsomNovaHostAggregates-v2)'), + ] FLAGS = flags.FLAGS @@ -190,6 +198,21 @@ def _get_image_meta(context, image_ref): return image_service.show(context, image_id) +def _get_additional_capabilities(): + """Return additional capabilities to advertise for this compute host + This will be replaced once HostAggrgates are able to handle more general + host grouping for custom schedulers.""" + capabilities = {} + for cap in FLAGS.additional_compute_capabilities: + if '=' in cap: + name, value = cap.split('=', 1) + else: + name = cap + value = True + capabilities[name] = value + return capabilities + + class ComputeManager(manager.SchedulerDependentManager): """Manages the running instances from creation to destruction.""" @@ -2265,8 +2288,9 @@ class ComputeManager(manager.SchedulerDependentManager): LOG.info(_("Updating host status")) # This will grab info about the host and queue it # to be sent to the Schedulers. - self.update_service_capabilities( - self.driver.get_host_stats(refresh=True)) + capabilities = _get_additional_capabilities() + capabilities.update(self.driver.get_host_stats(refresh=True)) + self.update_service_capabilities(capabilities) @manager.periodic_task(ticks_between_runs=10) def _sync_power_states(self, context): |
