def main(): try: global args parser = argparse.ArgumentParser() parser.add_argument("--controllers", dest="num_controllers", type=int, default=3, help="The number of controller nodes") parser.add_argument("--dell-computes", dest="num_dell_computes", type=int, required=True, help="The number of dell compute nodes") parser.add_argument("--storage", dest="num_storage", type=int, required=True, help="The number of storage nodes") parser.add_argument("--enable_hugepages", action='store_true', default=False, help="Enable/Disable hugepages feature") parser.add_argument("--enable_numa", action='store_true', default=False, help="Enable/Disable numa feature") parser.add_argument("--vlans", dest="vlan_range", required=True, help="The VLAN range to use for Neutron in " " xxx:yyy format") parser.add_argument("--nic_env_file", default="5_port/nic_environment.yaml", help="The NIC environment file to use") parser.add_argument("--ntp", dest="ntp_server_fqdn", default="0.centos.pool.ntp.org", help="The FQDN of the ntp server to use") parser.add_argument("--timeout", default="120", help="The amount of time in minutes to allow the " "overcloud to deploy") parser.add_argument("--overcloud_name", default=None, help="The name of the overcloud") parser.add_argument("--hugepages_size", dest="hugepages_size", required=False, default="1GB", help="HugePages size") parser.add_argument("--hostos_cpu_count", dest="hostos_cpu_count", required=False, default="4", help="HostOs Cpus to be configured") parser.add_argument("--mariadb_max_connections", dest="mariadb_max_connections", required=False, default="15360", help="Maximum number of connections for MariaDB") parser.add_argument("--innodb_buffer_pool_size", dest="innodb_buffer_pool_size", required=False, default="dynamic", help="InnoDB buffer pool size") parser.add_argument("--innodb_buffer_pool_instances", dest="innodb_buffer_pool_instances", required=False, default="16", help="InnoDB buffer pool instances.") parser.add_argument('--enable_dellsc', action='store_true', default=False, help="Enable cinder Dell Storage Center backend") parser.add_argument('--disable_rbd', action='store_true', default=False, help="Disable cinder Ceph and rbd backend") parser.add_argument('--dvr_enable', action='store_true', default=False, help="Enables Distributed Virtual Routing") parser.add_argument('--static_ips', action='store_true', default=False, help="Specify the IPs on the overcloud nodes") parser.add_argument('--static_vips', action='store_true', default=False, help="Specify the VIPs for the networks") parser.add_argument('--ovs_dpdk', action='store_true', default=False, help="Enable OVS+DPDK") parser.add_argument('--sriov', action='store_true', default=False, help="Enable SR-IOV") parser.add_argument('--node_placement', action='store_true', default=False, help="Control which physical server is assigned " "which instance") parser.add_argument("--debug", default=False, action='store_true', help="Indicates if the deploy-overcloud script " "should be run in debug mode") parser.add_argument("--mtu", dest="mtu", type=int, required=True, default=1500, help="Tenant Network MTU") LoggingHelper.add_argument(parser) args = parser.parse_args() LoggingHelper.configure_logging(args.logging_level) p = re.compile('\d+:\d+') # noqa: W605 if not p.match(args.vlan_range): raise ValueError("Error: The VLAN range must be a number followed " "by a colon, followed by another number") os_auth_url, os_tenant_name, os_username, os_password, \ os_user_domain_name, os_project_domain_name = \ CredentialHelper.get_undercloud_creds() # Set up the default flavors control_flavor = "control" ceph_storage_flavor = "ceph-storage" swift_storage_flavor = "swift-storage" block_storage_flavor = "block-storage" if args.node_placement: validate_node_placement() # If node-placement is specified, then the baremetal flavor must # be used control_flavor = BAREMETAL_FLAVOR ceph_storage_flavor = BAREMETAL_FLAVOR swift_storage_flavor = BAREMETAL_FLAVOR block_storage_flavor = BAREMETAL_FLAVOR # Validate that the NIC envronment file exists nic_env_file = os.path.join(home_dir, "pilot/templates/nic-configs", args.nic_env_file) if not os.path.isfile(nic_env_file): raise ValueError("\nError: The nic_env_file {} does not " "exist!".format(nic_env_file)) # Apply any patches required on the Director itself. This is done each # time the overcloud is deployed (instead of once, after the Director # is installed) in order to ensure an update to the Director doesn't # overwrite the patch. # logger.info("Applying patches to director...") # cmd = os.path.join(home_dir, 'pilot', 'patch-director.sh') # status = os.system(cmd) # if status != 0: # raise ValueError("\nError: {} failed, unable to continue. See " # "the comments in that file for additional " # "information".format(cmd)) # Pass the parameters required by puppet which will be used # to enable/disable dell nfv features # Edit the dellnfv_environment.yaml # If disabled, default values will be set and # they won't be used for configuration # Create ConfigOvercloud object config = ConfigOvercloud(args.overcloud_name) # Remove this when Numa siblings added # Edit the dellnfv_environment.yaml config.edit_environment_files( args.mtu, args.enable_hugepages, args.enable_numa, args.hugepages_size, args.hostos_cpu_count, args.ovs_dpdk, args.sriov, nic_env_file, args.mariadb_max_connections, args.innodb_buffer_pool_size, args.innodb_buffer_pool_instances, args.num_controllers, args.num_storage, control_flavor, ceph_storage_flavor, swift_storage_flavor, block_storage_flavor, args.vlan_range, args.num_dell_computes) # Launch the deployment overcloud_name_opt = "" if args.overcloud_name is not None: overcloud_name_opt = "--stack " + args.overcloud_name debug = "" if args.debug: debug = "--debug" # The order of the environment files is important as a later inclusion # overrides resources defined in prior inclusions. # The roles_data.yaml must be included at the beginning. # This is needed to enable the custome role Dell Compute. # It overrides the default roles_data.yaml env_opts = "-r ~/pilot/templates/roles_data.yaml" # The network-environment.yaml must be included after the # network-isolation.yaml env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "network-isolation.yaml" \ " -e ~/pilot/templates/network-environment.yaml" \ " -e {}" \ " -e ~/pilot/templates/ceph-osd-config.yaml" \ "".format(nic_env_file) # The static-ip-environment.yaml must be included after the # network-environment.yaml if args.static_ips: env_opts += " -e ~/pilot/templates/static-ip-environment.yaml" # The static-vip-environment.yaml must be included after the # network-environment.yaml if args.static_vips: env_opts += " -e ~/pilot/templates/static-vip-environment.yaml" # The neutron-ovs-dvr.yaml.yaml must be included after the # network-environment.yaml if args.dvr_enable: env_opts += " -e ~/pilot/templates/neutron-ovs-dvr.yaml" if args.node_placement: env_opts += " -e ~/pilot/templates/node-placement.yaml" # The dell-environment.yaml must be included after the # storage-environment.yaml and ceph-radosgw.yaml env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "storage-environment.yaml" \ " -e ~/overcloud_images.yaml" \ " -e ~/pilot/templates/dell-environment.yaml" \ " -e ~/pilot/templates/overcloud/environments/" \ "puppet-pacemaker.yaml" host_config = False if args.enable_hugepages or args.enable_numa: env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "host-config-and-reboot.yaml" host_config = True if args.ovs_dpdk: if not args.enable_hugepages or not args.enable_numa: raise ValueError("Both hugepages and numa must be" + "enabled in order to use OVS-DPDK") else: env_opts += " -e ~/pilot/templates/neutron-ovs-dpdk.yaml" if args.sriov: env_opts += " -e ~/pilot/templates/neutron-sriov.yaml" env_opts += " -e ~/pilot/templates/ovs-hw-offload.yaml" if not host_config: env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "host-config-and-reboot.yaml" if args.enable_dellsc: env_opts += " -e ~/pilot/templates/dell-cinder-backends.yaml" cmd = "cd ;source ~/stackrc; openstack overcloud deploy" \ " {}" \ " --log-file ~/pilot/overcloud_deployment.log" \ " -t {}" \ " {}" \ " --templates ~/pilot/templates/overcloud" \ " -e /usr/share/openstack-tripleo-heat-templates/" \ "environments/ceph-ansible/ceph-ansible.yaml" \ " -e /usr/share/openstack-tripleo-heat-templates/" \ "environments/ceph-ansible/ceph-rgw.yaml" \ " {}" \ " --libvirt-type kvm" \ " --ntp-server {}" \ "".format(debug, args.timeout, overcloud_name_opt, env_opts, args.ntp_server_fqdn, ) with open(os.path.join(home_dir, 'pilot', 'overcloud_deploy_cmd.log'), 'w') as f: f.write(cmd.replace(' -', ' \\\n -')) f.write('\n') print cmd start = time.time() status = run_deploy_command(cmd) end = time.time() logger.info('\nExecution time: {} (hh:mm:ss)'.format( time.strftime('%H:%M:%S', time.gmtime(end - start)))) logger.info('Fetching SSH keys...') update_ssh_config() if status == 0: horizon_url = finalize_overcloud() logger.info("\nDeployment Completed") else: horizon_url = None logger.info('Overcloud nodes:') identify_nodes() if horizon_url: logger.info('\nHorizon Dashboard URL: {}\n'.format(horizon_url)) except Exception as err: print >> sys.stderr, err sys.exit(1)
def main(): try: global args parser = argparse.ArgumentParser() parser.add_argument("--controllers", dest="num_controllers", type=int, default=3, help="The number of controller nodes") parser.add_argument("--dell-computes", dest="num_dell_computes", type=int, required=True, help="The number of dell compute nodes") parser.add_argument("--dell-computeshci", dest="num_dell_computeshci", type=int, required=True, help="The number of dell hci compute nodes") parser.add_argument("--storage", dest="num_storage", type=int, required=True, help="The number of storage nodes") parser.add_argument("--powerflex", dest="num_powerflex", type=int, required=True, help="The number of powerflex storage nodes") parser.add_argument("--enable_hugepages", action='store_true', default=False, help="Enable/Disable hugepages feature") parser.add_argument("--enable_numa", action='store_true', default=False, help="Enable/Disable numa feature") parser.add_argument("--vlans", dest="vlan_range", required=True, help="The VLAN range to use for Neutron in " " xxx:yyy format") parser.add_argument("--nic_env_file", default="5_port/nic_environment.yaml", help="The NIC environment file to use") parser.add_argument("--ntp", dest="ntp_server_fqdn", default="0.centos.pool.ntp.org", help="The FQDN of the ntp server to use") parser.add_argument("--timezone", dest="time_zone", default="America/Chicago", help="The timezone to use") parser.add_argument("--timeout", default="300", help="The amount of time in minutes to allow the " "overcloud to deploy") parser.add_argument("--overcloud_name", default=None, help="The name of the overcloud") parser.add_argument("--hugepages_size", dest="hugepages_size", required=False, default="1GB", help="HugePages size") parser.add_argument("--hostos_cpu_count", dest="hostos_cpu_count", required=False, default="4", help="HostOs Cpus to be configured") parser.add_argument('--enable_dellsc', action='store_true', default=False, help="Enable cinder Dell Storage Center backend") parser.add_argument('--enable_unity', action='store_true', default=False, help="Enable Dell EMC Unity backend") parser.add_argument('--enable_unity_manila', action='store_true', default=False, help="Enable Dell EMC Unity Manila backend") parser.add_argument('--enable_powermax', action='store_true', default=False, help="Enable Dell EMC Powermax backend") parser.add_argument('--powermax_protocol', dest='powermax_protocol', required=False, default="iSCSI", help="Dell EMC Powermax Protocol - iSCSI or FC") parser.add_argument('--enable_powermax_manila', action='store_true', default=False, help="Enable Dell EMC PowerMax Manila backend") parser.add_argument('--enable_powerstore', action='store_true', default=False, help="Enable Dell EMC Powerstore backend") parser.add_argument('--disable_rbd', action='store_true', default=False, help="Disable cinder Ceph and rbd backend") parser.add_argument('--octavia_enable', action='store_true', default=False, help="Enables Octavia Load Balancer") parser.add_argument('--octavia_user_certs_keys', action='store_true', default=False, help="Enables Octavia Load Balancer with " "user provided certs and keys") parser.add_argument('--dvr_enable', action='store_true', default=False, help="Enables Distributed Virtual Routing") parser.add_argument('--barbican_enable', action='store_true', default=False, help="Enables Barbican key manager") parser.add_argument('--static_ips', action='store_true', default=False, help="Specify the IPs on the overcloud nodes") parser.add_argument('--static_vips', action='store_true', default=False, help="Specify the VIPs for the networks") parser.add_argument('--ovs_dpdk', action='store_true', default=False, help="Enable OVS+DPDK") parser.add_argument('--sriov', action='store_true', default=False, help="Enable SR-IOV") parser.add_argument('--hw_offload', action='store_true', default=False, help="Enable SR-IOV Offload") parser.add_argument('--sriov_interfaces', dest="sriov_interfaces", default=False, help="SR-IOV interfaces count") parser.add_argument('--node_placement', action='store_true', default=False, help="Control which physical server is assigned " "which instance") parser.add_argument("--debug", default=False, action='store_true', help="Indicates if the deploy-overcloud script " "should be run in debug mode") parser.add_argument("--mtu", dest="mtu", type=int, required=True, default=1500, help="Tenant Network MTU") parser.add_argument("--dashboard_enable", action='store_true', default=False, help="Enable the ceph dashboard deployment") parser.add_argument('--network_data', action='store_true', default=False, help="Use network_data.yaml to create edge site " "networks") LoggingHelper.add_argument(parser) args = parser.parse_args() LoggingHelper.configure_logging(args.logging_level) p = re.compile('\d+:\d+') # noqa: W605 if not p.match(args.vlan_range): raise ValueError("Error: The VLAN range must be a number followed " "by a colon, followed by another number") os_auth_url, os_tenant_name, os_username, os_password, \ os_user_domain_name, os_project_domain_name = \ CredentialHelper.get_undercloud_creds() # Set up the default flavors control_flavor = "control" ceph_storage_flavor = "ceph-storage" swift_storage_flavor = "swift-storage" block_storage_flavor = "block-storage" if args.node_placement: validate_node_placement() # If node-placement is specified, then the baremetal flavor must # be used control_flavor = BAREMETAL_FLAVOR ceph_storage_flavor = BAREMETAL_FLAVOR swift_storage_flavor = BAREMETAL_FLAVOR block_storage_flavor = BAREMETAL_FLAVOR # Validate that the NIC envronment file exists nic_env_file = os.path.join(home_dir, "pilot/templates/nic-configs", args.nic_env_file) if not os.path.isfile(nic_env_file): raise ValueError("\nError: The nic_env_file {} does not " "exist!".format(nic_env_file)) # Apply any patches required on the Director itself. This is done each # time the overcloud is deployed (instead of once, after the Director # is installed) in order to ensure an update to the Director doesn't # overwrite the patch. # logger.info("Applying patches to director...") # cmd = os.path.join(home_dir, 'pilot', 'patch-director.sh') # status = os.system(cmd) # if status != 0: # raise ValueError("\nError: {} failed, unable to continue. See " # "the comments in that file for additional " # "information".format(cmd)) # Pass the parameters required by puppet which will be used # to enable/disable dell nfv features # Edit the dellnfv_environment.yaml # If disabled, default values will be set and # they won't be used for configuration # Create ConfigOvercloud object print("Configure environment file") config = ConfigOvercloud(args.overcloud_name) # Remove this when Numa siblings added # Edit the dellnfv_environment.yaml config.edit_environment_files( args.mtu, args.enable_hugepages, args.enable_numa, args.hugepages_size, args.hostos_cpu_count, args.ovs_dpdk, args.sriov, args.hw_offload, args.sriov_interfaces, nic_env_file, args.num_controllers, args.num_storage, control_flavor, ceph_storage_flavor, swift_storage_flavor, block_storage_flavor, args.vlan_range, args.time_zone, args.num_dell_computes, args.num_dell_computeshci, args.num_powerflex) # Launch the deployment overcloud_name_opt = "" if args.overcloud_name is not None: overcloud_name_opt = "--stack " + args.overcloud_name debug = "" if args.debug: debug = "--debug" # The order of the environment files is important as a later inclusion # overrides resources defined in prior inclusions. env_opts = "" # If there are edge sites we have to use network_data.yaml and # it must in as first argument. if args.network_data: env_opts += "-n ~/pilot/templates/network_data.yaml " # The roles_data.yaml must be included at the beginning. # This is needed to enable the custom role Dell Compute. # It overrides the default roles_data.yaml env_opts += "-r ~/pilot/templates/roles_data.yaml" # The static-ip-environment.yaml must be included after the # network-environment.yaml if args.static_ips: env_opts += " -e ~/pilot/templates/static-ip-environment.yaml" # The static-vip-environment.yaml must be included after the # network-environment.yaml if args.static_vips: env_opts += " -e ~/pilot/templates/static-vip-environment.yaml" # The configure-barbican.yaml must be included after the # network-environment.yaml if args.barbican_enable: env_opts += " -e ~/pilot/templates/configure-barbican.yaml" # The octavia.yaml must be included after the # network-environment.yaml if args.octavia_enable: env_opts += " -e ~/pilot/templates/octavia.yaml" if args.octavia_user_certs_keys is True: env_opts += " -e ~/pilot/templates/cert_keys.yaml" if args.node_placement: env_opts += " -e ~/pilot/templates/node-placement.yaml" # The neutron-ovs.yaml must be included before dell-environment.yaml to enable ovs and disable ovn # in OSP16.1. In case we need to use OVN in future, please delete this line env_opts += " -e ~/pilot/templates/overcloud/environments/services/neutron-ovs.yaml" # The neutron-ovs-dvr.yaml.yaml must be included after the # neutron-ovs.yaml if args.dvr_enable: env_opts += " -e ~/pilot/templates/neutron-ovs-dvr.yaml" # The dell-environment.yaml must be included after the # storage-environment.yaml and ceph-radosgw.yaml if args.num_powerflex > 0: env_opts += " -e ~/containers-prepare-parameter.yaml" \ " -e ~/pilot/templates/dell-environment.yaml" else: env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "storage-environment.yaml" \ " -e ~/containers-prepare-parameter.yaml" \ " -e ~/pilot/templates/dell-environment.yaml" if args.ovs_dpdk: if not args.enable_hugepages or not args.enable_numa: raise ValueError("Both hugepages and numa must be" + "enabled in order to use OVS-DPDK") else: env_opts += " -e ~/pilot/templates/neutron-ovs-dpdk.yaml" if args.sriov: if not args.enable_numa: raise ValueError("Numa cpu pinning must be " + "enabled in order to use SRIOV") else: env_opts += " -e ~/pilot/templates/neutron-sriov.yaml" if args.enable_dellsc: env_opts += " -e ~/pilot/templates/dellsc-cinder-config.yaml" if args.enable_unity: env_opts += " -e ~/pilot/templates/dellemc-unity-cinder-" \ "container.yaml" env_opts += " -e ~/pilot/templates/dellemc-unity-cinder-" \ "backend.yaml" if args.enable_unity_manila: env_opts += " -e ~/pilot/templates/unity-manila-container.yaml" env_opts += " -e ~/pilot/templates/unity-manila-config.yaml" if args.enable_powermax: if args.powermax_protocol == "iSCSI": env_opts += " -e ~/pilot/templates/dellemc-powermax-iscsi-cinder-" \ "backend.yaml" else: env_opts += " -e ~/pilot/templates/dellemc-powermax-fc-cinder-" \ "backend.yaml" if args.enable_powermax_manila: env_opts += " -e ~/pilot/templates/powermax-manila-config.yaml" if args.enable_powerstore: env_opts += " -e ~/pilot/templates/dellemc-powerstore-cinder-backend.yaml" if args.num_powerflex > 0: env_opts += " -e ~/pilot/templates/overcloud/environments/powerflex-ansible/powerflex-ansible.yaml" env_opts += " -e ~/pilot/templates/dellemc-powerflex-cinder-backend.yaml" env_opts += " -e ~/pilot/templates/custom-dellemc-volume-mappings.yaml" else: env_opts += " -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-ansible.yaml" \ " -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-rgw.yaml" if args.dashboard_enable: env_opts += " -e /usr/share/openstack-tripleo-heat-templates/environments/ceph-ansible/ceph-dashboard.yaml" env_opts += " -e ~/pilot/templates/ceph_dashboard_admin.yaml" # The network-environment.yaml must be included after other templates # for effective parameter overrides (External vlan default route) # The network-environment.yaml must be included after the network-isolation.yaml env_opts += " -e ~/pilot/templates/overcloud/environments/" \ "network-isolation.yaml" \ " -e ~/pilot/templates/network-environment.yaml" \ " -e {} " \ "-e ~/pilot/templates/site-name.yaml".format(nic_env_file) cmd = "cd ;source ~/stackrc; openstack overcloud deploy" \ " {}" \ " --log-file ~/pilot/overcloud_deployment.log" \ " -t {}" \ " {}" \ " --templates ~/pilot/templates/overcloud" \ " {}" \ " --libvirt-type kvm" \ " --no-cleanup" \ " --ntp-server {}" \ "".format(debug, args.timeout, overcloud_name_opt, env_opts, args.ntp_server_fqdn, ) with open(os.path.join(home_dir, 'pilot', 'overcloud_deploy_cmd.log'), 'w') as f: f.write(cmd.replace(' -', ' \\\n -')) f.write('\n') start = time.time() status = run_deploy_command(cmd) end = time.time() logger.info('\nExecution time: {} (hh:mm:ss)'.format( time.strftime('%H:%M:%S', time.gmtime(end - start)))) logger.info('Fetching SSH keys...') update_ssh_config() if status == 0: horizon_url = finalize_overcloud() logger.info("\nDeployment Completed") else: horizon_url = None logger.info('Overcloud nodes:') identify_nodes() if horizon_url: logger.info('\nHorizon Dashboard URL: {}\n'.format(horizon_url)) except Exception as err: print(sys.stderr, err) raise sys.exit(1)