Package ganeti :: Module opcodes :: Class BaseOpCode
[hide private]
[frames] | no frames]

Class BaseOpCode

source code


A simple serializable object.

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

Nested Classes [hide private]
  __metaclass__
Meta class for opcode definitions.
Instance Methods [hide private]
 
__init__(self, **kwargs)
Constructor for BaseOpCode.
source code
dict
__getstate__(self)
Generic serializer.
source code
 
__setstate__(self, state)
Generic unserializer.
source code
 
Validate(self, set_defaults)
Validate opcode parameters, optionally setting default values.
source code

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

Class Methods [hide private]
 
_all_slots(cls)
Compute the list of all declared slots for a class.
source code
 
GetAllParams(cls)
Compute list of all parameters for an opcode.
source code
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, **kwargs)
(Constructor)

source code 

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.

Overrides: object.__init__

__getstate__(self)

source code 

Generic serializer.

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

Returns: dict
the instance attributes and their values

__setstate__(self, state)

source code 

Generic unserializer.

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

Parameters:
  • state (dict) - the serialized opcode data

Validate(self, set_defaults)

source code 

Validate opcode parameters, optionally setting default values.

Parameters:
  • set_defaults (bool) - Whether to set default values
Raises: