From 633dbc3d8e7d3f06e13d532748c71ffba6cd21ea Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Wed, 14 Jun 2017 12:09:21 -0700 Subject: [PATCH] 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 --- lib/cinder | 2 ++ lib/glance | 2 ++ lib/keystone | 2 ++ lib/neutron | 2 ++ lib/neutron-legacy | 2 ++ lib/nova | 2 ++ lib/placement | 2 ++ 7 files changed, 14 insertions(+) diff --git a/lib/cinder b/lib/cinder index 291eebee87..20688129fd 100644 --- a/lib/cinder +++ b/lib/cinder @@ -407,8 +407,10 @@ function init_cinder { # (Re)create cinder database recreate_database cinder + time_start "dbsync" # Migrate cinder database $CINDER_BIN_DIR/cinder-manage --config-file $CINDER_CONF db sync + time_stop "dbsync" fi if is_service_enabled c-vol && [[ -n "$CINDER_ENABLED_BACKENDS" ]]; then diff --git a/lib/glance b/lib/glance index 57b5f45113..baf8c6191c 100644 --- a/lib/glance +++ b/lib/glance @@ -285,11 +285,13 @@ function init_glance { # (Re)create glance database recreate_database glance + time_start "dbsync" # Migrate glance database $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_sync # Load metadata definitions $GLANCE_BIN_DIR/glance-manage --config-file $GLANCE_CONF_DIR/glance-api.conf db_load_metadefs + time_stop "dbsync" create_glance_cache_dir } diff --git a/lib/keystone b/lib/keystone index eaed937d2e..9de660b4e2 100644 --- a/lib/keystone +++ b/lib/keystone @@ -458,8 +458,10 @@ function init_keystone { recreate_database keystone fi + time_start "dbsync" # Initialize keystone database $KEYSTONE_BIN_DIR/keystone-manage --config-file $KEYSTONE_CONF db_sync + time_stop "dbsync" if [[ "$KEYSTONE_TOKEN_FORMAT" == "pki" || "$KEYSTONE_TOKEN_FORMAT" == "pkiz" ]]; then # Set up certificates diff --git a/lib/neutron b/lib/neutron index 5c88a50bad..2a660ec8e1 100644 --- a/lib/neutron +++ b/lib/neutron @@ -336,8 +336,10 @@ function init_neutron_new { recreate_database neutron + time_start "dbsync" # Run Neutron db migrations $NEUTRON_BIN_DIR/neutron-db-manage upgrade heads + time_stop "dbsync" create_neutron_cache_dir } diff --git a/lib/neutron-legacy b/lib/neutron-legacy index 67cf110644..784f3a8167 100644 --- a/lib/neutron-legacy +++ b/lib/neutron-legacy @@ -417,8 +417,10 @@ function create_mutnauq_accounts { # init_mutnauq() - Initialize databases, etc. function init_mutnauq { recreate_database $Q_DB_NAME + time_start "dbsync" # Run Neutron db migrations $NEUTRON_BIN_DIR/neutron-db-manage --config-file $NEUTRON_CONF --config-file /$Q_PLUGIN_CONF_FILE upgrade head + time_stop "dbsync" } # install_mutnauq() - Collect source and prepare diff --git a/lib/nova b/lib/nova index aae3108013..18715fc418 100644 --- a/lib/nova +++ b/lib/nova @@ -649,7 +649,9 @@ function init_nova_cells { iniset $NOVA_CELLS_CONF DEFAULT enabled_apis metadata fi + time_start "dbsync" $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CELLS_CONF db sync + time_stop "dbsync" $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 $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 diff --git a/lib/placement b/lib/placement index ad12824a38..8adbbdec68 100644 --- a/lib/placement +++ b/lib/placement @@ -149,7 +149,9 @@ function create_placement_accounts { function init_placement { if [ "$PLACEMENT_DB_ENABLED" != False ]; then recreate_database placement + time_start "dbsync" $NOVA_BIN_DIR/nova-manage --config-file $NOVA_CONF api_db sync + time_stop "dbsync" fi create_placement_accounts }