class documentation

class BaseOpCode(outils.ValidatedSlots):

Known subclasses: ganeti.opcodes.OpCode

View In Hierarchy

A simple serializable object.

This object serves as a parent class for OpCode without any custom field handling.

Class Method GetAllParams Compute list of all parameters for an opcode.
Method __getstate__ Generic serializer.
Method __init__ Constructor for BaseOpCode.
Method __setstate__ Generic unserializer.
Method Validate Validate opcode parameters, optionally setting default values.

Inherited from ValidatedSlots:

Class Method GetAllSlots Compute the list of all declared slots for a class.
Class Variable __slots__ Undocumented
@classmethod
def GetAllParams(cls):

Compute list of all parameters for an opcode.

def __getstate__(self):
overridden in ganeti.opcodes.OpCode

Generic serializer.

This method just returns the contents of the instance as a dictionary.

Returns
dictthe instance attributes and their values
def __init__(self, **kwargs):

Constructor for BaseOpCode.

The constructor takes only keyword arguments and will set attributes on this object based on the passed arguments. As such, it means that you should not pass arguments which are not in the __slots__ attribute for this class.

def __setstate__(self, state):

Generic unserializer.

This method just restores from the serialized state the attributes of the current instance.

Parameters
state:dictthe serialized opcode data
def Validate(self, set_defaults):

Validate opcode parameters, optionally setting default values.

Parameters
set_defaults:boolwhether to set default values
Returns
NoneTypeNone, if the validation succeeds
Raises
errors.OpPrereqErrorwhen a parameter value doesn't match requirements