Package ganeti :: Package cmdlib :: Module base :: Class Tasklet
[hide private]
[frames] | no frames]

Class Tasklet

source code


Tasklet base class.

Tasklets are subcomponents for LUs. LUs can consist entirely of tasklets or they can mix legacy code with tasklets. Locking needs to be done in the LU, tasklets know nothing about locks.

Subclasses must follow these rules:

Instance Methods [hide private]
 
__init__(self, lu)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
CheckPrereq(self)
Check prerequisites for this tasklets.
source code
 
Exec(self, feedback_fn)
Execute the tasklet.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, lu)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

CheckPrereq(self)

source code 

Check prerequisites for this tasklets.

This method should check whether the prerequisites for the execution of this tasklet are fulfilled. It can do internode communication, but it should be idempotent - no cluster or system changes are allowed.

The method should raise errors.OpPrereqError in case something is not fulfilled. Its return value is ignored.

This method should also update all parameters to their canonical form if it hasn't been done before.

Exec(self, feedback_fn)

source code 

Execute the tasklet.

This method should implement the actual work. It should raise errors.OpExecError for failures that are somewhat dealt with in code, or expected.