summaryrefslogtreecommitdiffstats
path: root/nova/scheduler/driver.py
diff options
context:
space:
mode:
authorHans Lindgren <hanlind@kth.se>2013-04-11 11:33:38 +0200
committerHans Lindgren <hanlind@kth.se>2013-04-11 12:03:53 +0200
commit5f68160354d240b191bcbaabca7d3c0684758cc6 (patch)
treeb55b4b88d1c6fc534c98de391472a1204613841b /nova/scheduler/driver.py
parent05f5106c198a596f22adadab1ddf6929ab9c247a (diff)
downloadnova-5f68160354d240b191bcbaabca7d3c0684758cc6.tar.gz
nova-5f68160354d240b191bcbaabca7d3c0684758cc6.tar.xz
nova-5f68160354d240b191bcbaabca7d3c0684758cc6.zip
Remove unnecessary db call in scheduler driver live-migration code
When the scheduler selects a destination host for live-migration, a db call is made to get instance_type info for the instance. To avoid the db call, this should instead call instance_types.extract_instance_type on the instance. Resolves bug 1167811. Change-Id: I2025fdf1d34e70158360ff71e8545c8e3bc6bc80
Diffstat (limited to 'nova/scheduler/driver.py')
-rw-r--r--nova/scheduler/driver.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py
index 3426c484c..44960a856 100644
--- a/nova/scheduler/driver.py
+++ b/nova/scheduler/driver.py
@@ -25,6 +25,7 @@ import sys
from oslo.config import cfg
+from nova.compute import instance_types
from nova.compute import power_state
from nova.compute import rpcapi as compute_rpcapi
from nova.compute import utils as compute_utils
@@ -256,8 +257,7 @@ class Scheduler(object):
# If dest is not specified, have scheduler pick one.
if dest is None:
- instance_type = db.instance_type_get(
- context, instance_ref['instance_type_id'])
+ instance_type = instance_types.extract_instance_type(instance_ref)
image = self.image_service.show(context, instance_ref['image_ref'])
request_spec = {'instance_properties': instance_ref,
'instance_type': instance_type,