Exemplo n.º 1
0
    def inspect_cpus(self, instance_name):
        (cpu_clock_used, cpu_count,
         uptime) = self._utils.get_cpu_metrics(instance_name)
        host_cpu_clock, host_cpu_count = self._utils.get_host_cpu_info()

        cpu_percent_used = (cpu_clock_used / float(host_cpu_clock * cpu_count))
        # Nanoseconds
        cpu_time = (long(uptime * cpu_percent_used) * units.k)

        return virt_inspector.CPUStats(number=cpu_count, time=cpu_time)
Exemplo n.º 2
0
 def inspect_cpus(self, instance_name):
     domain = self._lookup_by_name(instance_name)
     dom_info = domain.info()
     return virt_inspector.CPUStats(number=dom_info[3], time=dom_info[4])