Script ganeti_watcher :: Class WatcherState
[hide private]
[frames] | no frames]

Class WatcherState


Interface to a state file recording restart attempts.

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

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)

 

Open, lock, read and parse the file.

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

NumberOfRestartAttempts(self, instance)

 

Returns number of previous restart attempts.

Parameters:
  • instance (Instance) - the instance to look up

MaintainInstanceList(self, instances)

 

Perform maintenance on the recorded instances.

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

RecordRestartAttempt(self, instance)

 

Record a restart attempt.

Parameters:
  • instance (Instance) - the instance being restarted

RemoveInstance(self, instance)

 

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 (Instance) - the instance to remove from books