def check_before_deployment(self, supertask): # checking admin intersection with untagged network_info = NetworkConfigurationSerializer\ .serialize_for_cluster( self.cluster ) check_networks = supertask.create_subtask('check_networks') self._call_silently(check_networks, tasks.CheckNetworksTask, data=network_info, check_admin_untagged=True) db().refresh(check_networks) if check_networks.status == 'error': logger.warning("Checking networks failed: %s", check_networks.message) raise errors.CheckBeforeDeploymentError(check_networks.message) db().delete(check_networks) db().commit() # checking prerequisites check_before = supertask.create_subtask('check_before_deployment') logger.debug("Checking prerequisites task: %s", check_before.uuid) self._call_silently(check_before, tasks.CheckBeforeDeploymentTask) db().refresh(check_before) # if failed to check prerequisites # then task is already set to error if check_before.status == 'error': logger.warning("Checking prerequisites failed: %s", check_before.message) raise errors.CheckBeforeDeploymentError(check_before.message) logger.debug( "Checking prerequisites is successful, starting deployment...") db().delete(check_before) db().commit()
def check_before_deployment(self, supertask): """Performs checks before deployment :param supertask: task SqlAlchemy object """ # checking admin intersection with untagged network_info = self.serialize_network_cfg(self.cluster) network_info["networks"] = [ n for n in network_info["networks"] if n["name"] != "fuelweb_admin" ] check_repo_connect = supertask.create_subtask( consts.TASK_NAMES.check_networks) self._call_silently( check_repo_connect, tasks.CheckRepositoryConnectionFromMasterNodeTask, ) if check_repo_connect.status == consts.TASK_STATUSES.error: logger.warning("Checking connectivity to repositories failed: %s", check_repo_connect.message) raise errors.CheckBeforeDeploymentError(check_repo_connect.message) check_networks = supertask.create_subtask( consts.TASK_NAMES.check_networks) self._call_silently(check_networks, tasks.CheckNetworksTask, data=network_info, check_admin_untagged=True) if check_networks.status == consts.TASK_STATUSES.error: logger.warning("Checking networks failed: %s", check_networks.message) raise errors.CheckBeforeDeploymentError(check_networks.message) TaskHelper.set_ready_if_not_finished(check_networks) db().delete(check_networks) db().refresh(supertask) db().flush() # checking prerequisites check_before = supertask.create_subtask( consts.TASK_NAMES.check_before_deployment) logger.debug("Checking prerequisites task: %s", check_before.uuid) self._call_silently(check_before, tasks.CheckBeforeDeploymentTask) # if failed to check prerequisites # then task is already set to error if check_before.status == consts.TASK_STATUSES.error: logger.warning("Checking prerequisites failed: %s", check_before.message) raise errors.CheckBeforeDeploymentError(check_before.message) logger.debug( "Checking prerequisites is successful, starting deployment...") TaskHelper.set_ready_if_not_finished(check_before) db().delete(check_before) db().refresh(supertask) db().flush()
def _check_vmware_consistency(cls, task): """Checks vmware attributes consistency and proper values """ attributes = task.cluster.attributes.editable vmware_attributes = task.cluster.vmware_attributes # Old(< 6.1) clusters haven't vmware support if vmware_attributes: cinder_nodes = filter(lambda node: 'cinder' in node.all_roles, task.cluster.nodes) if not cinder_nodes: logger.info('There is no any node with "cinder" role provided') models = { 'settings': attributes, 'default': vmware_attributes.editable, 'cluster': task.cluster, 'version': settings.VERSION, 'networking_parameters': task.cluster.network_config } errors_msg = VmwareAttributesRestriction.check_data( models=models, metadata=vmware_attributes.editable['metadata'], data=vmware_attributes.editable['value']) if errors_msg: raise errors.CheckBeforeDeploymentError('\n'.join(errors_msg))
def execute(cls, task): failed_repositories = cls._get_failed_repositories(task) if len(failed_repositories) > 0: error_message = ("Connection to following repositories" " could not be established: {0}").format( ', '.join(failed_repositories)) raise errors.CheckBeforeDeploymentError(error_message) task.status = 'ready' task.progress = '100' db().commit()
def check_before_deployment(self, supertask): # checking admin intersection with untagged network_info = self.serialize_network_cfg(self.cluster) network_info["networks"] = [ n for n in network_info["networks"] if n["name"] != "fuelweb_admin" ] check_networks = supertask.create_subtask(TASK_NAMES.check_networks) self._call_silently(check_networks, tasks.CheckNetworksTask, data=network_info, check_admin_untagged=True) if check_networks.status == TASK_STATUSES.error: logger.warning("Checking networks failed: %s", check_networks.message) raise errors.CheckBeforeDeploymentError(check_networks.message) db().delete(check_networks) db().refresh(supertask) db().flush() # checking prerequisites check_before = supertask.create_subtask( TASK_NAMES.check_before_deployment) logger.debug("Checking prerequisites task: %s", check_before.uuid) self._call_silently(check_before, tasks.CheckBeforeDeploymentTask) # if failed to check prerequisites # then task is already set to error if check_before.status == TASK_STATUSES.error: logger.warning("Checking prerequisites failed: %s", check_before.message) raise errors.CheckBeforeDeploymentError(check_before.message) logger.debug( "Checking prerequisites is successful, starting deployment...") db().delete(check_before) db().refresh(supertask) db().flush()
def check_before_deployment(self, supertask): """Performs checks before deployment :param supertask: task SqlAlchemy object """ try: # if there are VIPs with same names in the network configuration # the error will be raised. Such situation may occur when, for # example, enabled plugins contain conflicting network # configuration network_info = self.serialize_network_cfg(self.cluster) except (errors.DuplicatedVIPNames, errors.NetworkRoleConflict) as e: raise errors.CheckBeforeDeploymentError(e.message) logger.info(u"Network info:\n{0}".format( jsonutils.dumps(network_info, indent=4))) # checking admin intersection with untagged network_info["networks"] = [ n for n in network_info["networks"] if n["name"] != "fuelweb_admin" ] check_repo_connect = supertask.create_subtask( consts.TASK_NAMES.check_networks) self._call_silently( check_repo_connect, tasks.CheckRepositoryConnectionFromMasterNodeTask, ) if check_repo_connect.status == consts.TASK_STATUSES.error: logger.warning("Checking connectivity to repositories failed: %s", check_repo_connect.message) raise errors.CheckBeforeDeploymentError(check_repo_connect.message) check_networks = supertask.create_subtask( consts.TASK_NAMES.check_networks) self._call_silently(check_networks, tasks.CheckNetworksTask, data=network_info, check_admin_untagged=True) if check_networks.status == consts.TASK_STATUSES.error: logger.warning("Checking networks failed: %s", check_networks.message) raise errors.CheckBeforeDeploymentError(check_networks.message) TaskHelper.set_ready_if_not_finished(check_networks) db().delete(check_networks) db().refresh(supertask) db().flush() # checking prerequisites check_before = supertask.create_subtask( consts.TASK_NAMES.check_before_deployment) logger.debug("Checking prerequisites task: %s", check_before.uuid) self._call_silently(check_before, tasks.CheckBeforeDeploymentTask) # if failed to check prerequisites # then task is already set to error if check_before.status == consts.TASK_STATUSES.error: logger.warning("Checking prerequisites failed: %s", check_before.message) raise errors.CheckBeforeDeploymentError(check_before.message) logger.debug( "Checking prerequisites is successful, starting deployment...") TaskHelper.set_ready_if_not_finished(check_before) db().delete(check_before) db().refresh(supertask) db().flush()