@@ -348,7 +348,9 @@ static const mi_export_t mi_cmds[] = {
348
348
},
349
349
{ "ds_reload" , 0 , 0 , mi_child_init , {
350
350
{ds_mi_reload , {0 }},
351
+ {ds_mi_reload , {"inherit_state" , 0 }},
351
352
{ds_mi_reload_1 , {"partition" , 0 }},
353
+ {ds_mi_reload_1 , {"partition" , "inherit_state" , 0 }},
352
354
{EMPTY_MI_RECIPE }}
353
355
},
354
356
{ "ds_push_script_attrs" , 0 , 0 , 0 , {
@@ -908,7 +910,7 @@ static int mod_init(void)
908
910
}
909
911
910
912
/* do the actual data load */
911
- if (ds_reload_db (partition , 1 )!= 0 ) {
913
+ if (ds_reload_db (partition , 1 , INHERIT_STATE_YES )!= 0 ) {
912
914
LM_ERR ("failed to load data from DB\n" );
913
915
return -1 ;
914
916
}
@@ -1371,9 +1373,26 @@ mi_response_t *ds_mi_reload(const mi_params_t *params,
1371
1373
struct mi_handler * async_hdl )
1372
1374
{
1373
1375
ds_partition_t * part_it ;
1376
+ str inherit_state ;
1377
+ int is_inherit_state = INHERIT_STATE_YES ;
1378
+
1379
+ if (get_mi_string_param (params , "inherit_state" , & inherit_state .s , & inherit_state .len ) >= 0 ) {
1380
+ LM_DBG ("inherit_state is: %s \n" , inherit_state .s );
1381
+
1382
+ if (inherit_state .s [0 ] == '0' || inherit_state .s [0 ] == 'n' || inherit_state .s [0 ] == 'N' ) {
1383
+ is_inherit_state = INHERIT_STATE_NO ;
1384
+ }
1385
+ else if (inherit_state .s [0 ] == '1' || inherit_state .s [0 ] == 'y' || inherit_state .s [0 ] == 'Y' ) {
1386
+ is_inherit_state = INHERIT_STATE_YES ;
1387
+ } else {
1388
+ LM_WARN ("inherit_state values was not recognized, ignored \n" );
1389
+ }
1390
+ }
1391
+
1392
+ LM_DBG ("is_inherit_state is: %d \n" , is_inherit_state );
1374
1393
1375
1394
for (part_it = partitions ; part_it ; part_it = part_it -> next )
1376
- if (ds_reload_db (part_it , 0 )< 0 )
1395
+ if (ds_reload_db (part_it , 0 , is_inherit_state )< 0 )
1377
1396
return init_mi_error (500 , MI_SSTR (MI_ERR_RELOAD ));
1378
1397
1379
1398
if (ds_cluster_id && ds_cluster_sync () < 0 )
@@ -1387,15 +1406,32 @@ mi_response_t *ds_mi_reload_1(const mi_params_t *params,
1387
1406
{
1388
1407
ds_partition_t * partition ;
1389
1408
str partname ;
1409
+ str inherit_state ;
1410
+ int is_inherit_state = INHERIT_STATE_YES ;
1390
1411
1391
1412
if (get_mi_string_param (params , "partition" , & partname .s , & partname .len ) < 0 )
1392
- return init_mi_param_error ();
1413
+ return init_mi_param_error ();
1414
+
1415
+ if (get_mi_string_param (params , "inherit_state" , & inherit_state .s , & inherit_state .len ) >= 0 ) {
1416
+ LM_DBG ("inherit_state is: %s \n" , inherit_state .s );
1417
+
1418
+ if (inherit_state .s [0 ] == '0' || inherit_state .s [0 ] == 'n' || inherit_state .s [0 ] == 'N' ) {
1419
+ is_inherit_state = INHERIT_STATE_NO ;
1420
+ }
1421
+ else if (inherit_state .s [0 ] == '1' || inherit_state .s [0 ] == 'y' || inherit_state .s [0 ] == 'Y' ) {
1422
+ is_inherit_state = INHERIT_STATE_YES ;
1423
+ } else {
1424
+ LM_WARN ("inherit_state values was not recognized, ignored \n" );
1425
+ }
1426
+ }
1427
+
1428
+ LM_DBG ("is_inherit_state is: %d \n" , is_inherit_state );
1393
1429
1394
1430
partition = find_partition_by_name (& partname );
1395
1431
1396
1432
if (partition == NULL )
1397
1433
return init_mi_error (500 , MI_SSTR (MI_UNK_PARTITION ));
1398
- if (ds_reload_db (partition , 0 ) < 0 )
1434
+ if (ds_reload_db (partition , 0 , is_inherit_state ) < 0 )
1399
1435
return init_mi_error (500 , MI_SSTR (MI_ERR_RELOAD ));
1400
1436
1401
1437
if (ds_cluster_id && ds_cluster_sync () < 0 )
0 commit comments