def test_create_cephx_key(self): key = utils.create_cephx_key() self.assertEqual(len(key), 40)
def _update_parameters(self, args, network_client, stack): parameters = {} stack_is_new = stack is None self.log.debug("Generating overcloud passwords") self.set_overcloud_passwords(stack_is_new, parameters) timestamp = int(time.time()) parameters['DeployIdentifier'] = timestamp # Update parameters from answers file: if args.answers_file is not None: with open(args.answers_file, 'r') as answers_file: answers = yaml.load(answers_file) if args.templates is None: args.templates = answers['templates'] if 'environments' in answers: if args.environment_files is not None: answers['environments'].extend(args.environment_files) args.environment_files = answers['environments'] param_args = (('NeutronPublicInterface', 'neutron_public_interface'), ('NeutronBridgeMappings', 'neutron_bridge_mappings'), ('NeutronFlatNetworks', 'neutron_flat_networks'), ('HypervisorNeutronPhysicalBridge', 'neutron_physical_bridge'), ('NtpServer', 'ntp_server'), ('ControllerCount', 'control_scale'), ('ComputeCount', 'compute_scale'), ('ObjectStorageCount', 'swift_storage_scale'), ('BlockStorageCount', 'block_storage_scale'), ('CephStorageCount', 'ceph_storage_scale'), ('OvercloudControlFlavor', 'control_flavor'), ('OvercloudComputeFlavor', 'compute_flavor'), ('OvercloudBlockStorageFlavor', 'block_storage_flavor'), ('OvercloudSwiftStorageFlavor', 'swift_storage_flavor'), ('OvercloudCephStorageFlavor', 'ceph_storage_flavor'), ('NeutronNetworkVLANRanges', 'neutron_network_vlan_ranges'), ('NeutronMechanismDrivers', 'neutron_mechanism_drivers')) if stack_is_new: new_stack_args = ( ('NeutronNetworkType', 'neutron_network_type'), ('NeutronTunnelIdRanges', 'neutron_tunnel_id_ranges'), ('NeutronTunnelTypes', 'neutron_tunnel_types'), ('NeutronVniRanges', 'neutron_vni_ranges'), ('NovaComputeLibvirtType', 'libvirt_type'), ) param_args = param_args + new_stack_args if args.neutron_disable_tunneling is not None: neutron_enable_tunneling = (not args.neutron_disable_tunneling) parameters.update({ 'NeutronEnableTunnelling': neutron_enable_tunneling, }) # Update parameters from commandline for param, arg in param_args: if getattr(args, arg, None) is not None: # these must be converted to [] which is what Heat expects if param.endswith( ('NeutronTunnelIdRanges', 'NeutronVniRanges')): parameters[param] = [getattr(args, arg)] else: parameters[param] = getattr(args, arg) # Scaling needs extra parameters number_controllers = int(parameters.get('ControllerCount', 0)) if number_controllers > 1: if not args.ntp_server: raise exceptions.InvalidConfiguration( 'Specify --ntp-server when using multiple controllers ' '(with HA).') parameters.update({ 'NeutronL3HA': True, 'NeutronAllowL3AgentFailover': False, }) else: parameters.update({ 'NeutronL3HA': False, 'NeutronAllowL3AgentFailover': False, }) dhcp_agents_per_network = (min(number_controllers, 3) if number_controllers else 1) parameters.update({ 'NeutronDhcpAgentsPerNetwork': dhcp_agents_per_network, }) if int(parameters.get('CephStorageCount', 0)) > 0: if stack_is_new: parameters.update({ 'CephClusterFSID': six.text_type(uuid.uuid1()), 'CephMonKey': utils.create_cephx_key(), 'CephAdminKey': utils.create_cephx_key() }) return parameters
def _update_paramaters(self, args, network_client, stack): parameters = PARAMETERS.copy() if stack is None: parameters.update(NEW_STACK_PARAMETERS) self.log.debug("Generating overcloud passwords") self.set_overcloud_passwords(parameters, args) self.log.debug("Getting ctlplane from Neutron") net = network_client.api.find_attr('networks', 'ctlplane') parameters['NeutronControlPlaneID'] = net['id'] param_args = ( ('NeutronPublicInterface', 'neutron_public_interface'), ('NeutronBridgeMappings', 'neutron_bridge_mappings'), ('NeutronFlatNetworks', 'neutron_flat_networks'), ('HypervisorNeutronPhysicalBridge', 'neutron_physical_bridge'), ('NtpServer', 'ntp_server'), ('ControllerCount', 'control_scale'), ('ComputeCount', 'compute_scale'), ('ObjectStorageCount', 'swift_storage_scale'), ('BlockStorageCount', 'block_storage_scale'), ('CephStorageCount', 'ceph_storage_scale'), ('OvercloudControlFlavor', 'control_flavor'), ('OvercloudComputeFlavor', 'compute_flavor'), ('OvercloudBlockStorageFlavor', 'block_storage_flavor'), ('OvercloudSwiftStorageFlavor', 'swift_storage_flavor'), ('OvercloudCephStorageFlavor', 'ceph_storage_flavor'), ('NeutronNetworkVLANRanges', 'neutron_network_vlan_ranges'), ('NeutronMechanismDrivers', 'neutron_mechanism_drivers') ) if stack is None: new_stack_args = ( ('NeutronNetworkType', 'neutron_network_type'), ('NeutronTunnelIdRanges', 'neutron_tunnel_id_ranges'), ('NeutronTunnelTypes', 'neutron_tunnel_types'), ('NeutronVniRanges', 'neutron_vni_ranges'), ('NovaComputeLibvirtType', 'libvirt_type'), ) param_args = param_args + new_stack_args if args.neutron_disable_tunneling is not None: neutron_enable_tunneling = ( not args.neutron_disable_tunneling) parameters.update({ 'NeutronEnableTunnelling': neutron_enable_tunneling, }) # Update parameters from commandline for param, arg in param_args: if getattr(args, arg, None) is not None: # these must be converted to [] which is what Heat expects if param.endswith(('NeutronTunnelIdRanges', 'NeutronVniRanges')): parameters[param] = [getattr(args, arg)] else: parameters[param] = getattr(args, arg) # Scaling needs extra parameters number_controllers = int(parameters.get('ControllerCount', 0)) if number_controllers > 1: if not args.ntp_server: raise Exception('Specify --ntp-server when using multiple' ' controllers (with HA).') parameters.update({ 'NeutronL3HA': True, 'NeutronAllowL3AgentFailover': False, }) else: parameters.update({ 'NeutronL3HA': False, 'NeutronAllowL3AgentFailover': False, }) dhcp_agents_per_network = (min(number_controllers, 3) if number_controllers else 1) parameters.update({ 'NeutronDhcpAgentsPerNetwork': dhcp_agents_per_network, }) if int(parameters.get('CephStorageCount', 0)) > 0: if stack is None: parameters.update({ 'CephClusterFSID': six.text_type(uuid.uuid1()), 'CephMonKey': utils.create_cephx_key(), 'CephAdminKey': utils.create_cephx_key() }) return parameters
def _update_parameters(self, args, network_client, stack): parameters = {} stack_is_new = stack is None self.log.debug("Generating overcloud passwords") self.set_overcloud_passwords(stack_is_new, parameters) timestamp = int(time.time()) parameters['DeployIdentifier'] = timestamp # Update parameters from answers file: if args.answers_file is not None: with open(args.answers_file, 'r') as answers_file: answers = yaml.load(answers_file) if args.templates is None: args.templates = answers['templates'] if 'environments' in answers: if args.environment_files is not None: answers['environments'].extend(args.environment_files) args.environment_files = answers['environments'] param_args = ( ('NeutronPublicInterface', 'neutron_public_interface'), ('NeutronBridgeMappings', 'neutron_bridge_mappings'), ('NeutronFlatNetworks', 'neutron_flat_networks'), ('HypervisorNeutronPhysicalBridge', 'neutron_physical_bridge'), ('NtpServer', 'ntp_server'), ('ControllerCount', 'control_scale'), ('ComputeCount', 'compute_scale'), ('ObjectStorageCount', 'swift_storage_scale'), ('BlockStorageCount', 'block_storage_scale'), ('CephStorageCount', 'ceph_storage_scale'), ('OvercloudControlFlavor', 'control_flavor'), ('OvercloudComputeFlavor', 'compute_flavor'), ('OvercloudBlockStorageFlavor', 'block_storage_flavor'), ('OvercloudSwiftStorageFlavor', 'swift_storage_flavor'), ('OvercloudCephStorageFlavor', 'ceph_storage_flavor'), ('NeutronNetworkVLANRanges', 'neutron_network_vlan_ranges'), ('NeutronMechanismDrivers', 'neutron_mechanism_drivers') ) if stack_is_new: new_stack_args = ( ('NeutronNetworkType', 'neutron_network_type'), ('NeutronTunnelIdRanges', 'neutron_tunnel_id_ranges'), ('NeutronTunnelTypes', 'neutron_tunnel_types'), ('NeutronVniRanges', 'neutron_vni_ranges'), ('NovaComputeLibvirtType', 'libvirt_type'), ) param_args = param_args + new_stack_args if args.neutron_disable_tunneling is not None: neutron_enable_tunneling = ( not args.neutron_disable_tunneling) parameters.update({ 'NeutronEnableTunnelling': neutron_enable_tunneling, }) # Update parameters from commandline for param, arg in param_args: if getattr(args, arg, None) is not None: # these must be converted to [] which is what Heat expects if param.endswith(('NeutronTunnelIdRanges', 'NeutronVniRanges')): parameters[param] = [getattr(args, arg)] else: parameters[param] = getattr(args, arg) # Scaling needs extra parameters number_controllers = int(parameters.get('ControllerCount', 0)) if number_controllers > 1: if not args.ntp_server: raise exceptions.InvalidConfiguration( 'Specify --ntp-server when using multiple controllers ' '(with HA).') parameters.update({ 'NeutronL3HA': True, 'NeutronAllowL3AgentFailover': False, }) else: parameters.update({ 'NeutronL3HA': False, 'NeutronAllowL3AgentFailover': False, }) dhcp_agents_per_network = (min(number_controllers, 3) if number_controllers else 1) parameters.update({ 'NeutronDhcpAgentsPerNetwork': dhcp_agents_per_network, }) if int(parameters.get('CephStorageCount', 0)) > 0: if stack_is_new: parameters.update({ 'CephClusterFSID': six.text_type(uuid.uuid1()), 'CephMonKey': utils.create_cephx_key(), 'CephAdminKey': utils.create_cephx_key() }) return parameters