def _deploy_tripleo_heat_templates(self, stack, parsed_args): """Deploy the fixed templates in TripleO Heat Templates""" clients = self.app.client_manager network_client = clients.network parameters = self._update_paramaters(parsed_args, network_client, stack) utils.check_nodes_count( self.app.client_manager.tripleoclient.baremetal(), stack, parameters, { 'ControllerCount': 1, 'ComputeCount': 1, 'ObjectStorageCount': 0, 'BlockStorageCount': 0, 'CephStorageCount': 0, }) tht_root = parsed_args.templates print("Deploying templates in the directory {0}".format( os.path.abspath(tht_root))) self.log.debug("Creating Environment file") # TODO(jprovazn): env file generated by create_environment_file() # is not very usable any more, scale params are included in # parameters and keystone cert is generated on create only env_path = utils.create_environment_file() environments = [] add_registry = False if stack is None: self.log.debug("Creating Keystone certificates") keystone_pki.generate_certs_into_json(env_path, False) environments.append(env_path) add_registry = True environments.extend(self._create_parameters_env(parameters)) if parsed_args.rhel_reg: reg_env = self._create_registration_env(parsed_args) environments.extend(reg_env) add_registry = True if parsed_args.environment_files: environments.extend(parsed_args.environment_files) add_registry = True if add_registry: # default resource registry file should be passed only # when creating a new stack, or when custom environments are # specified, otherwise it might overwrite # resource_registries in existing stack resource_registry_path = os.path.join( tht_root, constants.RESOURCE_REGISTRY_NAME) environments.insert(0, resource_registry_path) overcloud_yaml = os.path.join(tht_root, constants.OVERCLOUD_YAML_NAME) self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters, environments, parsed_args.timeout)
def _deploy_tripleo_heat_templates(self, stack, parsed_args): """Deploy the fixed templates in TripleO Heat Templates""" clients = self.app.client_manager network_client = clients.network parameters = self._update_paramaters( parsed_args, network_client, stack) utils.check_nodes_count( self.app.client_manager.tripleoclient.baremetal(), stack, parameters, { 'ControllerCount': 1, 'ComputeCount': 1, 'ObjectStorageCount': 0, 'BlockStorageCount': 0, 'CephStorageCount': 0, } ) tht_root = parsed_args.templates print("Deploying templates in the directory {0}".format( os.path.abspath(tht_root))) self.log.debug("Creating Environment file") # TODO(jprovazn): env file generated by create_environment_file() # is not very usable any more, scale params are included in # parameters and keystone cert is generated on create only env_path = utils.create_environment_file() environments = [] if stack is None: self.log.debug("Creating Keystone certificates") keystone_pki.generate_certs_into_json(env_path, False) # default resource registry file should be passed only # when creating a new stack, otherwise it might overwrite # resource_registries in existing stack resource_registry_path = os.path.join(tht_root, RESOURCE_REGISTRY_NAME) environments.extend([resource_registry_path, env_path]) environments.extend(self._create_parameters_env(parameters)) if parsed_args.rhel_reg: reg_env = self._create_registration_env(parsed_args) environments.extend(reg_env) if parsed_args.environment_files: environments.extend(parsed_args.environment_files) overcloud_yaml = os.path.join(tht_root, OVERCLOUD_YAML_NAME) self._heat_deploy(stack, parsed_args.stack, overcloud_yaml, parameters, environments, parsed_args.timeout)
def test_check_default_param_not_in_stack(self): user_params = {'ControllerCount': 3} missing_param = 'CephStorageCount' self.stack.parameters = self.defaults.copy() del self.stack.parameters[missing_param] self.assertEqual((False, 4, 3), utils.check_nodes_count(self.baremetal, self.stack, user_params, self.defaults))
def test_check_nodes_count_custom_roles_scale_too_much(self): user_params = { 'ControllerApiCount': 3, 'ControllerPacemakerCount': 3, 'ComputeDvrCount': 6 } self.assertEqual((False, 12, 11), utils.check_nodes_count(self.baremetal, self.stack, user_params, self.custom_roles_defaults))
def test_check_nodes_count_custom_roles_scale_enough_nodes(self): user_params = { 'ControllerApiCount': 3, 'ControllerPacemakerCount': 3, 'ComputeDvrCount': 3 } self.assertEqual((True, 9, 11), utils.check_nodes_count(self.baremetal, self.stack, user_params, self.custom_roles_defaults))
def _predeploy_verify_capabilities(self, stack, parameters, parsed_args): self.predeploy_errors = 0 self.predeploy_warnings = 0 self.log.debug("Starting _pre_verify_capabilities") bm_client = self.app.client_manager.baremetal self._check_boot_images() flavors = self._collect_flavors(parsed_args) self._check_ironic_boot_configuration(bm_client) errors, warnings = utils.assign_and_verify_profiles( bm_client, flavors, assign_profiles=False, dry_run=parsed_args.dry_run ) self.predeploy_errors += errors self.predeploy_warnings += warnings compute_client = self.app.client_manager.compute self.log.debug("Checking hypervisor stats") if utils.check_hypervisor_stats(compute_client) is None: self.log.error("Expected hypervisor stats not met") self.predeploy_errors += 1 self.log.debug("Checking nodes count") enough_nodes, count, ironic_nodes_count = utils.check_nodes_count( bm_client, stack, parameters, { 'ControllerCount': 1, 'ComputeCount': 1, 'ObjectStorageCount': 0, 'BlockStorageCount': 0, 'CephStorageCount': 0, } ) if not enough_nodes: self.log.error( "Not enough nodes - available: {0}, requested: {1}".format( ironic_nodes_count, count)) self.predeploy_errors += 1 return self.predeploy_errors, self.predeploy_warnings
def test_check_nodes_count_scale_enough_nodes(self): user_params = {'ControllerCount': 2} self.assertEqual( True, utils.check_nodes_count(self.baremetal, None, user_params, self.defaults))
def test_check_nodes_count_scale_enough_nodes(self): user_params = {'ControllerCount': 2} self.assertEqual(True, utils.check_nodes_count(self.baremetal, None, user_params, self.defaults))
def test_check_nodes_count_scale_too_much(self): user_params = {'ControllerCount': 3} self.assertEqual((False, 4, 3), utils.check_nodes_count(self.baremetal, self.stack, user_params, self.defaults))