~ubuntu-branches/ubuntu/vivid/ceilometer/vivid

« back to all changes in this revision

Viewing changes to ceilometer/compute/virt/hyperv/inspector.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2014-03-06 14:44:28 UTC
  • mto: (28.1.1 utopic-proposed) (1.2.1)
  • mto: This revision was merged to the branch mainline in revision 19.
  • Revision ID: package-import@ubuntu.com-20140306144428-rvphsh4igwyulzf0
Tags: upstream-2014.1~b3
ImportĀ upstreamĀ versionĀ 2014.1~b3

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
from ceilometer.compute.virt.hyperv import utilsv2
22
22
from ceilometer.compute.virt import inspector as virt_inspector
23
23
from ceilometer.openstack.common import log
 
24
from ceilometer.openstack.common import units
24
25
 
25
26
CONF = cfg.CONF
26
27
LOG = log.getLogger(__name__)
46
47
        cpu_percent_used = (cpu_clock_used /
47
48
                            float(host_cpu_clock * cpu_count))
48
49
        # Nanoseconds
49
 
        cpu_time = (long(uptime * cpu_percent_used) *
50
 
                    1000)
 
50
        cpu_time = (long(uptime * cpu_percent_used) * units.k)
51
51
 
52
52
        return virt_inspector.CPUStats(number=cpu_count, time=cpu_time)
53
53
 
77
77
            stats = virt_inspector.DiskStats(
78
78
                read_requests=0,
79
79
                # Return bytes
80
 
                read_bytes=disk_metrics['read_mb'] * 1024,
 
80
                read_bytes=disk_metrics['read_mb'] * units.Ki,
81
81
                write_requests=0,
82
 
                write_bytes=disk_metrics['write_mb'] * 1024,
 
82
                write_bytes=disk_metrics['write_mb'] * units.Ki,
83
83
                errors=0)
84
84
 
85
85
            yield (disk, stats)