V2T migration: ensure dvs.ca_file is set for admin shell

Ensure the the ca_file value for validating vCenter server
certificate is alway set when running V2T pre-migration
validation.

The ca_file parameter is set to a particular default value as it
would otherwise default to None

Change-Id: I5b640e47c644dc5c5352b3c7ef80bbb1a7470d34
This commit is contained in:
Salvatore Orlando 2021-03-31 10:06:58 -07:00 committed by Salvatore Orlando
parent 84b7a9cffa
commit f2ee661e22
1 changed files with 7 additions and 1 deletions

View File

@ -517,7 +517,6 @@ def _validate_config():
@admin_utils.output_header @admin_utils.output_header
def validate_config_for_migration(resource, event, trigger, **kwargs): def validate_config_for_migration(resource, event, trigger, **kwargs):
"""Validate the nsxv configuration before migration to nsx-t""" """Validate the nsxv configuration before migration to nsx-t"""
# Read the command line parameters # Read the command line parameters
transit_networks = ["100.64.0.0/16"] transit_networks = ["100.64.0.0/16"]
strict = False strict = False
@ -531,6 +530,13 @@ def validate_config_for_migration(resource, event, trigger, **kwargs):
strict = bool(properties.get('strict', 'false').lower() == 'true') strict = bool(properties.get('strict', 'false').lower() == 'true')
out_file = properties.get('summary-file-name') out_file = properties.get('summary-file-name')
# Ensure ca_file in DVS section is always set otherwise secure connection
# to vcenter will fail
if not cfg.CONF.dvs.ca_file:
ca_file_default = "/etc/ssl/certs/vcenter.pem"
LOG.info("ca_file for vCenter unset, defaulting to: %s",
ca_file_default)
cfg.CONF.set_override('ca_file', ca_file_default, 'dvs')
LOG.info("Running migration config validation in %sstrict mode", LOG.info("Running migration config validation in %sstrict mode",
'' if strict else 'non-') '' if strict else 'non-')