def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.hypervisor_hook_xmpp_authenticated) self.entity.register_hook("HOOK_HYPERVISOR_WOKE_UP", method=self.push_vms_in_central_db) self.entity.register_hook("HOOK_HYPERVISOR_FREE", method=self.hook_vm_unregistered) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.hook_missed_vms, oneshot=True) self.entity.register_hook("HOOK_VM_DEFINE", method=self.hook_vm_event) self.central_agent_jid_val = None self.last_keepalive_heard = None self.keepalive_interval = int(ARCHIPEL_CENTRAL_AGENT_TIMEOUT * 2) self.hypervisor_timeout_threshold = int(ARCHIPEL_CENTRAL_AGENT_TIMEOUT) self.delayed_tasks = TNTasks(self.entity.log) self.vms_to_hook = set() self.xmpp_authenticated = False
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.nuageBridgeName = self.configuration.get("NUAGE", "nuage_bridge") self.database = None # permissions self.entity.permission_center.create_permission("nuagenetwork_get", "Authorizes user to get the existing Nuage networks", False) self.entity.permission_center.create_permission("nuagenetwork_getnames", "Authorizes user to get a Nuage network", False) if isinstance(self.entity, TNArchipelHypervisor): self.entity.permission_center.create_permission("nuagenetwork_create", "Authorizes user to create a Nuage network", False) self.entity.permission_center.create_permission("nuagenetwork_delete", "Authorizes user to delete a Nuage network", False) self.entity.permission_center.create_permission("nuagenetwork_update", "Authorizes user to update a Nuage network", False) if isinstance(self.entity, TNArchipelHypervisor): self.manage_database() if isinstance(self.entity, TNArchipelVirtualMachine): self.entity.add_vm_definition_hook(self.update_vm_xml_hook)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.novnc_proxy = None # vocabulary registrar_item = { "commands" : ["vnc", "screen"], "parameters": [], "method": self.message_display, "permissions": ["vnc_display"], "description": "I'll show my VNC port" } self.entity.add_message_registrar_item(registrar_item) # permissions self.entity.permission_center.create_permission("vnc_display", "Authorizes users to access the vnc display port", False) # hooks self.entity.register_hook("HOOK_VM_CREATE", method=self.create_novnc_proxy) self.entity.register_hook("HOOK_VM_CRASH", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_STOP", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_DESTROY", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_MIGRATED", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.awake_from_initialization) self.websocket_verbose = False if self.configuration.has_option("VNC", "vnc_enable_websocket_debug"): self.websocket_verbose = self.configuration.getboolean("VNC", "vnc_enable_websocket_debug")
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.scheduler = Scheduler() self.scheduler.start() self.database = sqlite3.connect(self.configuration.get("SCHEDULER", "database"), check_same_thread=False) self.database.execute("create table if not exists scheduler (entity_uuid text, job_uuid text, action text, year text, month text, day text, hour text, minute text, second text, comment text, params text)") self.database.commit() self.cursor = self.database.cursor() self.restore_jobs() self.supported_actions_for_vm = ("create", "shutdown", "destroy", "suspend", "resume", "reboot", "migrate", "pause") self.supported_actions_for_hypervisor = ("alloc", "free") # permissions self.entity.permission_center.create_permission("scheduler_jobs", "Authorizes user to get the list of task", False) self.entity.permission_center.create_permission("scheduler_schedule", "Authorizes user to schedule a task", False) self.entity.permission_center.create_permission("scheduler_unschedule", "Authorizes user to unschedule a task", False) self.entity.permission_center.create_permission("scheduler_actions", "Authorizes user to get available actions", False) # hooks if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_TERMINATE", method=self.vm_terminate)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity @type entity String @param entity the path of the ejabberdctl command """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.xmpp_server = entity.jid.getDomain() self.xmlrpc_host = self.configuration.get("XMPPSERVER", "xmlrpc_host") self.xmlrpc_port = self.configuration.getint("XMPPSERVER", "xmlrpc_port") self.xmlrpc_user = self.configuration.get("XMPPSERVER", "xmlrpc_user") self.xmlrpc_password = self.configuration.get("XMPPSERVER", "xmlrpc_password") self.xmlrpc_call = "http://%s:%s@%s:%s/" % (self.xmlrpc_user, self.xmlrpc_password, self.xmlrpc_host, self.xmlrpc_port) self.xmlrpc_server = xmlrpclib.ServerProxy(self.xmlrpc_call) # permissions self.entity.permission_center.create_permission("xmppserver_groups_create", "Authorizes user to create shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_delete", "Authorizes user to delete shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_list", "Authorizes user to list shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_addusers", "Authorizes user to add users in shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_deleteusers", "Authorizes user to remove users from shared groups", False) self.entity.permission_center.create_permission("xmppserver_users_register", "Authorizes user to register XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_unregister", "Authorizes user to unregister XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_list", "Authorizes user to list XMPP users", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.vm_initialized) self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.vm_terminate) self.database = sqlite3.connect(self.configuration.get( "OOMKILLER", "database"), check_same_thread=False) self.database.execute( "create table if not exists oomkiller (uuid text unique, adjust int)" ) self.database.commit() self.entity.log.info("OOM: module oom killer initialized") # permissions self.entity.permission_center.create_permission( "oom_getadjust", "Authorizes user to get OOM values", False) self.entity.permission_center.create_permission( "oom_setadjust", "Authorizes user to set OOM values", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.xmpp_server = entity.jid.getDomain() self.xmlrpc_host = self.configuration.get("XMPPSERVER", "xmlrpc_host") self.xmlrpc_port = self.configuration.getint("XMPPSERVER", "xmlrpc_port") self.xmlrpc_user = self.configuration.get("XMPPSERVER", "xmlrpc_user") self.xmlrpc_password = self.configuration.get("XMPPSERVER", "xmlrpc_password") self.xmlrpc_call = "http://%s:%s@%s:%s/" % (self.xmlrpc_user, self.xmlrpc_password, self.xmlrpc_host, self.xmlrpc_port) self.xmlrpc_server = xmlrpclib.ServerProxy(self.xmlrpc_call) self.entity.log.info("XMPPSERVER: Module is using XMLRPC API for managing XMPP server") # permissions self.entity.permission_center.create_permission("xmppserver_groups_create", "Authorizes user to create shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_delete", "Authorizes user to delete shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_list", "Authorizes user to list shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_addusers", "Authorizes user to add users in shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_deleteusers", "Authorizes user to remove users from shared groups", False) self.entity.permission_center.create_permission("xmppserver_users_register", "Authorizes user to register XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_unregister", "Authorizes user to unregister XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_list", "Authorizes user to list XMPP users", False)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.shared_isos_folder = self.configuration.get("STORAGE", "iso_base_path") + "/" if self.configuration.has_option("STORAGE", "qemu_img_bin_path"): self.qemu_img_bin = self.configuration.get("STORAGE", "qemu_img_bin_path") else: self.qemu_img_bin = "qemu-img" if not os.path.exists(self.shared_isos_folder): os.makedirs(self.shared_isos_folder) # permissions self.entity.permission_center.create_permission("drives_create", "Authorizes user to get create a drive", False) self.entity.permission_center.create_permission("drives_delete", "Authorizes user to delete a drive", False) self.entity.permission_center.create_permission("drives_get", "Authorizes user to get all drives", False) self.entity.permission_center.create_permission("drives_getiso", "Authorizes user to get existing ISO images", False) self.entity.permission_center.create_permission("drives_convert", "Authorizes user to convert a drive", False) self.entity.permission_center.create_permission("drives_rename", "Authorizes user to rename a drive", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the class. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) ## create directories if neede if not os.path.exists(self.configuration.get("VMCASTING", "repository_path")): os.makedirs(self.configuration.get("VMCASTING", "repository_path")) if not os.path.exists(self.configuration.get("VMCASTING", "temp_path")): os.makedirs(self.configuration.get("VMCASTING", "temp_path")) if not os.path.exists(self.configuration.get("VMCASTING", "own_vmcast_path")): os.makedirs(self.configuration.get("VMCASTING", "own_vmcast_path")) self.disks_extensions = self.configuration.get("VMCASTING", "disks_extensions").split(";") self.temp_directory = self.configuration.get("VMCASTING", "temp_path") self.hypervisor_repo_path = self.configuration.get("VMCASTING", "own_vmcast_path") self.is_installing = False self.installing_media_uuid = None self.is_installed = False self.database_connection = sqlite3.connect(self.configuration.get("VMCASTING", "vmcasting_database_path"), check_same_thread = False) self.cursor = self.database_connection.cursor() # permissions self.entity.permission_center.create_permission("appliance_get", "Authorizes user to get installed appliances", False) self.entity.permission_center.create_permission("appliance_attach", "Authorizes user attach appliance to virtual machine", False) self.entity.permission_center.create_permission("appliance_detach", "Authorizes user to detach appliance_detach from virtual machine", False) self.entity.permission_center.create_permission("appliance_package", "Authorizes user to package new appliance from virtual machine", False)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.novnc_proxy = None # vocabulary registrar_item = { "commands" : ["vnc", "screen"], "parameters": [], "method": self.message_display, "permissions": ["vnc_display"], "description": "I'll show my VNC port" } self.entity.add_message_registrar_item(registrar_item) # permissions self.entity.permission_center.create_permission("vnc_display", "Authorizes users to access the vnc display port", False) # hooks self.entity.register_hook("HOOK_VM_CREATE", method=self.create_novnc_proxy) self.entity.register_hook("HOOK_VM_CRASH", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_STOP", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_DESTROY", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_XMPP_DISCONNECT", method=self.stop_novnc_proxy) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.awake_from_initialization)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.pubsub_request_in_node = None self.pubsub_request_out_node = None self.computing_unit = None # get eventual computing unit plugin self.load_computing_unit() # creates permissions self.entity.permission_center.create_permission( "platform_allocvm", "Authorizes user to send cross platform request", True) # register to the node vmrequest self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.manage_platform_vm_request)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.xmpp_server = entity.jid.getDomain() self.entities_types_cache = {} self.entity.log.info("XMPPSERVER: module is using XMPP API for managing XMPP server") # permissions self.entity.permission_center.create_permission("xmppserver_groups_create", "Authorizes user to create shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_delete", "Authorizes user to delete shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_list", "Authorizes user to list shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_addusers", "Authorizes user to add users in shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_deleteusers", "Authorizes user to remove users from shared groups", False) self.entity.permission_center.create_permission("xmppserver_users_register", "Authorizes user to register XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_unregister", "Authorizes user to unregister XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_list", "Authorizes user to list XMPP users", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.shared_isos_folder = self.configuration.get("STORAGE", "iso_base_path") + "/" self.golden_drives_dir = self.configuration.get("STORAGE", "golden_drives_dir") if self.configuration.has_option("STORAGE", "qemu_img_bin_path"): self.qemu_img_bin = self.configuration.get("STORAGE", "qemu_img_bin_path") else: self.qemu_img_bin = "qemu-img" if not os.path.exists(self.qemu_img_bin): raise Exception("qemu-img is not found at path %s. You may need to install it" % self.qemu_img_bin) if not os.path.exists(self.shared_isos_folder): os.makedirs(self.shared_isos_folder) if not os.path.exists(self.golden_drives_dir): os.makedirs(self.golden_drives_dir) # permissions self.entity.permission_center.create_permission("drives_create", "Authorizes user to get create a drive", False) self.entity.permission_center.create_permission("drives_delete", "Authorizes user to delete a drive", False) self.entity.permission_center.create_permission("drives_get", "Authorizes user to get all drives", False) self.entity.permission_center.create_permission("drives_getiso", "Authorizes user to get existing ISO images", False) self.entity.permission_center.create_permission("drives_convert", "Authorizes user to convert a drive", False) self.entity.permission_center.create_permission("drives_rename", "Authorizes user to rename a drive", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.hypervisor_hook_xmpp_authenticated) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_DEFINE", method=self.hook_vm_event) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.hook_vm_event) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.hook_vm_terminate) self.central_agent_jid_val = None self.xmpp_authenticated = False self.required_statistics = []
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) # permissions self.entity.permission_center.create_permission( "snapshot_take", "Authorizes user to get take a snapshot", False) self.entity.permission_center.create_permission( "snapshot_delete", "Authorizes user to delete a snapshot", False) self.entity.permission_center.create_permission( "snapshot_get", "Authorizes user to get all snapshots", False) self.entity.permission_center.create_permission( "snapshot_current", "Authorizes user to get current used snapshot", False) self.entity.permission_center.create_permission( "snapshot_revert", "Authorizes user to revert to a snapshot", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.credentials = [] creds = self.configuration.get("IPHONENOTIFICATION", "credentials_key") for cred in creds.split(",,"): self.credentials.append(cred) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.entity.register_hook("HOOK_VM_SHUTOFF", method=self.vm_shutoff) self.entity.register_hook("HOOK_VM_STOP", method=self.vm_stop) self.entity.register_hook("HOOK_VM_DESTROY", method=self.vm_destroy) self.entity.register_hook("HOOK_VM_SUSPEND", method=self.vm_suspend) self.entity.register_hook("HOOK_VM_RESUME", method=self.vm_resume) self.entity.register_hook("HOOK_VM_UNDEFINE", method=self.vm_undefine) self.entity.register_hook("HOOK_VM_DEFINE", method=self.vm_define) elif self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook("HOOK_HYPERVISOR_ALLOC", method=self.hypervisor_alloc) self.entity.register_hook("HOOK_HYPERVISOR_FREE", method=self.hypervisor_free) self.entity.register_hook("HOOK_HYPERVISOR_MIGRATEDVM_LEAVE", method=self.hypervisor_migrate_leave) self.entity.register_hook("HOOK_HYPERVISOR_MIGRATEDVM_ARRIVE", method=self.hypervisor_migrate_arrive) self.entity.register_hook("HOOK_HYPERVISOR_CLONE", method=self.hypervisor_clone)
def __init__(self, configuration, entity, entry_point_group): """ intialize the plugin """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.credentials = [] creds = self.configuration.get("IPHONENOTIFICATION", "credentials_key") for cred in creds.split(",,"): self.credentials.append(cred) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.entity.register_hook("HOOK_VM_SHUTOFF", method=self.vm_shutoff) self.entity.register_hook("HOOK_VM_STOP", method=self.vm_stop) self.entity.register_hook("HOOK_VM_DESTROY", method=self.vm_destroy) self.entity.register_hook("HOOK_VM_SUSPEND", method=self.vm_suspend) self.entity.register_hook("HOOK_VM_RESUME", method=self.vm_resume) self.entity.register_hook("HOOK_VM_UNDEFINE", method=self.vm_undefine) self.entity.register_hook("HOOK_VM_DEFINE", method=self.vm_define) elif self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook("HOOK_HYPERVISOR_ALLOC", method=self.hypervisor_alloc) self.entity.register_hook("HOOK_HYPERVISOR_FREE", method=self.hypervisor_free) self.entity.register_hook("HOOK_HYPERVISOR_MIGRATEDVM_LEAVE", method=self.hypervisor_migrate_leave) self.entity.register_hook("HOOK_HYPERVISOR_MIGRATEDVM_ARRIVE", method=self.hypervisor_migrate_arrive) self.entity.register_hook("HOOK_HYPERVISOR_CLONE", method=self.hypervisor_clone)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook( "HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.hypervisor_hook_xmpp_authenticated) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_DEFINE", method=self.hook_vm_event) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.hook_vm_event) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.hook_vm_terminate) self.central_agent_jid_val = None self.xmpp_authenticated = False self.required_statistics = []
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) # creates permissions self.entity.permission_center.create_permission("vmparking_park", "Authorizes user to park a virtual machines", False) if isinstance(self.entity, TNArchipelHypervisor): self.entity.permission_center.create_permission("vmparking_list", "Authorizes user to list virtual machines in parking", False) self.entity.permission_center.create_permission("vmparking_unpark", "Authorizes user to unpark a virtual machines", False) self.entity.permission_center.create_permission("vmparking_delete", "Authorizes user to delete parked virtual machines", False) self.entity.permission_center.create_permission("vmparking_updatexml", "Authorizes user to delete parked virtual machines", False) self.entity.permission_center.create_permission("vmparking_create_parked", "Authorizes user to create a new VM in parking", False) # vocabulary if isinstance(self.entity, TNArchipelHypervisor): registrar_items = [{ "commands" : ["park"], "parameters": [{"name": "identifiers", "description": "the UUIDs of the VM to park, separated with comas, with no space"}], "method": self.message_park_hypervisor, "permissions": ["vmparking_park"], "description": "Park the virtual machine with the given UUIDs"}, { "commands" : ["unpark"], "parameters": [{"name": "identifiers", "description": "UUIDs of the virtual machines or parking tickets, separated by comas, with no space"}], "method": self.message_unpark, "permissions": ["vmparking_unpark"], "description": "Unpark the virtual machine parked with the given identifier"}, { "commands" : ["park list"], "parameters": [], "method": self.message_list, "permissions": ["vmparking_list"], "description": "List all parked virtual machines" } ] elif isinstance(self.entity, TNArchipelVirtualMachine): registrar_items = [{ "commands" : ["park"], "parameters": [], "method": self.message_park_vm, "permissions": ["vmparking_park"], "description": "Park the virtual machine"}, ] self.entity.add_message_registrar_items(registrar_items) # register to the node parking and create database if needed if isinstance(self.entity, TNArchipelHypervisor): self.manage_database() if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_DEFINE", method=self.hook_vm_define) self.entity.register_hook("HOOK_VM_UNDEFINE", method=self.hook_vm_undefine)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) if configuration.has_option("XMPPSERVER", "auto_group") and configuration.getboolean("XMPPSERVER", "auto_group"): self.autogroup_name_hypervisors = "All Hypervisors" self.autogroup_name_vms = "All Virtual Machines" self.autogroup_name_users = "All Users" if configuration.has_option("XMPPSERVER", "auto_group_name_virtualmachines"): self.autogroup_name_vms = configuration.get("XMPPSERVER", "auto_group_name_virtualmachines") if configuration.has_option("XMPPSERVER", "auto_group_name_hypervisors"): self.autogroup_name_hypervisors = configuration.get("XMPPSERVER", "auto_group_name_hypervisors") if configuration.has_option("XMPPSERVER", "auto_group_name_users"): self.autogroup_name_users = configuration.get("XMPPSERVER", "auto_group_name_users") auto_group_filter = "all" if configuration.has_option("XMPPSERVER", "auto_group_filter"): auto_group_filter = configuration.get("XMPPSERVER", "auto_group_filter") if not auto_group_filter in ("virtualmachines", "hypervisors", "all"): raise Exception("Bad configuration", "auto_group_filter must be virtualmachines, hypervisors or all.") self.autogroup_vms_id = self.autogroup_name_vms self.autogroup_hypervisors_id = self.autogroup_name_hypervisors self.autogroup_users_id = self.autogroup_name_users self.entity.register_hook("HOOK_ARCHIPELENTITY_PLUGIN_ALL_LOADED", method=self.create_autogroups_if_needed) if auto_group_filter in ("all", "hypervisors"): self.entity.register_hook("HOOK_HYPERVISOR_WOKE_UP", method=self.handle_autogroup_for_entity) if auto_group_filter in ("all", "virtualmachines"): self.entity.register_hook("HOOK_HYPERVISOR_ALLOC", method=self.handle_autogroup_for_entity) self.entity.register_hook("HOOK_HYPERVISOR_SOFT_ALLOC", method=self.handle_autogroup_for_entity) self.entity.register_hook("HOOK_HYPERVISOR_VM_WOKE_UP", method=self.handle_autogroup_for_entity) self.user_page_size = 50 # permissions if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.permission_center.create_permission("xmppserver_groups_create", "Authorizes user to create shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_delete", "Authorizes user to delete shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_list", "Authorizes user to list shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_addusers", "Authorizes user to add users in shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_deleteusers", "Authorizes user to remove users from shared groups", False) self.entity.permission_center.create_permission("xmppserver_users_register", "Authorizes user to register XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_unregister", "Authorizes user to unregister XMPP users", False) if self.entity.__class__.__name__ != "TNArchipelCentralAgent": self.entity.permission_center.create_permission("xmppserver_users_list", "Authorizes user to list XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_number", "Authorizes user to get the total number of XMPP users", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.pubsub_vmparking = None; self.inhibit_next_general_push = None # creates permissions self.entity.permission_center.create_permission("vmparking_park", "Authorizes user to park a virtual machines", False) if isinstance(self.entity, TNArchipelHypervisor): self.entity.permission_center.create_permission("vmparking_list", "Authorizes user to list virtual machines in parking", False) self.entity.permission_center.create_permission("vmparking_unpark", "Authorizes user to unpark a virtual machines", False) self.entity.permission_center.create_permission("vmparking_delete", "Authorizes user to delete parked virtual machines", False) self.entity.permission_center.create_permission("vmparking_updatexml", "Authorizes user to delete parked virtual machines", False) # vocabulary if isinstance(self.entity, TNArchipelHypervisor): registrar_items = [{ "commands" : ["park"], "parameters": [{"name": "identifiers", "description": "the UUIDs of the VM to park, separated with comas, with no space"}], "method": self.message_park_hypervisor, "permissions": ["vmparking_park"], "description": "Park the virtual machine with the given UUIDs"}, { "commands" : ["unpark"], "parameters": [{"name": "identifiers", "description": "UUIDs of the virtual machines or parking tickets, separated by comas, with no space"}], "method": self.message_unpark, "permissions": ["vmparking_unpark"], "description": "Unpark the virtual machine parked with the given identifier"}, { "commands" : ["park list"], "parameters": [], "method": self.message_list, "permissions": ["vmparking_list"], "description": "List all parked virtual machines" } ] elif isinstance(self.entity, TNArchipelVirtualMachine): registrar_items = [{ "commands" : ["park"], "parameters": [], "method": self.message_park_vm, "permissions": ["vmparking_park"], "description": "Park the virtual machine"}, ] self.entity.add_message_registrar_items(registrar_items) # register to the node vmrequest if isinstance(self.entity, TNArchipelHypervisor): self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.manage_vmparking_node)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.folder_nwfilters = self.configuration.get("NETWORKS", "libvirt_nw_filters_path") if not os.path.exists(self.folder_nwfilters): self.folder_nwfilters = None self.entity.log.warning("NETWORK: unable to find network filter folder at path %s. agent will not offer any network filter") # permissions if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.permission_center.create_permission("network_getnames", "Authorizes user to get the existing network names", False) self.entity.permission_center.create_permission("network_bridges", "Authorizes user to get existing bridges", False) elif self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.permission_center.create_permission("network_define", "Authorizes user to define a network", False) self.entity.permission_center.create_permission("network_undefine", "Authorizes user to undefine a network", False) self.entity.permission_center.create_permission("network_create", "Authorizes user to create (start) a network", False) self.entity.permission_center.create_permission("network_destroy", "Authorizes user to destroy (stop) a network", False) self.entity.permission_center.create_permission("network_get", "Authorizes user to get all networks informations", False) self.entity.permission_center.create_permission("network_getnames", "Authorizes user to get the existing network names", False) self.entity.permission_center.create_permission("network_bridges", "Authorizes user to get existing bridges", False) self.entity.permission_center.create_permission("network_getnics", "Authorizes user to get existing network interfaces", False) self.entity.permission_center.create_permission("network_getnwfilters", "Authorizes user to get existing libvirt network filters", False) registrar_items = [ { "commands" : ["list networks"], "parameters": [], "method": self.message_get, "permissions": ["network_get"], "description": "List all networks" }, { "commands" : ["create network", "start network"], "parameters": [{"name": "identifier", "description": "The identifer of the network, UUID or name"}], "method": self.message_create, "permissions": ["network_create"], "description": "Start the given network" }, { "commands" : ["destroy network", "stop network"], "parameters": [{"name": "identifier", "description": "The identifer of the network, UUID or name"}], "method": self.message_destroy, "permissions": ["network_destroy"], "description": "Stop the given network" }, { "commands" : ["nics", "network cards"], "parameters": [], "method": self.message_getnics, "permissions": ["network_getnics"], "description": "Get the list of all my network interfaces" } ] self.entity.add_message_registrar_items(registrar_items)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the class. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) ## create directories if neede if not os.path.exists(self.configuration.get("VMCASTING", "repository_path")): os.makedirs(self.configuration.get("VMCASTING", "repository_path")) if not os.path.exists(self.configuration.get("VMCASTING", "temp_path")): os.makedirs(self.configuration.get("VMCASTING", "temp_path")) if not os.path.exists(self.configuration.get("VMCASTING", "own_vmcast_path")): os.makedirs(self.configuration.get("VMCASTING", "own_vmcast_path")) self.disks_extensions = self.configuration.get("VMCASTING", "disks_extensions").split(";") self.temp_directory = self.configuration.get("VMCASTING", "temp_path") self.hypervisor_repo_path = self.configuration.get("VMCASTING", "own_vmcast_path") self.is_installing = False self.installing_media_uuid = None self.is_installed = False self.database_connection = sqlite3.connect(self.configuration.get("VMCASTING", "vmcasting_database_path"), check_same_thread = False) self.cursor = self.database_connection.cursor() # permissions self.entity.permission_center.create_permission("appliance_get", "Authorizes user to get installed appliances", False) self.entity.permission_center.create_permission("appliance_attach", "Authorizes user attach appliance to virtual machine", False) self.entity.permission_center.create_permission("appliance_detach", "Authorizes user to detach appliance_detach from virtual machine", False) self.entity.permission_center.create_permission("appliance_package", "Authorizes user to package new appliance from virtual machine", False) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.vm_terminate) # chat registrar_items = [ { "commands" : ["list appliances"], "parameters": [], "method": self.message_get, "permissions": ["appliance_get"], "description": "List all appliances" }, { "commands" : ["attach appliance"], "parameters": [{"name": "identifier", "description": "The identifer of the appliance, UUID or name"}], "method": self.message_attach, "permissions": ["appliance_attach"], "description": "Attach to the given appliance" }, { "commands" : ["detach appliance"], "parameters": [], "method": self.message_detach, "permissions": ["appliance_detach"], "description": "Detach from the current appliance" } ] self.entity.add_message_registrar_items(registrar_items)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the class. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) ## create directories if neede if not os.path.exists(self.configuration.get("VMCASTING", "repository_path")): os.makedirs(self.configuration.get("VMCASTING", "repository_path")) if not os.path.exists(self.configuration.get("VMCASTING", "temp_path")): os.makedirs(self.configuration.get("VMCASTING", "temp_path")) if not os.path.exists(self.configuration.get("VMCASTING", "own_vmcast_path")): os.makedirs(self.configuration.get("VMCASTING", "own_vmcast_path")) self.disks_extensions = self.configuration.get("VMCASTING", "disks_extensions").split(";") self.temp_directory = self.configuration.get("VMCASTING", "temp_path") self.hypervisor_repo_path = self.configuration.get("VMCASTING", "own_vmcast_path") self.is_installing = False self.installing_media_uuid = None self.is_installed = False self.database_connection = sqlite3.connect(self.configuration.get("VMCASTING", "vmcasting_database_path"), check_same_thread = False) self.cursor = self.database_connection.cursor() # permissions self.entity.permission_center.create_permission("appliance_get", "Authorizes user to get installed appliances", False) self.entity.permission_center.create_permission("appliance_attach", "Authorizes user attach appliance to virtual machine", False) self.entity.permission_center.create_permission("appliance_detach", "Authorizes user to detach appliance_detach from virtual machine", False) self.entity.permission_center.create_permission("appliance_package", "Authorizes user to package new appliance from virtual machine", False) # chat registrar_items = [ { "commands" : ["list appliances"], "parameters": [], "method": self.message_get, "permissions": ["appliance_get"], "description": "List all appliances" }, { "commands" : ["attach appliance"], "parameters": [{"name": "identifier", "description": "The identifer of the appliance, UUID or name"}], "method": self.message_attach, "permissions": ["appliance_attach"], "description": "Attach to the given appliance" }, { "commands" : ["detach appliance"], "parameters": [], "method": self.message_detach, "permissions": ["appliance_detach"], "description": "Detach from the current appliance" } ] self.entity.add_message_registrar_items(registrar_items)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) # permissions self.entity.permission_center.create_permission("snapshot_take", "Authorizes user to get take a snapshot", False) self.entity.permission_center.create_permission("snapshot_delete", "Authorizes user to delete a snapshot", False) self.entity.permission_center.create_permission("snapshot_get", "Authorizes user to get all snapshots", False) self.entity.permission_center.create_permission("snapshot_current", "Authorizes user to get current used snapshot", False) self.entity.permission_center.create_permission("snapshot_revert", "Authorizes user to revert to a snapshot", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.computing_unit = None # get computing unit plugin if present self.load_computing_unit()
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) db_file = self.configuration.get("HEALTH", "health_database_path") collection_interval = self.configuration.getint("HEALTH", "health_collection_interval") max_rows_before_purge = self.configuration.getint("HEALTH", "max_rows_before_purge") max_cached_rows = self.configuration.getint("HEALTH", "max_cached_rows") log_file = self.configuration.get("LOGGING", "logging_file_path") self.collector = TNThreadedHealthCollector(db_file, collection_interval, max_rows_before_purge, max_cached_rows) self.logfile = log_file # permissions self.entity.permission_center.create_permission( "health_history", "Authorizes user to get the health history", False ) self.entity.permission_center.create_permission( "health_info", "Authorizes user to get entity information", False ) self.entity.permission_center.create_permission("health_logs", "Authorizes user to get entity logs", False) registrar_items = [ { "commands": ["health"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_health_info, "permissions": ["health_info"], "description": "Get my last health information", }, { "commands": ["logs"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_get_logs, "permissions": ["health_logs"], "description": "Get my last logs information", }, ] self.entity.add_message_registrar_items(registrar_items) self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.start_collector)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) # permissions self.entity.permission_center.create_permission("snapshot_take", "Authorizes user to get take a snapshot", False) self.entity.permission_center.create_permission("snapshot_delete", "Authorizes user to delete a snapshot", False) self.entity.permission_center.create_permission("snapshot_get", "Authorizes user to get all snapshots", False) self.entity.permission_center.create_permission("snapshot_current", "Authorizes user to get current used snapshot", False) self.entity.permission_center.create_permission("snapshot_revert", "Authorizes user to revert to a snapshot", False)
def __init__(self, configuration, entity, entry_point_group): """ initialize the class @type database_path: string @param database_path: the path of the sqlite3 database to use @type repository_path: string @param repository_path: the path of the repository to download and store appliances @type entity: TNArchipelHypervisor @param entity: the instance of the TNArchipelHypervisor. Will be used for push. """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.database_path = self.configuration.get("VMCASTING", "vmcasting_database_path") self.repository_path = self.configuration.get("VMCASTING", "repository_path") self.download_queue = {} if not os.path.exists(self.repository_path): os.makedirs(self.repository_path) if not os.path.exists(self.configuration.get("VMCASTING", "own_vmcast_path")): os.makedirs(self.configuration.get("VMCASTING", "own_vmcast_path")) self.entity.log.info("TNHypervisorRepoManager: opening vmcasting database file %s" % self.database_path) self.own_vmcastmaker = vmcastmaker.VMCastMaker(self.configuration.get("VMCASTING", "own_vmcast_name").replace("$HOSTAME", self.entity.resource), self.configuration.get("VMCASTING", "own_vmcast_uuid"), self.configuration.get("VMCASTING", "own_vmcast_description").replace("$HOSTAME", self.entity.resource), self.configuration.get("VMCASTING", "own_vmcast_lang"), self.configuration.get("VMCASTING", "own_vmcast_url"), self.configuration.get("VMCASTING", "own_vmcast_path")) self.parse_own_repo(loop=False) self.parse_timer = Thread(target=self.parse_own_repo) self.parse_timer.start() self.database_connection = sqlite3.connect(self.database_path, check_same_thread = False) self.cursor = self.database_connection.cursor() self.cursor.execute("create table if not exists vmcastsources (name text, description text, url text not null unique, uuid text unique)") self.cursor.execute("create table if not exists vmcastappliances (name text, description text, url text, uuid text unique not null, status int, source text not null, save_path text)") self.entity.log.info("TNHypervisorRepoManager: Database ready.") # permissions self.entity.permission_center.create_permission("vmcasting_get", "Authorizes user to get registered VMCast feeds", False) self.entity.permission_center.create_permission("vmcasting_register", "Authorizes user to register to a VMCast feed", False) self.entity.permission_center.create_permission("vmcasting_unregister", "Authorizes user to unregister from a VMCast feed", False) self.entity.permission_center.create_permission("vmcasting_downloadappliance", "Authorizes user to download an appliance from a feed", False) self.entity.permission_center.create_permission("vmcasting_downloadqueue", "Authorizes user to see the download queue", False) self.entity.permission_center.create_permission("vmcasting_getappliances", "Authorizes user to get all availables appliances", False) self.entity.permission_center.create_permission("vmcasting_deleteappliance", "Authorizes user to delete an installed appliance", False) self.entity.permission_center.create_permission("vmcasting_getinstalledappliances", "Authorizes user to get all installed appliances", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.vm_initialized) self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.oomkiller_flag = "/%s/oomkiller_flag" % (self.entity.folder) self.entity.log.info("OOM: module oom killer initialized") # permissions self.entity.permission_center.create_permission("oom_getadjust", "Authorizes user to get OOM values", False) self.entity.permission_center.create_permission("oom_setadjust", "Authorizes user to set OOM values", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.scheduler = Scheduler() self.scheduler.start() self.database = sqlite3.connect(self.configuration.get( "SCHEDULER", "database"), check_same_thread=False) self.database.execute( "create table if not exists scheduler (entity_uuid text, job_uuid text, action text, year text, month text, day text, hour text, minute text, second text, comment text, params text)" ) self.database.commit() self.cursor = self.database.cursor() self.restore_jobs() self.supported_actions_for_vm = ("create", "shutdown", "destroy", "suspend", "resume", "reboot", "migrate", "pause") self.supported_actions_for_hypervisor = ("alloc", "free") # permissions self.entity.permission_center.create_permission( "scheduler_jobs", "Authorizes user to get the list of task", False) self.entity.permission_center.create_permission( "scheduler_schedule", "Authorizes user to schedule a task", False) self.entity.permission_center.create_permission( "scheduler_unschedule", "Authorizes user to unschedule a task", False) self.entity.permission_center.create_permission( "scheduler_actions", "Authorizes user to get available actions", False) # hooks if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_TERMINATE", method=self.vm_terminate)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the class. @type configuration: string @param configuration: the configuration object @type entity: TNArchipelHypervisor @param entity: the instance of the TNArchipelHypervisor. Will be used for push. @type entry_point_group: string @param entry_point_group: the entry point group name """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.database_path = self.configuration.get("VMCASTING", "vmcasting_database_path") self.repository_path = self.configuration.get("VMCASTING", "repository_path") self.download_queue = {} if not os.path.exists(self.repository_path): os.makedirs(self.repository_path) if not os.path.exists(self.configuration.get("VMCASTING", "own_vmcast_path")): os.makedirs(self.configuration.get("VMCASTING", "own_vmcast_path")) self.entity.log.info("TNHypervisorRepoManager: opening vmcasting database file %s" % self.database_path) self.own_vmcastmaker = vmcastmaker.VMCastMaker(self.configuration.get("VMCASTING", "own_vmcast_name").replace("$HOSTNAME", self.entity.resource), self.configuration.get("VMCASTING", "own_vmcast_uuid"), self.configuration.get("VMCASTING", "own_vmcast_description").replace("$HOSTNAME", self.entity.resource), self.configuration.get("VMCASTING", "own_vmcast_lang"), self.configuration.get("VMCASTING", "own_vmcast_url"), self.configuration.get("VMCASTING", "own_vmcast_path")) self.parse_own_repo(loop=False) self.parse_timer = Thread(target=self.parse_own_repo) self.database_connection = sqlite3.connect(self.database_path, check_same_thread = False) self.cursor = self.database_connection.cursor() self.cursor.execute("create table if not exists vmcastsources (name text, description text, url text not null unique, uuid text unique)") self.cursor.execute("create table if not exists vmcastappliances (name text, description text, url text, uuid text unique not null, status int, source text not null, save_path text)") self.entity.log.info("TNHypervisorRepoManager: Database ready.") # permissions self.entity.permission_center.create_permission("vmcasting_get", "Authorizes user to get registered VMCast feeds", False) self.entity.permission_center.create_permission("vmcasting_register", "Authorizes user to register to a VMCast feed", False) self.entity.permission_center.create_permission("vmcasting_unregister", "Authorizes user to unregister from a VMCast feed", False) self.entity.permission_center.create_permission("vmcasting_downloadappliance", "Authorizes user to download an appliance from a feed", False) self.entity.permission_center.create_permission("vmcasting_downloadqueue", "Authorizes user to see the download queue", False) self.entity.permission_center.create_permission("vmcasting_getappliances", "Authorizes user to get all availables appliances", False) self.entity.permission_center.create_permission("vmcasting_deleteappliance", "Authorizes user to delete an installed appliance", False) self.entity.permission_center.create_permission("vmcasting_getinstalledappliances", "Authorizes user to get all installed appliances", False) # Hook registration self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.repo_parse_hook)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.shared_isos_folder = self.configuration.get("STORAGE", "iso_base_path") + "/" if not os.path.exists( self.shared_isos_folder): os.makedirs(self.shared_isos_folder) # permissions self.entity.permission_center.create_permission("drives_create", "Authorizes user to get create a drive", False) self.entity.permission_center.create_permission("drives_delete", "Authorizes user to delete a drive", False) self.entity.permission_center.create_permission("drives_get", "Authorizes user to get all drives", False) self.entity.permission_center.create_permission("drives_getiso", "Authorizes user to get existing ISO images", False) self.entity.permission_center.create_permission("drives_convert", "Authorizes user to convert a drive", False) self.entity.permission_center.create_permission("drives_rename", "Authorizes user to rename a drive", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.pubsub_request_in_node = None self.pubsub_request_out_node = None self.computing_unit = None # get eventual computing unit plugin self.load_computing_unit() # creates permissions self.entity.permission_center.create_permission("platform_allocvm", "Authorizes user to send cross platform request", True) # register to the node vmrequest self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.manage_platform_vm_request)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the module. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.plugin_deactivated = False try: mode = self.configuration.get("GEOLOCALIZATION", "localization_mode") lat = "" lon = "" if mode == "auto": service = self.configuration.get("GEOLOCALIZATION", "localization_service_url") request = self.configuration.get("GEOLOCALIZATION", "localization_service_request") method = self.configuration.get("GEOLOCALIZATION", "localization_service_method") conn = httplib.HTTPConnection(service) conn.request(method, request) data_node = xmpp.simplexml.NodeBuilder(data=str(conn.getresponse().read())).getDom() lat = data_node.getTagData("Latitude") lon = data_node.getTagData("Longitude") else: lat = self.configuration.getfloat("GEOLOCALIZATION", "localization_latitude") lon = self.configuration.getfloat("GEOLOCALIZATION", "localization_longitude") string = "<gelocalization><Latitude>"+str(lat)+"</Latitude>\n<Longitude>"+str(lon)+"</Longitude></gelocalization>" self.localization_information = xmpp.simplexml.NodeBuilder(data=string).getDom() registrar_item = { "commands" : ["where are you", "localize"], "parameters": {}, "method": self.message_get, "permissions": ["geolocalization_get"], "description": "give my the latitude and longitude." } self.entity.add_message_registrar_item(registrar_item) # permissions self.entity.permission_center.create_permission("geolocalization_get", "Authorizes user to get the entity location coordinates", False) except Exception as ex: self.plugin_deactivated = True; self.entity.log.error("Cannot initialize geolocalization. plugin deactivated. Exception: %s" % str(ex))
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.vm_initialized) self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.entity.register_hook("HOOK_VM_TERMINATE", method=self.vm_terminate) self.database = sqlite3.connect(self.configuration.get("OOMKILLER", "database"), check_same_thread=False) self.database.execute("create table if not exists oomkiller (uuid text unique, adjust int)") self.database.commit() self.cursor = self.database.cursor() self.entity.log.info("module oom killer initialized") # permissions self.entity.permission_center.create_permission("oom_getadjust", "Authorizes user to get OOM values", False) self.entity.permission_center.create_permission("oom_setadjust", "Authorizes user to set OOM values", False)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) # permissions if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.permission_center.create_permission("network_getnames", "Authorizes user to get the existing network names", False) self.entity.permission_center.create_permission("network_bridges", "Authorizes user to get existing bridges", False) elif self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.permission_center.create_permission("network_define", "Authorizes user to define a network", False) self.entity.permission_center.create_permission("network_undefine", "Authorizes user to undefine a network", False) self.entity.permission_center.create_permission("network_create", "Authorizes user to create (start) a network", False) self.entity.permission_center.create_permission("network_destroy", "Authorizes user to destroy (stop) a network", False) self.entity.permission_center.create_permission("network_get", "Authorizes user to get all networks informations", False) self.entity.permission_center.create_permission("network_getnames", "Authorizes user to get the existing network names", False) self.entity.permission_center.create_permission("network_bridges", "Authorizes user to get existing bridges", False) registrar_items = [ { "commands" : ["list networks"], "parameters": {}, "method": self.message_get, "permissions": ["network_get"], "description": "List all networks" }, { "commands" : ["create network", "start network"], "parameters": [{"name": "identifier", "description": "The identifer of the network, UUID or name"}], "method": self.message_create, "permissions": ["network_create"], "description": "Start the given network" }, { "commands" : ["destroy network", "stop network"], "parameters": [{"name": "identifier", "description": "The identifer of the network, UUID or name"}], "method": self.message_destroy, "permissions": ["network_destroy"], "description": "Stop the given network" } ] self.entity.add_message_registrar_items(registrar_items)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) mode = self.configuration.get("GEOLOCALIZATION", "localization_mode"); lat = "" lon = "" if mode == "auto": service = self.configuration.get("GEOLOCALIZATION", "localization_service_url") request = self.configuration.get("GEOLOCALIZATION", "localization_service_request") method = self.configuration.get("GEOLOCALIZATION", "localization_service_method") root_info_node = self.configuration.get("GEOLOCALIZATION", "localization_service_response_root_node") conn = httplib.HTTPConnection(service) conn.request(method, request) data_node = xmpp.simplexml.NodeBuilder(data=str(conn.getresponse().read())).getDom() lat = data_node.getTagData("Latitude") lon = data_node.getTagData("Longitude") else: lat = self.configuration.getfloat("GEOLOCALIZATION", "localization_latitude") lon = self.configuration.getfloat("GEOLOCALIZATION", "localization_longitude") string = "<gelocalization><Latitude>"+str(lat)+"</Latitude>\n<Longitude>"+str(lon)+"</Longitude></gelocalization>" self.localization_information = xmpp.simplexml.NodeBuilder(data=string).getDom() registrar_item = { "commands" : ["where are you", "localize"], "parameters": {}, "method": self.message_get, "permissions": ["geolocalization_get"], "description": "give my the latitude and longitude." } self.entity.add_message_registrar_item(registrar_item) # permissions self.entity.permission_center.create_permission("geolocalization_get", "Authorizes user to get the entity location coordinates", False);
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.register_hook( "HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.hypervisor_hook_xmpp_authenticated) self.entity.register_hook("HOOK_HYPERVISOR_WOKE_UP", method=self.push_vms_in_central_db) self.entity.register_hook("HOOK_HYPERVISOR_FREE", method=self.hook_vm_unregistered) if self.entity.__class__.__name__ == "TNArchipelVirtualMachine": self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.hook_missed_vms, oneshot=True) self.entity.register_hook("HOOK_VM_DEFINE", method=self.hook_vm_event) self.central_agent_jid_val = None self.last_keepalive_heard = None self.keepalive_interval = int(ARCHIPEL_CENTRAL_AGENT_TIMEOUT * 2) self.hypervisor_timeout_threshold = int(ARCHIPEL_CENTRAL_AGENT_TIMEOUT) self.delayed_tasks = TNTasks(self.entity.log) self.vms_to_hook = set() self.xmpp_authenticated = False
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) db_file = self.configuration.get("HEALTH", "health_database_path") collection_interval = self.configuration.getint("HEALTH", "health_collection_interval") max_rows_before_purge = self.configuration.getint("HEALTH", "max_rows_before_purge") max_cached_rows = self.configuration.getint("HEALTH", "max_cached_rows") log_file = self.configuration.get("LOGGING", "logging_file_path") self.collector = TNThreadedHealthCollector(db_file,collection_interval, max_rows_before_purge, max_cached_rows) self.logfile = log_file # permissions self.entity.permission_center.create_permission("health_history", "Authorizes user to get the health history", False) self.entity.permission_center.create_permission("health_info", "Authorizes user to get entity information", False) self.entity.permission_center.create_permission("health_logs", "Authorizes user to get entity logs", False) registrar_items = [ { "commands" : ["health"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_health_info, "permissions": ["health_info"], "description": "Get my last health information" }, { "commands" : ["logs"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_get_logs, "permissions": ["health_logs"], "description": "Get my last logs information" } ] self.entity.add_message_registrar_items(registrar_items) self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.start_collector)
def __init__(self, configuration, entity, entry_point_group): """ initialize the module @type entity TNArchipelEntity @param entity the module entity """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) db_file = self.configuration.get("HEALTH", "health_database_path") collection_interval = self.configuration.getint("HEALTH", "health_collection_interval") max_rows_before_purge = self.configuration.getint("HEALTH", "max_rows_before_purge") max_cached_rows = self.configuration.getint("HEALTH", "max_cached_rows") log_file = self.configuration.get("LOGGING", "logging_file_path") self.collector = TNThreadedHealthCollector(db_file,collection_interval, max_rows_before_purge, max_cached_rows) self.logfile = log_file self.collector.start() # permissions self.entity.permission_center.create_permission("health_history", "Authorizes user to get the health history", False) self.entity.permission_center.create_permission("health_info", "Authorizes user to get entity information", False) self.entity.permission_center.create_permission("health_logs", "Authorizes user to get entity logs", False) registrar_items = [ { "commands" : ["health"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_health_info, "permissions": ["health_info"], "description": "Get my last health information" }, { "commands" : ["logs"], "parameters": [{"name": "limit", "description": "Max number of returned entries. Equals 1 if ommited"}], "method": self.message_get_logs, "permissions": ["health_logs"], "description": "Get my last logs information" } ] self.entity.add_message_registrar_items(registrar_items)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.entity.register_hook("HOOK_VM_INITIALIZE", method=self.vm_initialized) self.entity.register_hook("HOOK_VM_CREATE", method=self.vm_create) self.oomkiller_flag = "/%s/oomkiller_flag" % (self.entity.folder) self.entity.log.info("OOM: module oom killer initialized") # permissions self.entity.permission_center.create_permission( "oom_getadjust", "Authorizes user to get OOM values", False) self.entity.permission_center.create_permission( "oom_setadjust", "Authorizes user to set OOM values", False)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.pubsub_vmparking = None self.inhibit_next_general_push = None # creates permissions self.entity.permission_center.create_permission( "vmparking_park", "Authorizes user to park a virtual machines", False) if isinstance(self.entity, TNArchipelHypervisor): self.entity.permission_center.create_permission( "vmparking_list", "Authorizes user to list virtual machines in parking", False) self.entity.permission_center.create_permission( "vmparking_unpark", "Authorizes user to unpark a virtual machines", False) self.entity.permission_center.create_permission( "vmparking_delete", "Authorizes user to delete parked virtual machines", False) self.entity.permission_center.create_permission( "vmparking_updatexml", "Authorizes user to delete parked virtual machines", False) # vocabulary if isinstance(self.entity, TNArchipelHypervisor): registrar_items = [{ "commands": ["park"], "parameters": [{ "name": "identifiers", "description": "the UUIDs of the VM to park, separated with comas, with no space" }], "method": self.message_park_hypervisor, "permissions": ["vmparking_park"], "description": "Park the virtual machine with the given UUIDs" }, { "commands": ["unpark"], "parameters": [{ "name": "identifiers", "description": "UUIDs of the virtual machines or parking tickets, separated by comas, with no space" }], "method": self.message_unpark, "permissions": ["vmparking_unpark"], "description": "Unpark the virtual machine parked with the given identifier" }, { "commands": ["park list"], "parameters": [], "method": self.message_list, "permissions": ["vmparking_list"], "description": "List all parked virtual machines" }] elif isinstance(self.entity, TNArchipelVirtualMachine): registrar_items = [ { "commands": ["park"], "parameters": [], "method": self.message_park_vm, "permissions": ["vmparking_park"], "description": "Park the virtual machine" }, ] self.entity.add_message_registrar_items(registrar_items) # register to the node vmrequest if isinstance(self.entity, TNArchipelHypervisor): self.entity.register_hook("HOOK_ARCHIPELENTITY_XMPP_AUTHENTICATED", method=self.manage_vmparking_node)
def __init__(self, configuration, entity, entry_point_group): """ Initialize the plugin. @type configuration: Configuration object @param configuration: the configuration @type entity: L{TNArchipelEntity} @param entity: the entity that owns the plugin @type entry_point_group: string @param entry_point_group: the group name of plugin entry_point """ TNArchipelPlugin.__init__(self, configuration=configuration, entity=entity, entry_point_group=entry_point_group) self.users = [] self.user_page_size = 50 self.need_user_refresh = True self.entities_types_cache = {} self.xmpp_server = entity.jid.getDomain() if configuration.has_option("XMPPSERVER", "use_xmlrpc_api") and configuration.getboolean("XMPPSERVER", "use_xmlrpc_api"): self.xmlrpc_host = configuration.get("XMPPSERVER", "xmlrpc_host") self.xmlrpc_port = configuration.getint("XMPPSERVER", "xmlrpc_port") if self.entity.__class__.__name__ == "TNArchipelCentralAgent": self.xmlrpc_user = configuration.get("CENTRALAGENT", "central_agent_xmpp_jid").split("@")[0] self.xmlrpc_password = configuration.get("CENTRALAGENT", "central_agent_xmpp_password") else: from archipel.archipelHypervisor import TNArchipelHypervisor from archipel.archipelVirtualMachine import TNArchipelVirtualMachine self.xmlrpc_user = configuration.get("HYPERVISOR", "hypervisor_xmpp_jid").split("@")[0] self.xmlrpc_password = configuration.get("HYPERVISOR", "hypervisor_xmpp_password") self.xmlrpc_prefix = "https" if configuration.getboolean("XMPPSERVER", "xmlrpc_sslonly") else "http" self.xmlrpc_call = "%s://%s:%s/" % (self.xmlrpc_prefix, self.xmlrpc_host, self.xmlrpc_port) self.xmlrpc_auth = {'user':self.xmlrpc_user, 'server': self.xmlrpc_host, 'password': self.xmlrpc_password} self.xmlrpc_server = xmlrpclib.ServerProxy(self.xmlrpc_call) if configuration.has_option("XMPPSERVER", "auto_group") and configuration.getboolean("XMPPSERVER", "auto_group"): self.autogroup_name_hypervisors = "All Hypervisors" self.autogroup_name_vms = "All Virtual Machines" self.autogroup_name_users = "All Users" if configuration.has_option("XMPPSERVER", "auto_group_name_virtualmachines"): self.autogroup_name_vms = configuration.get("XMPPSERVER", "auto_group_name_virtualmachines") if configuration.has_option("XMPPSERVER", "auto_group_name_hypervisors"): self.autogroup_name_hypervisors = configuration.get("XMPPSERVER", "auto_group_name_hypervisors") if configuration.has_option("XMPPSERVER", "auto_group_name_users"): self.autogroup_name_users = configuration.get("XMPPSERVER", "auto_group_name_users") auto_group_filter = "all" if configuration.has_option("XMPPSERVER", "auto_group_filter"): auto_group_filter = configuration.get("XMPPSERVER", "auto_group_filter") if not auto_group_filter in ("virtualmachines", "hypervisors", "all"): raise Exception("Bad configuration", "auto_group_filter must be virtualmachines, hypervisors or all.") self.autogroup_vms_id = self.autogroup_name_vms self.autogroup_hypervisors_id = self.autogroup_name_hypervisors self.autogroup_users_id = self.autogroup_name_users self.entity.register_hook("HOOK_ARCHIPELENTITY_PLUGIN_ALL_LOADED", method=self.create_autogroups_if_needed) if auto_group_filter in ("all", "hypervisors"): self.entity.register_hook("HOOK_HYPERVISOR_WOKE_UP", method=self.handle_autogroup_for_entity) if auto_group_filter in ("all", "virtualmachines"): self.entity.register_hook("HOOK_HYPERVISOR_ALLOC", method=self.handle_autogroup_for_entity) self.entity.register_hook("HOOK_HYPERVISOR_SOFT_ALLOC", method=self.handle_autogroup_for_entity) self.entity.register_hook("HOOK_HYPERVISOR_VM_WOKE_UP", method=self.handle_autogroup_for_entity) else: self.entity.log.info("XMLRPC module for Shared Roster Group management is disabled for this hypervisor") # permissions if self.entity.__class__.__name__ == "TNArchipelHypervisor": self.entity.permission_center.create_permission("xmppserver_groups_create", "Authorizes user to create shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_delete", "Authorizes user to delete shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_list", "Authorizes user to list shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_addusers", "Authorizes user to add users in shared groups", False) self.entity.permission_center.create_permission("xmppserver_groups_deleteusers", "Authorizes user to remove users from shared groups", False) self.entity.permission_center.create_permission("xmppserver_users_register", "Authorizes user to register XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_unregister", "Authorizes user to unregister XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_changepassword", "Authorizes user to change XMPP users password", False) self.entity.permission_center.create_permission("xmppserver_managementcapabilities", "Authorizes user to get management capabilities", False) if self.entity.__class__.__name__ != "TNArchipelCentralAgent": self.entity.permission_center.create_permission("xmppserver_users_list", "Authorizes user to list XMPP users", False) self.entity.permission_center.create_permission("xmppserver_users_number", "Authorizes user to get the total number of XMPP users", False)