Browse code

Track db sync command time useage

We are trying to keep better track of what pieces of devstack consume
the most time. Add the db sync commands to the time tracking as they run
the database migrations which can take more time than expected.

Change-Id: Ib92f2b8304ccf703712d45fd7207444de3599e2d

Clark Boylan authored on 2017/06/15 04:09:21
Showing 7 changed files
... ...
@@ -407,8 +407,10 @@ function init_cinder {
407 407
         # (Re)create cinder database
408 408
         recreate_database cinder
409 409
 
410
+        time_start "dbsync"
410 411
         # Migrate cinder database
411 412
         $CINDER_BIN_DIR/cinder-manage --config-file $CINDER_CONF db sync
413
+        time_stop "dbsync"
412 414
     fi
413 415
 
414 416
     if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then
... ...
@@ -285,11 +285,13 @@ function init_glance {
285 285
     # (Re)create glance database
286 286
     recreate_database glance
287 287
 
288
+    time_start "dbsync"
288 289
     # Migrate glance database
289 290
     $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync
290 291
 
291 292
     # Load metadata definitions
292 293
     $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs
294
+    time_stop "dbsync"
293 295
 
294 296
     create_glance_cache_dir
295 297
 }
... ...
@@ -458,8 +458,10 @@ function init_keystone {
458 458
         recreate_database keystone
459 459
     fi
460 460
 
461
+    time_start "dbsync"
461 462
     # Initialize keystone database
462 463
     $KEYSTONE_BIN_DIR/keystone-manage --config-file $KEYSTONE_CONF db_sync
464
+    time_stop "dbsync"
463 465
 
464 466
     if [[ "$KEYSTONE_TOKEN_FORMAT" == "pki" || "$KEYSTONE_TOKEN_FORMAT" == "pkiz" ]]; then
465 467
         # Set up certificates
... ...
@@ -336,8 +336,10 @@ function init_neutron_new {
336 336
 
337 337
     recreate_database neutron
338 338
 
339
+    time_start "dbsync"
339 340
     # Run Neutron db migrations
340 341
     $NEUTRON_BIN_DIR/neutron-db-manage upgrade heads
342
+    time_stop "dbsync"
341 343
 
342 344
     create_neutron_cache_dir
343 345
 }
... ...
@@ -417,8 +417,10 @@ function create_mutnauq_accounts {
417 417
 # init_mutnauq() - Initialize databases, etc.
418 418
 function init_mutnauq {
419 419
     recreate_database $Q_DB_NAME
420
+    time_start "dbsync"
420 421
     # Run Neutron db migrations
421 422
     $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head
423
+    time_stop "dbsync"
422 424
 }
423 425
 
424 426
 # install_mutnauq() - Collect source and prepare
... ...
@@ -649,7 +649,9 @@ function init_nova_cells {
649 649
             iniset $NOVA_CELLS_CONF DEFAULT enabled_apis metadata
650 650
         fi
651 651
 
652
+        time_start "dbsync"
652 653
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync
654
+        time_stop "dbsync"
653 655
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF cell create --name=region --cell_type=parent --username=$RABBIT_USERID --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=/ --woffset=0 --wscale=1
654 656
         $NOVA_BIN_DIR/nova-manage cell create --name=child --cell_type=child --username=$RABBIT_USERID --hostname=$RABBIT_HOST --port=5672 --password=$RABBIT_PASSWORD --virtual_host=child_cell --woffset=0 --wscale=1
655 657
 
... ...
@@ -149,7 +149,9 @@ function create_placement_accounts {
149 149
 function init_placement {
150 150
     if [ "$PLACEMENT_DB_ENABLED" != False ]; then
151 151
         recreate_database placement
152
+        time_start "dbsync"
152 153
         $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync
154
+        time_stop "dbsync"
153 155
     fi
154 156
     create_placement_accounts
155 157
 }