From a409d5f943d8e3f59c03f46a0d096b8e3e439b4c Mon Sep 17 00:00:00 2001 From: armando-migliaccio Date: Tue, 11 Jun 2013 12:47:48 -0700 Subject: [PATCH] Improve detection of config errors in nvp.ini file Detect if default params specified in the config file match what it is returned by NVP. Fixes bug #1190032 Change-Id: I8084dc938726e050ba82410cbc02a161cc0aa17f --- quantum/plugins/nicira/check_nvp_config.py | 26 +++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/quantum/plugins/nicira/check_nvp_config.py b/quantum/plugins/nicira/check_nvp_config.py index 1d1c6e28e..9a74ce298 100644 --- a/quantum/plugins/nicira/check_nvp_config.py +++ b/quantum/plugins/nicira/check_nvp_config.py @@ -86,10 +86,30 @@ def main(argv): print "\tController endpoint: %s" % controller nvplib.check_cluster_connectivity(cluster) gateway_services = get_gateway_services(cluster) - for svc_type in ["L2GatewayServiceConfig", - "L3GatewayServiceConfig"]: + default_gateways = { + "L2GatewayServiceConfig": cfg.CONF.default_l2_gw_service_uuid, + "L3GatewayServiceConfig": cfg.CONF.default_l3_gw_service_uuid} + errors = 0 + for svc_type in default_gateways.keys(): for uuid in gateway_services[svc_type]: print "\t\tGateway(%s) uuid: %s" % (svc_type, uuid) + if (default_gateways[svc_type] and + default_gateways[svc_type] not in gateway_services): + print ("\t\t\tError: specified default %s gateway (%s) is " + "missing from NVP Gateway Services!" % (svc_type, + default_gateways[svc_type])) + errors += 1 transport_zones = get_transport_zones(cluster) print "\tTransport zones: %s" % transport_zones - print "Done." + if cfg.CONF.default_tz_uuid not in transport_zones: + print ("\t\tError: specified default transport zone " + "(%s) is missing from NVP transport zones!" + % cfg.CONF.default_tz_uuid) + errors += 1 + + if errors: + print ("\nThere are %d errors with your configuration. " + " Please, revise!" % errors) + sys.exit(1) + else: + print "Done." -- 2.45.2