On 07/13/2012 02:53 PM, Lee Yarwood wrote:
Hello all,
I'm looking into the use case around an aborted task within vdsmd. AFAICT both engine and vdsClient are unable to deal with an aborted task at present.
Within engine we call HSMStopTaskVDSCommand, this inturn calls stopTask supplying _only_ the task_guid. vdsClient also calls stopTask with only the task_guid argument.
Why does this matter? Well the only was you can kill an aborted task is by passing the force=True argument to the stop method of the task object itself. Without this the _incref method will throw a TaskAborted exception and we will be unable to stop the task.
Could anyone give me some background on why this is the case before I start looking into exposing the force option up the stack to engine and vdsClient.
Relevant code snippets from task.py below.
Thanks in advance,
Lee
vdsm/storage/task.py
1198 def stop(self, force=False): 1199 self.log.debug("stopping in state %s (force %s)", self.state, force) 1200 self._incref(force) 1201 try: 1202 if self.state.isDone(): 1203 self.log.debug("Task already stopped (%s), ignoring", self.state) 1204 return 1205 elif self.state.isRecovering() and not force and (self.cleanPolicy == TaskCleanType.auto): 1206 self.log.debug("Task (%s) in recovery and force is false, ignoring", self.state) 1207 return 1208 1209 self._aborting = True 1210 self._forceAbort = force 1211 finally: 1212 self._decref(force)
959 def _incref(self, force=False): 960 self.lock.acquire() 961 try: 962 if self.aborting() and (self._forceAbort or not force): 963 raise se.TaskAborted(unicode(self)) 964 965 self.ref += 1 966 ref = self.ref 967 return ref 968 finally: 969 self.lock.release()
Bump, any thoughts? Apologies if this is a little ovirt-engine centric for the list.
Lee