Esempio n. 1
0
 def _check_host_state(self, host_id):
     host = pecan.request.dbapi.ihost_get(host_id)
     if utils.is_aio_simplex_host_unlocked(host):
         raise exception.HostMustBeLocked(host=host['hostname'])
     elif host['administrative'] != constants.ADMIN_LOCKED and not \
             utils.is_host_simplex_controller(host):
         raise exception.HostMustBeLocked(host=host['hostname'])
Esempio n. 2
0
def _check_host(ihost):
    if utils.is_aio_simplex_host_unlocked(ihost):
        raise exception.HostMustBeLocked(host=ihost['hostname'])
    elif ihost.administrative != constants.ADMIN_LOCKED and not \
            utils.is_host_simplex_controller(ihost):
        raise wsme.exc.ClientSideError(_('Host must be locked.'))
    if constants.WORKER not in ihost.subfunctions:
        raise wsme.exc.ClientSideError(_('Can only modify worker node cores.'))
Esempio n. 3
0
 def _check_hosts(self):
     hosts = pecan.request.dbapi.ihost_get_list()
     for h in hosts:
         if api_utils.is_aio_simplex_host_unlocked(h):
             raise wsme.exc.ClientSideError(
                 _("Host {} must be locked.".format(h['hostname'])))
         elif (h['administrative'] != constants.ADMIN_LOCKED
               and constants.WORKER in h['subfunctions']
               and not api_utils.is_host_active_controller(h)
               and not api_utils.is_host_simplex_controller(h)):
             raise wsme.exc.ClientSideError(
                 _("Host {} must be locked.".format(h['hostname'])))
Esempio n. 4
0
    def _pre_manual_apply_check(self, conductor_obj, app, hook_info):
        """Semantic check for evaluating app manual apply

        :param conductor_obj: conductor object
        :param app: AppOperator.Application object
        :param hook_info: LifecycleHookInfo object

        """
        # Check AIO-SX node stable state
        active_controller = utils.HostHelper.get_active_controller(
            conductor_obj.dbapi)
        if (utils.is_host_simplex_controller(active_controller)
                and not active_controller.vim_progress_status.startswith(
                    constants.VIM_SERVICES_ENABLED)):
            LOG.info("%s requires application-apply, but some VIM services "
                     "are not at services-enabled state on node %s. "
                     "Application-apply rejected." %
                     (app.name, active_controller.hostname))
            raise exception.LifecycleSemanticCheckException(
                "Application-apply rejected: operation is not allowed "
                "while the node {} not in {} state.".format(
                    active_controller.hostname,
                    constants.VIM_SERVICES_ENABLED))