From ab6f32c12bbd7e179386314f38148831b487f504 Mon Sep 17 00:00:00 2001 From: Adit Sarfaty Date: Mon, 12 Mar 2018 14:53:29 +0200 Subject: [PATCH] TVD: Support TVD devstack with disabled plugins When using the TVD plugin, sometimes nsx-v or nsx-v3 are not configured. This patch ensures that the devstack cleanup will clean only the relevant NSX backend, to avoid errors in the logs. And also that the devstack configuration will skip unconfigured plugins Change-Id: I27ad52ea9a4052c0b8f3d1ea4d485fcc44b19f6d --- devstack/lib/nsx_common | 6 +++++- devstack/lib/vmware_nsx_tvd | 2 +- devstack/lib/vmware_nsx_v3 | 2 +- devstack/plugin.sh | 16 ++++++++++++---- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/devstack/lib/nsx_common b/devstack/lib/nsx_common index efcc61b8d9..a5242acf42 100644 --- a/devstack/lib/nsx_common +++ b/devstack/lib/nsx_common @@ -105,7 +105,11 @@ function nsxv3_configure_service { elif [[ "$NSX_MANAGER" != "" ]]; then _nsxv3_ini_set nsx_api_managers $NSX_MANAGER else - die $LINENO "The VMware NSX plugin needs at least one NSX manager." + if [[ $1 == "nsx_v3" ]]; then + die $LINENO "The VMware NSX plugin needs at least one NSX manager." + else + return + fi fi if [[ "$NSX_L2GW_DRIVER" != "" ]]; then iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_l2gw_driver $NSX_L2GW_DRIVER diff --git a/devstack/lib/vmware_nsx_tvd b/devstack/lib/vmware_nsx_tvd index be22088795..4818f6d820 100644 --- a/devstack/lib/vmware_nsx_tvd +++ b/devstack/lib/vmware_nsx_tvd @@ -154,7 +154,7 @@ function neutron_plugin_configure_plugin_agent { } function neutron_plugin_configure_service { - nsxv3_configure_service + nsxv3_configure_service nsx_tvd nsxv_configure_service dvs_configure_service "$DVS_VMWAREAPI_IP" "$DVS_VMWAREAPI_USER" "$DVS_VMWAREAPI_PASSWORD" "$DVS_VMWAREAPI_CA_FILE" "$DVS_VMWAREAPI_INSECURE" "$VMWARE_DVS_NAME" iniset /$Q_PLUGIN_CONF_FILE nsx_tvd nsx_v_extension_drivers vmware_nsxv_dns diff --git a/devstack/lib/vmware_nsx_v3 b/devstack/lib/vmware_nsx_v3 index 90e83929db..a2d7cd813d 100644 --- a/devstack/lib/vmware_nsx_v3 +++ b/devstack/lib/vmware_nsx_v3 @@ -154,7 +154,7 @@ function neutron_plugin_configure_plugin_agent { } function neutron_plugin_configure_service { - nsxv3_configure_service + nsxv3_configure_service nsx_v3 iniset /$Q_PLUGIN_CONF_FILE DEFAULT nsx_extension_drivers vmware_nsxv3_dns } diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 4e56a159ea..d509cc462e 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -84,13 +84,21 @@ elif [[ $Q_PLUGIN == 'vmware_nsx_tvd' ]]; then IFS=',' NSX_MANAGER=($NSX_MANAGER) unset IFS - python $dir/tools/nsxv3_cleanup.py --mgr-ip $NSX_MANAGER --user $NSX_USER --password $NSX_PASSWORD --db-connection $db_connection - python $dir/tools/nsxv_cleanup.py --vsm-ip ${NSXV_MANAGER_URI/https:\/\/} --user $NSXV_USER --password $NSXV_PASSWORD --db-connection $db_connection + if [[ "$NSX_MANAGER" != "" ]]; then + python $dir/tools/nsxv3_cleanup.py --mgr-ip $NSX_MANAGER --user $NSX_USER --password $NSX_PASSWORD --db-connection $db_connection + fi + if [[ "$NSXV_MANAGER_URI" != "" ]]; then + python $dir/tools/nsxv_cleanup.py --vsm-ip ${NSXV_MANAGER_URI/https:\/\/} --user $NSXV_USER --password $NSXV_PASSWORD --db-connection $db_connection + fi fi elif [[ "$1" == 'clean' ]]; then if is_service_enabled q-svc || is_service_enabled neutron-api; then - python $dir/tools/nsxv3_cleanup.py --mgr-ip $NSX_MANAGER --user $NSX_USER --password $NSX_PASSWORD - python $dir/tools/nsxv_cleanup.py --vsm-ip ${NSXV_MANAGER_URI/https:\/\/} --user $NSXV_USER --password $NSXV_PASSWORD + if [[ "$NSX_MANAGER" != "" ]]; then + python $dir/tools/nsxv3_cleanup.py --mgr-ip $NSX_MANAGER --user $NSX_USER --password $NSX_PASSWORD + fi + if [[ "$NSXV_MANAGER_URI" != "" ]]; then + python $dir/tools/nsxv_cleanup.py --vsm-ip ${NSXV_MANAGER_URI/https:\/\/} --user $NSXV_USER --password $NSXV_PASSWORD + fi fi fi elif [[ $Q_PLUGIN == 'vmware_dvs' ]]; then