Beispiel #1
0
	def req_server_conf(self, request):
		cpuInfos = System.getCPUInfos()
		ram_total = System.getRAMTotal()
		
		doc = Document()
		rootNode = doc.createElement('configuration')
		
		rootNode.setAttribute("type", System.getName())
		rootNode.setAttribute("version", System.getVersion())
		rootNode.setAttribute("ram", str(ram_total))
		rootNode.setAttribute("ulteo_system", str(self.server.ulteo_system).lower())
		
		cpuNode = doc.createElement('cpu')
		cpuNode.setAttribute('nb_cores', str(cpuInfos[0]))
		textNode = doc.createTextNode(cpuInfos[1])
		cpuNode.appendChild(textNode)
		
		rootNode.appendChild(cpuNode)
		
		for role,dialog in self.server.role_dialogs:
			roleNode = doc.createElement('role')
			roleNode.setAttribute('name', dialog.getName())
			rootNode.appendChild(roleNode)
		
		doc.appendChild(rootNode)
		return self.req_answer(doc)
Beispiel #2
0
    def req_server_conf(self, request):
        cpuInfos = System.getCPUInfos()
        ram_total = System.getRAMTotal()

        doc = Document()
        rootNode = doc.createElement('configuration')

        rootNode.setAttribute("type", System.getName())
        rootNode.setAttribute("version", System.getVersion())
        rootNode.setAttribute("ram", str(ram_total))
        rootNode.setAttribute("ulteo_system",
                              str(self.server.ulteo_system).lower())

        cpuNode = doc.createElement('cpu')
        cpuNode.setAttribute('nb_cores', str(cpuInfos[0]))
        textNode = doc.createTextNode(cpuInfos[1])
        cpuNode.appendChild(textNode)

        rootNode.appendChild(cpuNode)

        for role, dialog in self.server.role_dialogs:
            roleNode = doc.createElement('role')
            roleNode.setAttribute('name', dialog.getName())
            rootNode.appendChild(roleNode)

        doc.appendChild(rootNode)
        return self.req_answer(doc)
Beispiel #3
0
    def init(self):
        Logger.debug("ApplicationServer init")

        try:
            TS.getList()
        except Exception:
            Logger.exception("RDP server dialog failed ... exiting")
            return

        if not System.groupExist(self.manager.ts_group_name):
            Logger.error("The group '%s' doesn't exist" %
                         (self.manager.ts_group_name))
            return False

        if not System.groupExist(self.manager.ovd_group_name):
            if not System.groupCreate(self.manager.ovd_group_name):
                return False

        if not self.manager.purgeGroup():
            Logger.error("Unable to purge group")
            return False

        if Config.clean_dump_archive:
            self.purgeArchives()

        if Config.thread_count is None:
            cpuInfos = System.getCPUInfos()
            vcpu = cpuInfos[0]
            ram_total = System.getRAMTotal()
            ram = int(round(ram_total / 1024.0 / 1024.0))

            nb_thread = int(round(1 + (ram + vcpu * 2) / 3))
        else:
            nb_thread = Config.thread_count

        Logger._instance.setQueue(self.logging_queue, True)
        for _ in xrange(nb_thread):
            self.threads.append(
                SessionManagement(self.manager, self.sessions_spooler,
                                  self.sessions_spooler2, self.sessions_sync,
                                  self.logging_queue))

        if self.canManageApplications():
            self.apt = Apt()
            self.apt.init()
            self.threads.append(self.apt)

        Logger.info(
            "ApplicationServer:: retrieve all applications installed (can take some time)"
        )
        self.updateApplications()

        return True
Beispiel #4
0
	def init(self):
		Logger.debug("ApplicationServer init")
		
		try:
			TS.getList()
		except Exception:
			Logger.exception("RDP server dialog failed ... exiting")
			return
		
		if not System.groupExist(self.manager.ts_group_name):
			Logger.error("The group '%s' doesn't exist"%(self.manager.ts_group_name))
			return False
		
		if not System.groupExist(self.manager.ovd_group_name):
			if not System.groupCreate(self.manager.ovd_group_name):
				return False
		
		if not self.manager.purgeGroup():
			Logger.error("Unable to purge group")
			return False
		
		if Config.clean_dump_archive:
			self.purgeArchives()
		
		if Config.thread_count is None:
			cpuInfos = System.getCPUInfos()
			vcpu = cpuInfos[0]
			ram_total = System.getRAMTotal()
			ram = int(round(ram_total / 1024.0 / 1024.0))
			
			nb_thread = int(round(1 + (ram + vcpu * 2)/3))
		else:
			nb_thread = Config.thread_count
		
		Logger._instance.setQueue(self.logging_queue, True)
		for _ in xrange(nb_thread):
			self.threads.append(SessionManagement(self.manager, self.sessions_spooler, self.sessions_spooler2, self.sessions_sync, self.logging_queue))
		
		if self.canManageApplications():
			self.apt = Apt()
			self.apt.init()
			self.threads.append(self.apt)
		
		Logger.info("ApplicationServer:: retrieve all applications installed (can take some time)")
		self.updateApplications()
		
		return True
Beispiel #5
0
    def req_status(self):

        doc = Document()
        rootNode = doc.createElement("hypervisor")
        doc.appendChild(rootNode)

        cpuInfo = System.getCPUInfos()

        list_masters = self.role_instance.pool.masters

        for master in list_masters:

            node_master = doc.createElement("master")

            master = list_masters[master]

            node_master.setAttribute("capacity", str(master.get_capacity()))
            node_master.setAttribute("allocation",
                                     str(master.get_allocation()))
            node_master.setAttribute("id", str(master.name))
            node_master.setAttribute("name", str(master.get_name()))
            node_master.setAttribute("vcpu", "1")
            node_master.setAttribute("ram", "2000")
            node_master.setAttribute("cpu_model", str(cpuInfo[0]))

            rootNode.appendChild(node_master)

        list_instances = self.role_instance.pool.instances

        for instance in list_instances:

            node_instance = doc.createElement("instance")

            instance = list_instances[instance]

            node_instance.setAttribute("id", str(instance.name))
            node_instance.setAttribute("master",
                                       instance.master.get_file_name())

            rootNode.appendChild(node_instance)

        list_vm = self.role_instance.virtual_machine

        for vm in list_vm:

            node_vm = doc.createElement("vm")

            vm = list_vm[vm]

            node_vm.setAttribute("status", vm.getState())
            node_vm.setAttribute("id", vm.name[10:])
            node_vm.setAttribute("master", vm.instance.master.name)
            node_vm.setAttribute("vcpu", str(vm.getVcpus()))
            node_vm.setAttribute("cpu_model", str(cpuInfo[0]))
            node_vm.setAttribute("ram", str(vm.getCurrentMemory()))
            node_vm_name = doc.createElement("name")
            node_vm_name.appendChild(doc.createTextNode(vm.name[10:]))

            node_vm.appendChild(node_vm_name)
            rootNode.appendChild(node_vm)

        return self.req_answer(doc)
Beispiel #6
0
	def req_status(self):
		
		doc = Document()
		rootNode = doc.createElement("hypervisor")
		doc.appendChild(rootNode)
		
		cpuInfo = System.getCPUInfos()
		
		list_masters = self.role_instance.pool.masters
		
		for master in list_masters:
			
			node_master = doc.createElement("master")
			
			master = list_masters[master]
			
			node_master.setAttribute("capacity", str(master.get_capacity()))
			node_master.setAttribute("allocation", str(master.get_allocation()))
			node_master.setAttribute("id", str(master.name))
			node_master.setAttribute("name",str(master.get_name()))
			node_master.setAttribute("vcpu", "1")
			node_master.setAttribute("ram", "2000")
			node_master.setAttribute("cpu_model", str(cpuInfo[0]))
			
			rootNode.appendChild(node_master)
			
		list_instances = self.role_instance.pool.instances
		
		for instance in list_instances:
			
			node_instance = doc.createElement("instance")
			
			instance = list_instances[instance]
			
			node_instance.setAttribute("id", str(instance.name))
			node_instance.setAttribute("master" , instance.master.get_file_name())
			
			rootNode.appendChild(node_instance)
			
		
		list_vm = self.role_instance.virtual_machine
		
		for vm in list_vm:
			
			node_vm = doc.createElement("vm")
			
			vm = list_vm[vm]
			
			node_vm.setAttribute("status",vm.getState())
			node_vm.setAttribute("id",vm.name[10:])
			node_vm.setAttribute("master" , vm.instance.master.name)
			node_vm.setAttribute("vcpu",str(vm.getVcpus()))
			node_vm.setAttribute("cpu_model", str(cpuInfo[0]))
			node_vm.setAttribute("ram",str(vm.getCurrentMemory()))
			node_vm_name = doc.createElement("name")
			node_vm_name.appendChild(doc.createTextNode(vm.name[10:]))
			
			node_vm.appendChild(node_vm_name)
			rootNode.appendChild(node_vm)
		
		return self.req_answer(doc)