ganeti :: watcher :: state :: WatcherState :: Class WatcherState
[hide private]
[frames] | no frames]

Class WatcherState

source code


Interface to a state file recording restart attempts.

Instance Methods [hide private]
 
__init__(self, statefile)
Open, lock, read and parse the file.
source code
 
Save(self, filename)
Save state to file, then unlock and close it.
source code
 
Close(self)
Unlock configuration file and close it.
source code
 
GetNodeBootID(self, name)
Returns the last boot ID of a node or None.
source code
 
SetNodeBootID(self, name, bootid)
Sets the boot ID of a node.
source code
 
NumberOfRestartAttempts(self, instance_name)
Returns number of previous restart attempts.
source code
 
MaintainInstanceList(self, instances)
Perform maintenance on the recorded instances.
source code
 
RecordRestartAttempt(self, instance_name)
Record a restart attempt.
source code
 
RemoveInstance(self, instance_name)
Update state to reflect that a machine is running.
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, statefile)
(Constructor)

source code 

Open, lock, read and parse the file.

Parameters:
  • statefile (file) - State file object
Overrides: object.__init__

NumberOfRestartAttempts(self, instance_name)

source code 

Returns number of previous restart attempts.

Parameters:
  • instance_name (string) - the name of the instance to look up

MaintainInstanceList(self, instances)

source code 

Perform maintenance on the recorded instances.

Parameters:
  • instances (list of string) - the list of currently existing instances

RecordRestartAttempt(self, instance_name)

source code 

Record a restart attempt.

Parameters:
  • instance_name (string) - the name of the instance being restarted

RemoveInstance(self, instance_name)

source code 

Update state to reflect that a machine is running.

This method removes the record for a named instance (as we only track down instances).

Parameters:
  • instance_name (string) - the name of the instance to remove from books