@@ -174,6 +174,7 @@ def require_context(f):
174
174
def wrapper (* args , ** kwargs ):
175
175
nova .context .require_context (args [0 ])
176
176
return f (* args , ** kwargs )
177
+ wrapper .__signature__ = inspect .signature (f )
177
178
return wrapper
178
179
179
180
@@ -202,6 +203,7 @@ def wrapper(*args, **kwargs):
202
203
203
204
with reader_mode .using (context ):
204
205
return f (* args , ** kwargs )
206
+ wrapper .__signature__ = inspect .signature (f )
205
207
return wrapper
206
208
207
209
@@ -213,11 +215,12 @@ def pick_context_manager_writer(f):
213
215
Wrapped function must have a RequestContext in the arguments.
214
216
"""
215
217
@functools .wraps (f )
216
- def wrapped (context , * args , ** kwargs ):
218
+ def wrapper (context , * args , ** kwargs ):
217
219
ctxt_mgr = get_context_manager (context )
218
220
with ctxt_mgr .writer .using (context ):
219
221
return f (context , * args , ** kwargs )
220
- return wrapped
222
+ wrapper .__signature__ = inspect .signature (f )
223
+ return wrapper
221
224
222
225
223
226
def pick_context_manager_reader (f ):
@@ -228,11 +231,12 @@ def pick_context_manager_reader(f):
228
231
Wrapped function must have a RequestContext in the arguments.
229
232
"""
230
233
@functools .wraps (f )
231
- def wrapped (context , * args , ** kwargs ):
234
+ def wrapper (context , * args , ** kwargs ):
232
235
ctxt_mgr = get_context_manager (context )
233
236
with ctxt_mgr .reader .using (context ):
234
237
return f (context , * args , ** kwargs )
235
- return wrapped
238
+ wrapper .__signature__ = inspect .signature (f )
239
+ return wrapper
236
240
237
241
238
242
def pick_context_manager_reader_allow_async (f ):
@@ -243,11 +247,12 @@ def pick_context_manager_reader_allow_async(f):
243
247
Wrapped function must have a RequestContext in the arguments.
244
248
"""
245
249
@functools .wraps (f )
246
- def wrapped (context , * args , ** kwargs ):
250
+ def wrapper (context , * args , ** kwargs ):
247
251
ctxt_mgr = get_context_manager (context )
248
252
with ctxt_mgr .reader .allow_async .using (context ):
249
253
return f (context , * args , ** kwargs )
250
- return wrapped
254
+ wrapper .__signature__ = inspect .signature (f )
255
+ return wrapper
251
256
252
257
253
258
def model_query (
@@ -1539,8 +1544,10 @@ def instance_get_all(context, columns_to_join=None):
1539
1544
1540
1545
@require_context
1541
1546
@pick_context_manager_reader_allow_async
1542
- def instance_get_all_by_filters (context , filters , sort_key , sort_dir ,
1543
- limit = None , marker = None , columns_to_join = None ):
1547
+ def instance_get_all_by_filters (
1548
+ context , filters , sort_key = 'created_at' , sort_dir = 'desc' , limit = None ,
1549
+ marker = None , columns_to_join = None ,
1550
+ ):
1544
1551
"""Get all instances matching all filters sorted by the primary key.
1545
1552
1546
1553
See instance_get_all_by_filters_sort for more information.
@@ -2541,18 +2548,18 @@ def _instance_extra_create(context, values):
2541
2548
2542
2549
2543
2550
@pick_context_manager_writer
2544
- def instance_extra_update_by_uuid (context , instance_uuid , values ):
2551
+ def instance_extra_update_by_uuid (context , instance_uuid , updates ):
2545
2552
"""Update the instance extra record by instance uuid
2546
2553
2547
2554
:param instance_uuid: UUID of the instance tied to the record
2548
2555
:param updates: A dict of updates to apply
2549
2556
"""
2550
2557
rows_updated = model_query (context , models .InstanceExtra ).\
2551
2558
filter_by (instance_uuid = instance_uuid ).\
2552
- update (values )
2559
+ update (updates )
2553
2560
if not rows_updated :
2554
2561
LOG .debug ("Created instance_extra for %s" , instance_uuid )
2555
- create_values = copy .copy (values )
2562
+ create_values = copy .copy (updates )
2556
2563
create_values ["instance_uuid" ] = instance_uuid
2557
2564
_instance_extra_create (context , create_values )
2558
2565
rows_updated = 1
@@ -3305,23 +3312,23 @@ def migration_create(context, values):
3305
3312
3306
3313
@oslo_db_api .wrap_db_retry (max_retries = 5 , retry_on_deadlock = True )
3307
3314
@pick_context_manager_writer
3308
- def migration_update (context , id , values ):
3315
+ def migration_update (context , migration_id , values ):
3309
3316
"""Update a migration instance."""
3310
- migration = migration_get (context , id )
3317
+ migration = migration_get (context , migration_id )
3311
3318
migration .update (values )
3312
3319
3313
3320
return migration
3314
3321
3315
3322
3316
3323
@pick_context_manager_reader
3317
- def migration_get (context , id ):
3324
+ def migration_get (context , migration_id ):
3318
3325
"""Finds a migration by the ID."""
3319
3326
result = model_query (context , models .Migration , read_deleted = "yes" ).\
3320
- filter_by (id = id ).\
3327
+ filter_by (id = migration_id ).\
3321
3328
first ()
3322
3329
3323
3330
if not result :
3324
- raise exception .MigrationNotFound (migration_id = id )
3331
+ raise exception .MigrationNotFound (migration_id = migration_id )
3325
3332
3326
3333
return result
3327
3334
@@ -3340,16 +3347,16 @@ def migration_get_by_uuid(context, migration_uuid):
3340
3347
3341
3348
3342
3349
@pick_context_manager_reader
3343
- def migration_get_by_id_and_instance (context , id , instance_uuid ):
3350
+ def migration_get_by_id_and_instance (context , migration_id , instance_uuid ):
3344
3351
"""Finds a migration by the migration ID and the instance UUID."""
3345
3352
result = model_query (context , models .Migration ).\
3346
- filter_by (id = id ).\
3353
+ filter_by (id = migration_id ).\
3347
3354
filter_by (instance_uuid = instance_uuid ).\
3348
3355
first ()
3349
3356
3350
3357
if not result :
3351
- raise exception .MigrationNotFoundForInstance (migration_id = id ,
3352
- instance_id = instance_uuid )
3358
+ raise exception .MigrationNotFoundForInstance (
3359
+ migration_id = migration_id , instance_id = instance_uuid )
3353
3360
3354
3361
return result
3355
3362
0 commit comments