Package archipelcentral :: Module archipelCentralAgent :: Class TNArchipelCentralAgent
[hide private]
[frames] | no frames]

Class TNArchipelCentralAgent

source code

                                                              object --+    
                                                                       |    
                            archipelcore.archipelEntity.TNArchipelEntity --+
                                                                           |
                                                              object --+   |
                                                                       |   |
                    archipelcore.archipelHookableEntity.TNHookableEntity --+
                                                                           |
                                                              object --+   |
                                                                       |   |
archipelcore.archipelAvatarControllableEntity.TNAvatarControllableEntity --+
                                                                           |
                                                              object --+   |
                                                                       |   |
                    archipelcore.archipelTaggableEntity.TNTaggableEntity --+
                                                                           |
                                                                          TNArchipelCentralAgent

This class represents a Central Agent XMPP Capable. This is a XMPP client which manages a central database containing all hypervisors and all vms in the system, and send regular pings to all hypervisors.

Instance Methods [hide private]
 
__init__(self, jid, password, configuration)
This is the constructor of the class.
source code
 
init_permissions(self)
Initialize the permissions.
source code
 
register_handlers(self)
This method will be called by the plugin user when it will be necessary to register module for listening to stanza.
source code
 
unregister_handlers(self)
Unregister the handlers.
source code
 
process_iq_for_centralagent(self, conn, iq)
This method is invoked when a ARCHIPEL_NS_CENTRALAGENT IQ is received.
source code
 
hook_xmpp_authenticated(self, origin=None, user_info=None, arguments=None)
Triggered when we are authenticated.
source code
 
become_central_agent(self)
triggered when becoming active central agent
source code
 
central_agent_jid(self)
Returns the jid of the central agent.
source code
 
keepalive_event_with_date(self)
Returns the keepalive event with current date, to send to the pubsub so that all ping calculations are based on central agent date.
source code
 
handle_central_keepalive_event(self, event)
Called when the central agents announce themselves.
source code
 
iq_read_hypervisors(self, iq)
Called when the central agent receives a hypervisor read event.
source code
 
iq_read_vms(self, iq)
Called when the central agent receives a vms read event.
source code
 
iq_get_existing_vms_instances(self, iq)
Called when the central agent receives a request to check if entities are already defined elsewhere
source code
 
iq_register_hypervisors(self, iq)
Called when the central agent receives a hypervisor registration event.
source code
 
iq_register_vms(self, iq)
Called when the central agent receives a vms registration event.
source code
 
iq_update_vms(self, iq)
Called when the central agent receives a vms update event.
source code
 
iq_update_vms_domain(self, iq)
Called when the central agent receives a vm domain update event.
source code
 
iq_update_hypervisors(self, iq)
Called when the central agent receives a vms update event.
source code
 
iq_unregister_hypervisors(self, iq)
Called when the central agent receives a hypervisor unregistration event.
source code
 
iq_unregister_vms(self, iq)
Called when the central agent receives a vms registration event.
source code
 
read_hypervisors(self, columns="*", where_statement=None)
Reads list of hypervisors in central db.
source code
 
read_vms(self, columns="*", where_statement=None)
Read list of vms in central db.
source code
 
get_existing_vms_instances(self, entries, origin_hyp)
Based on a list of vms, and an hypervisor, return list of vms which are defined in another, currently running, hypervisor.
source code
 
read_parked_vms(self, entries)
Based on a list of vms, and an hypervisor, return list of vms which are parked (have no hypervisor, or have a hypervisor which is not online)
source code
 
register_hypervisors(self, entries)
Register a list of hypervisors into central db.
source code
 
register_vms(self, entries)
Register a list of vms into central db.
source code
 
update_vms(self, entries)
Update a list of vms in central db.
source code
 
update_vms_domain(self, entries)
Update a list of vms domain in central db.
source code
 
update_hypervisors(self, entries)
Update a list of hypervisors in central db.
source code
 
unregister_hypervisors(self, entries)
Unregister a list of hypervisors from central db.
source code
 
unregister_vms(self, entries)
Unregister a list of vms from central db.
source code
 
unpack_entries(self, iq)
Unpack the list of entries from iq for database processing.
source code
list
pack_entries(self, entries)
Pack the list of entries to send to remote entity.
source code
 
db_commit(self, command, entries) source code
 
check_hyps(self)
Check that hypervisors are alive.
source code
 
manage_database(self)
Create, Update and / or recover the parking database
source code
 
updatedb(self)
Check if we need to alter table and fill it with proper value
source code
 
on_xmpp_loop_tick(self) source code

Inherited from archipelcore.archipelEntity.TNArchipelEntity: add_jid, add_message_registrar_item, add_message_registrar_items, auth_xmpp, authorize, build_help, build_reply, change_presence, change_status, check_acp, check_perm, connect, connect_xmpp, did_receive_vcard, disconnect, filter_message, get_plugin, inband_registration, inband_unregistration, init_vocabulary, initialize_modules, iq_add_subscription, iq_get_permission, iq_list_permission, iq_remove_subscription, iq_set_permission, is_subscribed, loop, manage_vcard, on_new_admin_account_publication, process_inband_unregistration, process_message, process_permission_iq, process_presence, process_subscription_iq, push_change, recover_pubsubs, remove_jid, remove_pubsubs, send_update_vcard, set_vcard, shout, subscribe, unauthorize, unsubscribe

Inherited from archipelcore.archipelHookableEntity.TNHookableEntity: create_hook, perform_hooks, register_hook, remove_hook, unregister_hook

Inherited from archipelcore.archipelAvatarControllableEntity.TNAvatarControllableEntity: b64avatar_from_filename, get_available_avatars, iq_get_available_avatars, iq_set_available_avatars, process_avatar_iq, set_avatar

Inherited from archipelcore.archipelTaggableEntity.TNTaggableEntity: did_clean_old_tags, iq_set_tags, process_tags_iq, set_tags

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, jid, password, configuration)
(Constructor)

source code 

This is the constructor of the class.

Parameters:
  • jid (string) - the jid of the hypervisor
  • password (string) - the password associated to the JID
Overrides: object.__init__

init_permissions(self)

source code 

Initialize the permissions.

Overrides: archipelcore.archipelTaggableEntity.TNTaggableEntity.init_permissions

register_handlers(self)

source code 

This method will be called by the plugin user when it will be necessary to register module for listening to stanza.

Overrides: archipelcore.archipelTaggableEntity.TNTaggableEntity.register_handlers

unregister_handlers(self)

source code 

Unregister the handlers.

Overrides: archipelcore.archipelTaggableEntity.TNTaggableEntity.unregister_handlers

process_iq_for_centralagent(self, conn, iq)

source code 

This method is invoked when a ARCHIPEL_NS_CENTRALAGENT IQ is received. It understands IQ of type:

  • read_hypervisors
  • read_vms
  • get_existing_vms_instances
  • register_hypervisors
  • register_vms
  • update_vms
  • update_hypervisors
  • unregister_hypervisors
  • unregister_vms
Parameters:
  • conn (xmpp.Dispatcher) - ths instance of the current connection that send the stanza
  • iq (xmpp.Protocol.Iq) - the received IQ

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 agents announce themselves.

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

iq_read_hypervisors(self, iq)

source code 

Called when the central agent receives a hypervisor read event.

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

iq_read_vms(self, iq)

source code 

Called when the central agent receives a vms read event.

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

iq_get_existing_vms_instances(self, iq)

source code 

Called when the central agent receives a request to check if entities are already defined elsewhere

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

iq_register_hypervisors(self, iq)

source code 

Called when the central agent receives a hypervisor registration event.

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

iq_register_vms(self, iq)

source code 

Called when the central agent receives a vms registration event.

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

iq_update_vms(self, iq)

source code 

Called when the central agent receives a vms update event.

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

iq_update_vms_domain(self, iq)

source code 

Called when the central agent receives a vm domain update event.

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

iq_update_hypervisors(self, iq)

source code 

Called when the central agent receives a vms update event.

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

iq_unregister_hypervisors(self, iq)

source code 

Called when the central agent receives a hypervisor unregistration event.

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

iq_unregister_vms(self, iq)

source code 

Called when the central agent receives a vms registration event.

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

register_hypervisors(self, entries)

source code 

Register a list of hypervisors into central db.

Parameters:
  • entries (List) - list of hypervisors

register_vms(self, entries)

source code 

Register a list of vms into central db.

Parameters:
  • entries (List) - list of vms

update_vms(self, entries)

source code 

Update a list of vms in central db.

Parameters:
  • entries (List) - list of vms

update_vms_domain(self, entries)

source code 

Update a list of vms domain in central db. Performs extra checks compared to a raw update.

Parameters:
  • entries (List) - list of vms

update_hypervisors(self, entries)

source code 

Update a list of hypervisors in central db.

Parameters:
  • entries (List) - list of vms

unregister_hypervisors(self, entries)

source code 

Unregister a list of hypervisors from central db.

Parameters:
  • entries (List) - list of hypervisors

unregister_vms(self, entries)

source code 

Unregister a list of vms from central db.

Parameters:
  • entries (List) - list of vms

unpack_entries(self, iq)

source code 

Unpack the list of entries from iq for database processing.

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

pack_entries(self, entries)

source code 

Pack the list of entries to send to remote entity.

Parameters:
  • entries (list) - list of dict entities
Returns: list
list of xmpp nodes, one per entry