summaryrefslogtreecommitdiffstats
path: root/nova/scheduler/driver.py
diff options
context:
space:
mode:
authorGary Kotton <gkotton@redhat.com>2013-02-03 11:01:44 +0000
committerGary Kotton <gkotton@redhat.com>2013-02-08 03:16:44 +0000
commit4cbf1f379c66397e48d3299281c691b405f97965 (patch)
tree77264d6ee12decbb1e122f0e94ca4018913156c7 /nova/scheduler/driver.py
parent64106c282f961d65ca469524016635c96596b77f (diff)
downloadnova-4cbf1f379c66397e48d3299281c691b405f97965.tar.gz
nova-4cbf1f379c66397e48d3299281c691b405f97965.tar.xz
nova-4cbf1f379c66397e48d3299281c691b405f97965.zip
Support for scheduler hints for VM groups
This is part of the blueprint vm-ensembles. The patch introduces the group as a scheduler hint. The patch set adds group support for multi-VM deployment. This is achieved as follows: 1. A new hint is added: group. This will contain the name and type for the group. At the moment only anti-affinity is supported. In the future we will add network proximity. It will be extended to <name>:<type> 2. In order to ensure that group policy will be honored for future VM deployments, the group is stored as system_metadata. 3. The anti affinity is implemented by a new filter called GroupAntiAffinityFilter. DocImpact Change-Id: I6ea2af5770b5ac4ff082b2a021d323ee38282205
Diffstat (limited to 'nova/scheduler/driver.py')
-rw-r--r--nova/scheduler/driver.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py
index 226e31bba..4ad548798 100644
--- a/nova/scheduler/driver.py
+++ b/nova/scheduler/driver.py
@@ -82,13 +82,16 @@ def handle_schedule_error(context, ex, instance_uuid, request_spec):
'scheduler.run_instance', notifier.ERROR, payload)
-def instance_update_db(context, instance_uuid):
+def instance_update_db(context, instance_uuid, extra_values=None):
'''Clear the host and node - set the scheduled_at field of an Instance.
:returns: An Instance with the updated fields set properly.
'''
now = timeutils.utcnow()
values = {'host': None, 'node': None, 'scheduled_at': now}
+ if extra_values:
+ values.update(extra_values)
+
return db.instance_update(context, instance_uuid, values)
@@ -132,6 +135,16 @@ class Scheduler(object):
for service in services
if self.servicegroup_api.service_is_up(service)]
+ def group_hosts(self, context, group):
+ """Return the list of hosts that have VM's from the group."""
+
+ # The system_metadata 'group' will be filtered
+ members = db.instance_get_all_by_filters(context,
+ {'deleted': False, 'group': group})
+ return [member['host']
+ for member in members
+ if member.get('host') is not None]
+
def schedule_prep_resize(self, context, image, request_spec,
filter_properties, instance, instance_type,
reservations):