From 269bad54b6a94b01b2835707c75038d560f59cb8 Mon Sep 17 00:00:00 2001 From: Vishvananda Ishaya Date: Mon, 27 Aug 2012 11:14:37 -0700 Subject: Fixes backwards compatible rpc schedule_run Commit 8718f8e47d7d0504724495538eb320be3e209180 changed the schedule_run_instance call to create all of the db records on the compute host, but the old code path was left in for backwards compatibility. Unfortunately an extra reservations parameter was left in causing the backwards compatibility to be broken. This patch takes out the reservations parameter and commits the reservation in the backwards compatible call. Fixes bug 1042302 Change-Id: I1e710d1e9a992f59a18eeedcd7d71726ff96c485 --- nova/scheduler/driver.py | 5 ++++- nova/tests/scheduler/test_scheduler.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py index 7522ec6bf..42e05e903 100644 --- a/nova/scheduler/driver.py +++ b/nova/scheduler/driver.py @@ -34,6 +34,7 @@ from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import rpc from nova.openstack.common import timeutils +from nova import quota from nova import utils @@ -173,7 +174,9 @@ class Scheduler(object): instance = self.compute_api.create_db_entry_for_new_instance( context, instance_type, image, base_options, - security_group, block_device_mapping, reservations) + security_group, block_device_mapping) + if reservations: + quota.QUOTAS.commit(context, reservations) # NOTE(comstud): This needs to be set for the generic exception # checking in scheduler manager, so that it'll set this instance # to ERROR properly. diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index d5e86fe1b..9d771a37e 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -368,7 +368,7 @@ class SchedulerTestCase(test.TestCase): self.driver.compute_api.create_db_entry_for_new_instance( self.context, instance_type, image, base_options, security_group, - block_device_mapping, None).AndReturn(fake_instance) + block_device_mapping).AndReturn(fake_instance) self.mox.ReplayAll() instance = self.driver.create_instance_db_entry(self.context, request_spec, None) -- cgit