You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A number of the abstract APIs in 'nova.db.api' had a different function
signature to their concrete implementations in 'nova.db.sqlalchemy.api'.
Correct this. Functions changed include:
- action_get_by_request_id
- create_context_manager
- instance_add_security_group
- instance_extra_update_by_uuid
- instance_get_all_by_filters
- instance_remove_security_group
- migration_get
- migration_get_by_id_and_instance
- pci_device_update
- service_get_minimum_version
- virtual_interface_delete_by_instance
- virtual_interface_get_by_instance
- virtual_interface_get_by_instance_and_network
To do this, the following script was used:
>>> import nova.db.api as base_api
>>> import nova.db.sqlalchemy.api as sqla_api
>>> import collections
>>> import inspect
>>> for name in dir(base_api):
... fn_base = getattr(base_api, name)
... if not isinstance(fn_base, collections.Callable):
... continue
... fn_sqla = getattr(sqla_api, name, None)
... if not fn_sqla or not isinstance(fn_sqla, collections.Callable):
... print(f'missing function in nova.api.sqlalchemy.db: {name}')
... spec_base = inspect.getfullargspec(fn_base)
... spec_sqla = inspect.getfullargspec(fn_sqla)
... if spec_base != spec_sqla:
... print('mismatched function specs:')
... print(f'base: {spec_base}')
... print(f'sqla: {spec_sqla}')
... break
In order for *this* to work, it was necessary to update the many
decorators in 'nova.db.sqlalchemy.api' so that function signatures were
preserved. This is possible by setting the signature of the wrapper to
that of the wrapped function.
Change-Id: Icb97a8b4e17fdbb2146ddf2729c906757c664f66
Signed-off-by: Stephen Finucane <[email protected]>
0 commit comments