def ev_close(self, worker): """ Check process termination status and generate appropriate events. Note that if fsck has correctly fixed some errors, actions will be considered as successful. """ if worker.did_timeout(): return FSAction.ev_close(self, worker) # We want to skip FSAction.ev_close(), just call the upper layer. Action.ev_close(self, worker) self.comp.lustre_check() # fsck returns 0=NOERROR, 1=OK_BUT_CORRECTION, 2=OK_BUT_REBOOT. # see man fsck. if worker.retcode() in (0, 1, 2, 4): # action succeeded result = Result(duration=self.duration, retcode=worker.retcode()) if worker.retcode() in (1, 2): result.message = "Errors corrected" if worker.retcode() == 4: # -n result.message = "Errors found but NOT corrected" self.comp.action_event(self, 'done', result) self.set_status(ACT_OK) else: # action failed msg = "\n".join(self._output) result = ErrorResult(msg, self.duration, worker.retcode()) self.comp.action_event(self, 'failed', result) self.set_status(ACT_ERROR)
def _already_done(self): if len(self.server.modules) == 0: return Result("modules already unloaded") # If some devices are still loaded, do not try to unload # and do not consider this as an error. count = self._device_count() if count > 0: return Result('ignoring, still %d in-use lustre device(s)' % count) # Check still in use? self.server.raise_if_mod_in_use()
def _already_done(self): """Return a Result object if the client is already mounted.""" if self.comp.is_started(): return Result("%s is already mounted on %s" % (self.comp.fs.fs_name, self.comp.mtpt)) else: return None
def ev_close(self, worker): """ Check process termination status and set action status. """ Action.ev_close(self, worker) self.server.lustre_check() # Action timed out if worker.did_timeout(): self.server.action_event(self, 'timeout') self.set_status(ACT_ERROR) # Action succeeded elif worker.retcode() == 0: result = Result(duration=self.duration, retcode=worker.retcode()) self.server.action_event(self, 'done', result) self.set_status(ACT_OK) # Action failed else: result = ErrorResult(worker.read(), self.duration, worker.retcode()) self.server.action_event(self, 'failed', result) self.set_status(ACT_ERROR)
def _already_done(self): """Return a Result object is the target is already unmounted.""" if self.comp.is_stopped(): return Result(message="%s is already stopped" % self.comp.label) # LBUG #18624 if not self.comp.dev_isblk: task_self().set_info("fanout", 1) return None
def _launch(self): """ Run the command to process the action. It checks the command could be really be run before running it. """ self.server.action_event(self, 'start') try: self.server.lustre_check() result = self._already_done() if not result: self._shell() else: self.server.action_event(self, 'done', result) self.set_status(ACT_OK) except ServerError, error: self.server.action_event(self, 'failed', Result(str(error))) self.set_status(ACT_ERROR)
def _already_done(self): if self._modname in self.server.modules: return Result("'%s' is already loaded" % self._modname)
def __init__(self, passid, current, total): Result.__init__(self) self.pass_id = int(passid) self.pass_progress = float(current) / float(total)
def _already_done(self): """Return a Result object if the filesystem is not mounted already.""" if self.comp.is_stopped(): return Result("%s is not mounted" % self.comp.fs.fs_name) else: return None
def _already_done(self): """Return a Result object if the router is already stopped.""" if self.comp.is_stopped(): return Result('router is already disabled') else: return None
def _already_done(self): """Return a Result object is the router is already enabled.""" if self.comp.is_started(): return Result('router is already enabled') else: return None