Default reservations=None in Cells v1 and conductor APIs

This is a preliminary change for the counting quotas series to make
any legacy quota "reservations" arguments default to None so that in
the next change, we can simply not pass any reservations instead of
passing empty reservations. Reservations are being deprecated as part
of the counting quotas series.

Part of blueprint cells-count-resources-to-check-quota-in-api

Change-Id: I86e56c1abd979ac9968a3ce7daad07530080bde4
This commit is contained in:
melanie witt 2017-07-13 20:50:08 +00:00
parent f9eea8869e
commit 26107d6009
4 changed files with 20 additions and 4 deletions

View File

@ -571,7 +571,7 @@ class CellsAPI(object):
cctxt.cast(ctxt, 'soft_delete_instance', instance=instance)
def resize_instance(self, ctxt, instance, extra_instance_updates,
scheduler_hint, flavor, reservations,
scheduler_hint, flavor, reservations=None,
clean_shutdown=True,
request_spec=None):
# NOTE(sbauza): Since Cells v1 is quite feature-frozen, we don't want
@ -606,12 +606,12 @@ class CellsAPI(object):
host_name=host_name)
def revert_resize(self, ctxt, instance, migration, host,
reservations):
reservations=None):
cctxt = self.client.prepare(version='1.21')
cctxt.cast(ctxt, 'revert_resize', instance=instance)
def confirm_resize(self, ctxt, instance, migration, host,
reservations, cast=True):
reservations=None, cast=True):
# NOTE(comstud): This is only used in the API cell where we should
# always cast and ignore the 'cast' kwarg.
# Also, the compute api method normally takes an optional

View File

@ -512,6 +512,8 @@ class ComputeAPI(object):
instance=instance,
data=data)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def confirm_resize(self, ctxt, instance, migration, host,
reservations=None, cast=True):
version = '4.0'
@ -541,6 +543,8 @@ class ComputeAPI(object):
cctxt.cast(ctxt, 'detach_volume',
instance=instance, volume_id=volume_id, **extra)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def finish_resize(self, ctxt, instance, migration, image, disk_info,
host, reservations=None):
version = '4.0'
@ -550,6 +554,8 @@ class ComputeAPI(object):
instance=instance, migration=migration,
image=image, disk_info=disk_info, reservations=reservations)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def finish_revert_resize(self, ctxt, instance, migration, host,
reservations=None):
version = '4.0'
@ -744,6 +750,8 @@ class ComputeAPI(object):
else:
return result
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def prep_resize(self, ctxt, instance, image, instance_type, host,
reservations=None, request_spec=None,
filter_properties=None, node=None,
@ -853,6 +861,8 @@ class ComputeAPI(object):
server=_compute_host(None, instance), version=version)
cctxt.cast(ctxt, 'reset_network', instance=instance)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def resize_instance(self, ctxt, instance, migration, image, instance_type,
reservations=None, clean_shutdown=True):
msg_args = {'instance': instance, 'migration': migration,
@ -990,6 +1000,8 @@ class ComputeAPI(object):
server=_compute_host(None, instance), version=version)
cctxt.cast(ctxt, 'suspend_instance', instance=instance)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def terminate_instance(self, ctxt, instance, bdms, reservations=None,
delete_type=None):
# NOTE(rajesht): The `delete_type` parameter is passed because
@ -1014,6 +1026,8 @@ class ComputeAPI(object):
server=_compute_host(None, instance), version=version)
cctxt.cast(ctxt, 'unrescue_instance', instance=instance)
# TODO(melwitt): Remove the reservations parameter in version 5.0 of the
# RPC API.
def soft_delete_instance(self, ctxt, instance, reservations=None):
version = '4.0'
cctxt = self.router.client(ctxt).prepare(

View File

@ -86,7 +86,7 @@ class ComputeTaskAPI(object):
self.conductor_compute_rpcapi = rpcapi.ComputeTaskAPI()
def resize_instance(self, context, instance, extra_instance_updates,
scheduler_hint, flavor, reservations,
scheduler_hint, flavor, reservations=None,
clean_shutdown=True, request_spec=None):
# NOTE(comstud): 'extra_instance_updates' is not used here but is
# needed for compatibility with the cells_rpcapi version of this

View File

@ -295,6 +295,8 @@ class ComputeTaskAPI(object):
cctxt = self.client.prepare(version=version)
cctxt.cast(context, 'live_migrate_instance', **kw)
# TODO(melwitt): Remove the reservations parameter in version 2.0 of the
# RPC API.
def migrate_server(self, context, instance, scheduler_hint, live, rebuild,
flavor, block_migration, disk_over_commit,
reservations=None, clean_shutdown=True, request_spec=None):