当前位置: 首页>>代码示例>>Python>>正文


Python System.getCPUInfos方法代码示例

本文整理汇总了Python中ovd.Platform.System.System.getCPUInfos方法的典型用法代码示例。如果您正苦于以下问题:Python System.getCPUInfos方法的具体用法?Python System.getCPUInfos怎么用?Python System.getCPUInfos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ovd.Platform.System.System的用法示例。


在下文中一共展示了System.getCPUInfos方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: req_server_conf

# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getCPUInfos [as 别名]
	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)
开发者ID:bloveing,项目名称:openulteo,代码行数:28,代码来源:Dialog.py

示例2: init

# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getCPUInfos [as 别名]
	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
开发者ID:bloveing,项目名称:openulteo,代码行数:49,代码来源:Role.py

示例3: req_status

# 需要导入模块: from ovd.Platform.System import System [as 别名]
# 或者: from ovd.Platform.System.System import getCPUInfos [as 别名]
	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)
开发者ID:bloveing,项目名称:openulteo,代码行数:63,代码来源:Dialog.py


注:本文中的ovd.Platform.System.System.getCPUInfos方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。