archipelagentcentraldb :: centraldb :: TNCentralDb :: Class TNCentralDb
[hide private]
[frames] | no frames]

Class TNCentralDb

source code

archipelcore.archipelPlugin.TNArchipelPlugin --+
                                               |
                                              TNCentralDb

This contains the necessary interfaces to interact with central agent and central db

Instance Methods [hide private]
 
__init__(self, configuration, entity, entry_point_group)
Initialize the plugin.
source code
 
hook_missed_vms(self, origin=None, user_info=None, arguments=None)
Called when a vm was not ready on first push_vms_in_central_db.
source code
 
hook_vm_event(self, origin=None, user_info=None, arguments=None)
Called when a VM definition or change of definition occurs.
source code
 
hook_vm_unregistered(self, origin=None, user_info=None, arguments=None)
Called when a VM termination occurs.
source code
 
hypervisor_hook_xmpp_authenticated(self, origin=None, user_info=None, arguments=None)
Triggered when we are authenticated.
source code
 
central_agent_jid(self)
Returns the jid of the central agent.
source code
 
handle_central_keepalive_event(self, event)
Called when the central agent sends a keepalive.
source code
 
push_statistics_to_centraldb(self, central_announcement_event)
each time we hear a keepalive, we push relevant statistics to central db
source code
 
handle_first_keepalive(self, keepalive_jid, callback=None, kwargs={})
this is the first keepalive.
source code
 
push_vms_in_central_db(self, origin=None, user_info=None, arguments=None)
there is a new central agent, or we just started.
source code
 
read_hypervisors(self, columns, where_statement, callback)
List vm in database.
source code
 
read_vms(self, columns, where_statement, callback)
Registers a list of vms into central database.
source code
 
register_hypervisors(self, table)
Registers a list of hypervisors into central database.
source code
 
register_vms(self, table)
Registers a list of vms into central database.
source code
 
unregister_hypervisors(self, table)
Unregisters a list of hypervisors from central database.
source code
 
unregister_vms(self, table, callback)
Unregisters a list of vms from central database.
source code
 
update_vms(self, table)
Update a set of vms in central database.
source code
 
update_vms_domain(self, table, callback)
Update a set of vms in central database.
source code
 
update_hypervisors(self, table)
Update a set of hypervisors in central database.
source code
 
commit_to_db(self, action, table, callback)
Sends a command to active central agent for execution
source code
 
read_from_db(self, action, columns, where_statement, callback)
Send a select statement to central db.
source code
 
unpack_entries(self, iq)
Unpack the list of entries from iq for database processing.
source code

Inherited from archipelcore.archipelPlugin.TNArchipelPlugin: register_handlers, unregister_handlers

Static Methods [hide private]
dict
plugin_info()
Return informations about the plugin.
source code
Method Details [hide private]

__init__(self, configuration, entity, entry_point_group)
(Constructor)

source code 

Initialize the plugin.

Parameters:
  • configuration (Configuration object) - the configuration
  • entity (TNArchipelEntity) - the entity that owns the plugin
  • entry_point_group (string) - the group name of plugin entry_point
Overrides: archipelcore.archipelPlugin.TNArchipelPlugin.__init__

hook_vm_event(self, origin=None, user_info=None, arguments=None)

source code 

Called when a VM definition or change of definition occurs. This will advertise definition to the central agent

hook_vm_unregistered(self, origin=None, user_info=None, arguments=None)

source code 

Called when a VM termination occurs. This will advertise undefinition to the central agent.

hypervisor_hook_xmpp_authenticated(self, origin=None, user_info=None, arguments=None)

source code 

Triggered when we are authenticated. Initializes everything.

Parameters:
  • origin (TNArchipelEnity) - the origin of the hook
  • user_info (object) - random user information
  • arguments (object) - runtime argument

central_agent_jid(self)

source code 

Returns the jid of the central agent. In case we are a VM, query hypervisor.

handle_central_keepalive_event(self, event)

source code 

Called when the central agent sends a keepalive.

Parameters:
  • event (xmpp.Node) - the pubsub event node

handle_first_keepalive(self, keepalive_jid, callback=None, kwargs={})

source code 

this is the first keepalive. We query hypervisors that have vm entities somewhere else then we trigger method manage_persistence to instantiate vm entities.

push_vms_in_central_db(self, origin=None, user_info=None, arguments=None)

source code 

there is a new central agent, or we just started. Consequently, we re-populate central database since we are using "on conflict replace" mode of sqlite, inserting an existing uuid will overwrite it.

read_hypervisors(self, columns, where_statement, callback)

source code 

List vm in database.

Parameters:
  • table (list) - the list of hypervisors to insert

read_vms(self, columns, where_statement, callback)

source code 

Registers a list of vms into central database.

Parameters:
  • table (list) - the list of vms to insert

register_hypervisors(self, table)

source code 

Registers a list of hypervisors into central database.

Parameters:
  • table (list) - the list of hypervisors to insert

register_vms(self, table)

source code 

Registers a list of vms into central database.

Parameters:
  • table (list) - the list of vms to insert

unregister_hypervisors(self, table)

source code 

Unregisters a list of hypervisors from central database.

Parameters:
  • table (list) - the list of hypervisors to remove

unregister_vms(self, table, callback)

source code 

Unregisters a list of vms from central database.

Parameters:
  • table (list) - the list of vms to remove
  • callback (func)

update_vms(self, table)

source code 

Update a set of vms in central database.

Parameters:
  • table (list) - the list of vms to update. Must contain the "uuid" attribute as this is the one used for key in the update statement.

update_vms_domain(self, table, callback)

source code 

Update a set of vms in central database. Performs additional checks for domain update when vm is offline.

Parameters:
  • table (list) - the list of vms to update. Must contain the "uuid" attribute as this is the one used for key in the update statement.

update_hypervisors(self, table)

source code 

Update a set of hypervisors in central database.

Parameters:
  • table (list) - the list of hypervisors to update. Must contain the "jid" attribute as this is the one used for key in the update statement.

commit_to_db(self, action, table, callback)

source code 

Sends a command to active central agent for execution

Parameters:
  • command (string) - the sql command to execute
  • command (string) - the table of dicts of values associated with the command.
  • table (table)

read_from_db(self, action, columns, where_statement, callback)

source code 

Send a select statement to central db.

Parameters:
  • command (string) - the sql command to execute
  • columns (string) - the list of database columns to return
  • where_statement (string) - for database reads, provides "where" constraint

unpack_entries(self, iq)

source code 

Unpack the list of entries from iq for database processing.

Parameters:
  • event - received Iq
  • iq (xmpp.Iq)

plugin_info()
Static Method

source code 

Return informations about the plugin.

Returns: dict
dictionary contaning plugin informations
Overrides: archipelcore.archipelPlugin.TNArchipelPlugin.plugin_info