diff options
author | Jenkins <jenkins@review.openstack.org> | 2017-08-01 16:08:13 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2017-08-01 16:08:13 +0000 |
commit | acafc0e5a25a34b8e6e81f93b6c514b5d79695cf (patch) | |
tree | b55cf4dc58cc9886fc5ab9f56a2462b748fc8cf7 | |
parent | 73bd95d4c52c7607a860d5dbc4b929c30c9c408e (diff) | |
parent | 9c888800318cf82651fc53868ae86c5761fe46f2 (diff) | |
download | ceilometer-acafc0e5a25a34b8e6e81f93b6c514b5d79695cf.tar.gz |
Merge "Fix inspect_vnics error for libvirt" into stable/ocata
-rw-r--r-- | ceilometer/compute/virt/libvirt/inspector.py | 8 | ||||
-rw-r--r-- | ceilometer/tests/unit/compute/virt/libvirt/test_inspector.py | 18 |
2 files changed, 19 insertions, 7 deletions
diff --git a/ceilometer/compute/virt/libvirt/inspector.py b/ceilometer/compute/virt/libvirt/inspector.py index 929d0a24..e56b94c9 100644 --- a/ceilometer/compute/virt/libvirt/inspector.py +++ b/ceilometer/compute/virt/libvirt/inspector.py @@ -166,12 +166,12 @@ class LibvirtInspector(virt_inspector.Inspector): dom_stats = domain.interfaceStats(name) stats = virt_inspector.InterfaceStats(rx_bytes=dom_stats[0], rx_packets=dom_stats[1], - rx_drop=dom_stats[2], - rx_errors=dom_stats[3], + rx_errors=dom_stats[2], + rx_drop=dom_stats[3], tx_bytes=dom_stats[4], tx_packets=dom_stats[5], - tx_drop=dom_stats[6], - tx_errors=dom_stats[7]) + tx_errors=dom_stats[6], + tx_drop=dom_stats[7]) yield (interface, stats) def inspect_disks(self, instance): diff --git a/ceilometer/tests/unit/compute/virt/libvirt/test_inspector.py b/ceilometer/tests/unit/compute/virt/libvirt/test_inspector.py index fc1e1edb..4079c4cc 100644 --- a/ceilometer/tests/unit/compute/virt/libvirt/test_inspector.py +++ b/ceilometer/tests/unit/compute/virt/libvirt/test_inspector.py @@ -173,9 +173,9 @@ class TestLibvirtInspection(base.BaseTestCase): """ interface_stats = { - 'vnet0': (1, 2, 0, 0, 3, 4, 0, 0), - 'vnet1': (5, 6, 0, 0, 7, 8, 0, 0), - 'vnet2': (9, 10, 0, 0, 11, 12, 0, 0), + 'vnet0': (1, 2, 21, 22, 3, 4, 23, 24), + 'vnet1': (5, 6, 25, 26, 7, 8, 27, 28), + 'vnet2': (9, 10, 29, 30, 11, 12, 31, 32), } interfaceStats = interface_stats.__getitem__ @@ -207,6 +207,10 @@ class TestLibvirtInspection(base.BaseTestCase): self.assertEqual(2, info0.rx_packets) self.assertEqual(3, info0.tx_bytes) self.assertEqual(4, info0.tx_packets) + self.assertEqual(21, info0.rx_errors) + self.assertEqual(22, info0.rx_drop) + self.assertEqual(23, info0.tx_errors) + self.assertEqual(24, info0.tx_drop) vnic1, info1 = interfaces[1] self.assertEqual('vnet1', vnic1.name) @@ -220,6 +224,10 @@ class TestLibvirtInspection(base.BaseTestCase): self.assertEqual(6, info1.rx_packets) self.assertEqual(7, info1.tx_bytes) self.assertEqual(8, info1.tx_packets) + self.assertEqual(25, info1.rx_errors) + self.assertEqual(26, info1.rx_drop) + self.assertEqual(27, info1.tx_errors) + self.assertEqual(28, info1.tx_drop) vnic2, info2 = interfaces[2] self.assertEqual('vnet2', vnic2.name) @@ -230,6 +238,10 @@ class TestLibvirtInspection(base.BaseTestCase): self.assertEqual(10, info2.rx_packets) self.assertEqual(11, info2.tx_bytes) self.assertEqual(12, info2.tx_packets) + self.assertEqual(29, info2.rx_errors) + self.assertEqual(30, info2.rx_drop) + self.assertEqual(31, info2.tx_errors) + self.assertEqual(32, info2.tx_drop) def test_inspect_vnics_with_domain_shutoff(self): connection = self.inspector.connection |