Update quota when deleting volume that failed to be scheduled
If one volume was failed to get scheduled, removing such volume should also clean up reservation. Also when create_volume is ready to send to scheduler, reservation should be committed no matter backend can successfully create that volume or not since deleting volume call will do a minus reservation even on volume with 'error' status. This change updates RPC API to version 2.2 Fix bug 1052052 Change-Id: Ia632a0e49318d534f0acbd3df5c9f6bb86eefa2a
This commit is contained in:

committed by
Russell Bryant

parent
0ac9f6d15c
commit
dbb3954285
@@ -45,6 +45,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
|
||||
2.0 - Remove 1.x backwards compat
|
||||
2.1 - Add image_id to create_volume()
|
||||
2.2 - Remove reservations argument to create_volume()
|
||||
'''
|
||||
|
||||
#
|
||||
@@ -94,13 +95,12 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy):
|
||||
disk_over_commit=disk_over_commit, instance=instance_p,
|
||||
dest=dest))
|
||||
|
||||
def create_volume(self, ctxt, volume_id, snapshot_id, image_id,
|
||||
reservations):
|
||||
def create_volume(self, ctxt, volume_id, snapshot_id, image_id):
|
||||
self.cast(ctxt,
|
||||
self.make_msg('create_volume',
|
||||
volume_id=volume_id, snapshot_id=snapshot_id,
|
||||
image_id=image_id, reservations=reservations),
|
||||
version='2.1')
|
||||
image_id=image_id),
|
||||
version='2.2')
|
||||
|
||||
def update_service_capabilities(self, ctxt, service_name, host,
|
||||
capabilities):
|
||||
|
@@ -56,8 +56,8 @@ class SimpleScheduler(chance.ChanceScheduler):
|
||||
request_spec, admin_password, injected_files,
|
||||
requested_networks, is_first_time, filter_properties)
|
||||
|
||||
def schedule_create_volume(self, context, volume_id, snapshot_id, image_id,
|
||||
reservations):
|
||||
def schedule_create_volume(self, context, volume_id, snapshot_id,
|
||||
image_id):
|
||||
"""Picks a host that is up and has the fewest volumes."""
|
||||
deprecated.warn(_('nova-volume functionality is deprecated in Folsom '
|
||||
'and will be removed in Grizzly. Volumes are now handled '
|
||||
@@ -76,7 +76,7 @@ class SimpleScheduler(chance.ChanceScheduler):
|
||||
raise exception.WillNotSchedule(host=host)
|
||||
driver.cast_to_volume_host(context, host, 'create_volume',
|
||||
volume_id=volume_id, snapshot_id=snapshot_id,
|
||||
image_id=image_id, reservations=reservations)
|
||||
image_id=image_id)
|
||||
return None
|
||||
|
||||
results = db.service_get_all_volume_sorted(elevated)
|
||||
@@ -91,8 +91,7 @@ class SimpleScheduler(chance.ChanceScheduler):
|
||||
if utils.service_is_up(service) and not service['disabled']:
|
||||
driver.cast_to_volume_host(context, service['host'],
|
||||
'create_volume', volume_id=volume_id,
|
||||
snapshot_id=snapshot_id, image_id=image_id,
|
||||
reservations=reservations)
|
||||
snapshot_id=snapshot_id, image_id=image_id)
|
||||
return None
|
||||
msg = _("Is the appropriate service running?")
|
||||
raise exception.NoValidHost(reason=msg)
|
||||
|
@@ -95,4 +95,4 @@ class SchedulerRpcAPITestCase(test.TestCase):
|
||||
self._test_scheduler_api('create_volume',
|
||||
rpc_method='cast', volume_id="fake_volume",
|
||||
snapshot_id="fake_snapshots", image_id="fake_image",
|
||||
reservations=list('fake_res'), version='2.1')
|
||||
version='2.2')
|
||||
|
Reference in New Issue
Block a user