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'])
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.'))
def _check_host(ihost): if utils.is_aio_simplex_host_unlocked(ihost): raise wsme.exc.ClientSideError(_("Host must be locked.")) elif ihost['administrative'] != 'locked': unlocked = False current_ihosts = pecan.request.dbapi.ihost_get_list() for h in current_ihosts: if (h['administrative'] != 'locked' and h['hostname'] != ihost['hostname']): unlocked = True if unlocked: raise wsme.exc.ClientSideError(_("Host must be locked."))
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'])))