summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgord chung <gord@live.ca>2017-03-21 14:47:31 +0000
committerDrew Thorstensen <thorst@us.ibm.com>2017-04-10 21:27:56 -0400
commit562b5182f87e6399ae05d6ad63e88caad16cde8e (patch)
treedc73dd3611e5b51a7193e22ab65d408fcfbd0bef
parentfdac541e7091b0019669b9348abfb197558f8971 (diff)
use new instance polling interface
ceilometer has a new polling interface that inspects instance at once rather than individual parts at a time. Includes changes for vnic polling interface and disk polling interface. Change-Id: Ieb68420eba002a36569db41c36ddf827bb9edfea
Notes
Notes (review): Verified+1: IBM PowerVM CI <powervmci@linux.vnet.ibm.com> Code-Review+1: gordon chung <gord@live.ca> Code-Review+2: Eric Fried <efried@us.ibm.com> Workflow+1: Eric Fried <efried@us.ibm.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 11 Apr 2017 16:22:16 +0000 Reviewed-on: https://review.openstack.org/448134 Project: openstack/ceilometer-powervm Branch: refs/heads/master
-rw-r--r--ceilometer_powervm/compute/virt/powervm/inspector.py91
-rw-r--r--ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py104
2 files changed, 73 insertions, 122 deletions
diff --git a/ceilometer_powervm/compute/virt/powervm/inspector.py b/ceilometer_powervm/compute/virt/powervm/inspector.py
index f2707d9..cd4856c 100644
--- a/ceilometer_powervm/compute/virt/powervm/inspector.py
+++ b/ceilometer_powervm/compute/virt/powervm/inspector.py
@@ -84,12 +84,18 @@ class PowerVMInspector(virt_inspector.Inspector):
84 LOG.debug("Host UUID: %s" % hosts[0].uuid) 84 LOG.debug("Host UUID: %s" % hosts[0].uuid)
85 return hosts[0].uuid 85 return hosts[0].uuid
86 86
87 def inspect_cpus(self, instance): 87 def inspect_instance(self, instance, duration=None):
88 """Inspect the CPU statistics for an instance. 88 """Inspect the statistics for an instance.
89 89
90 :param instance: the target instance 90 :param instance: the target instance
91 :return: the number of CPUs and cumulative CPU time 91 :param duration: the last 'n' seconds, over which the value should be
92 inspected.
93
94 The PowerVM implementation does not make use of the duration
95 field.
96 :return: the instance statistics
92 """ 97 """
98
93 uuid = self._puuid(instance) 99 uuid = self._puuid(instance)
94 cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid) 100 cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid)
95 101
@@ -102,20 +108,8 @@ class PowerVMInspector(virt_inspector.Inspector):
102 108
103 cpu_time = (cur_metric.processor.util_cap_proc_cycles + 109 cpu_time = (cur_metric.processor.util_cap_proc_cycles +
104 cur_metric.processor.util_uncap_proc_cycles) 110 cur_metric.processor.util_uncap_proc_cycles)
105 return virt_inspector.CPUStats(number=cur_metric.processor.virt_procs, 111 cpu_num = cur_metric.processor.virt_procs
106 time=cpu_time)
107
108 def inspect_cpu_util(self, instance, duration=None):
109 """Inspect the CPU Utilization (%) for an instance.
110
111 :param instance: the target instance
112 :param duration: the last 'n' seconds, over which the value should be
113 inspected.
114 112
115 The PowerVM implementation does not make use of the duration
116 field.
117 :return: the percentage of CPU utilization
118 """
119 # The duration is ignored. There is precedent for this in other 113 # The duration is ignored. There is precedent for this in other
120 # inspectors if the platform doesn't support duration. 114 # inspectors if the platform doesn't support duration.
121 # 115 #
@@ -126,17 +120,8 @@ class PowerVMInspector(virt_inspector.Inspector):
126 120
127 # Get the current and previous sample. Delta is performed between 121 # Get the current and previous sample. Delta is performed between
128 # these two. 122 # these two.
129 uuid = self._puuid(instance)
130 cur_date, cur_metric = self.vm_metrics.get_latest_metric(uuid)
131 prev_date, prev_metric = self.vm_metrics.get_previous_metric(uuid) 123 prev_date, prev_metric = self.vm_metrics.get_previous_metric(uuid)
132 124
133 # If the current is none, then the instance can not be found in the
134 # sample and an error should be raised.
135 if cur_metric is None:
136 raise virt_inspector.InstanceNotFoundException(
137 _('VM %s not found in PowerVM Metrics Sample.') %
138 instance.name)
139
140 # Get the current data. 125 # Get the current data.
141 cur_util_cap = cur_metric.processor.util_cap_proc_cycles 126 cur_util_cap = cur_metric.processor.util_cap_proc_cycles
142 cur_util_uncap = cur_metric.processor.util_uncap_proc_cycles 127 cur_util_uncap = cur_metric.processor.util_uncap_proc_cycles
@@ -157,9 +142,8 @@ class PowerVMInspector(virt_inspector.Inspector):
157 "It is either a new VM or was recently migrated. " 142 "It is either a new VM or was recently migrated. "
158 "It will be collected in the next inspection " 143 "It will be collected in the next inspection "
159 "cycle."), instance.name) 144 "cycle."), instance.name)
160 message = (_("Unable to derive CPU Utilization for VM %s.") % 145 return virt_inspector.InstanceStats(
161 instance.name) 146 cpu_time=cpu_time, cpu_number=cpu_num)
162 raise virt_inspector.InstanceNotFoundException(message)
163 147
164 # Gather the previous metrics 148 # Gather the previous metrics
165 prev_util_cap = prev_metric.processor.util_cap_proc_cycles 149 prev_util_cap = prev_metric.processor.util_cap_proc_cycles
@@ -203,14 +187,13 @@ class PowerVMInspector(virt_inspector.Inspector):
203 # If the entitled is zero, that generally means that the VM has not 187 # If the entitled is zero, that generally means that the VM has not
204 # been started yet (everything else would be zero as well). So to 188 # been started yet (everything else would be zero as well). So to
205 # avoid a divide by zero error, just return 0% in that case. 189 # avoid a divide by zero error, just return 0% in that case.
206 if entitled == 0: 190 util = (float(util_cap + util_uncap - idle - donated) / float(entitled)
207 return virt_inspector.CPUUtilStats(util=0.0) 191 if entitled else 0.0)
208
209 util = float(util_cap + util_uncap - idle - donated) / float(entitled)
210 192
211 # Utilization is reported as percents. Therefore, multiply by 100.0 193 # Utilization is reported as percents. Therefore, multiply by 100.0
212 # to get a readable percentage based format. 194 # to get a readable percentage based format.
213 return virt_inspector.CPUUtilStats(util=util * 100.0) 195 return virt_inspector.InstanceStats(
196 cpu_util=util * 100.0, cpu_time=cpu_time, cpu_number=cpu_num)
214 197
215 @staticmethod 198 @staticmethod
216 def mac_for_metric_cna(metric_cna, client_cnas): 199 def mac_for_metric_cna(metric_cna, client_cnas):
@@ -279,14 +262,13 @@ class PowerVMInspector(virt_inspector.Inspector):
279 262
280 # The name will be the location code. MAC is identified from 263 # The name will be the location code. MAC is identified from
281 # above. Others appear libvirt specific. 264 # above. Others appear libvirt specific.
282 interface = virt_inspector.Interface( 265 #
283 name=metric_cna.physical_location,
284 mac=mac, fref=None, parameters=None)
285
286 # PowerVM doesn't specify drops by receive vs. transmit. Since we 266 # PowerVM doesn't specify drops by receive vs. transmit. Since we
287 # have the client adapter, we assume all are receive drops. 267 # have the client adapter, we assume all are receive drops.
288 # There are no error metrics available. 268 # There are no error metrics available.
289 stats = virt_inspector.InterfaceStats( 269 yield virt_inspector.InterfaceStats(
270 name=metric_cna.physical_location,
271 mac=mac, fref=None, parameters=None,
290 rx_bytes=metric_cna.received_bytes, 272 rx_bytes=metric_cna.received_bytes,
291 rx_packets=metric_cna.received_packets, 273 rx_packets=metric_cna.received_packets,
292 rx_drop=metric_cna.dropped_packets, 274 rx_drop=metric_cna.dropped_packets,
@@ -296,9 +278,6 @@ class PowerVMInspector(virt_inspector.Inspector):
296 tx_drop=0, 278 tx_drop=0,
297 tx_errors=0) 279 tx_errors=0)
298 280
299 # Yield the stats up to the invoker
300 yield (interface, stats)
301
302 def inspect_vnic_rates(self, instance, duration=None): 281 def inspect_vnic_rates(self, instance, duration=None):
303 """Inspect the vNIC rate statistics for an instance. 282 """Inspect the vNIC rate statistics for an instance.
304 283
@@ -358,12 +337,6 @@ class PowerVMInspector(virt_inspector.Inspector):
358 if mac is None: 337 if mac is None:
359 continue 338 continue
360 339
361 # The name will be the location code. MAC is identified from
362 # above. Others appear libvirt specific.
363 interface = virt_inspector.Interface(
364 name=metric_cna.physical_location,
365 mac=mac, fref=None, parameters=None)
366
367 # Note that here, the previous may be none. That simply indicates 340 # Note that here, the previous may be none. That simply indicates
368 # that the adapter was dynamically added to the VM before the 341 # that the adapter was dynamically added to the VM before the
369 # previous collection. Not the migration scenario above. 342 # previous collection. Not the migration scenario above.
@@ -378,10 +351,13 @@ class PowerVMInspector(virt_inspector.Inspector):
378 # in time between the two samples. 351 # in time between the two samples.
379 rx_rate = float(rx_bytes_diff) / float(date_delta_num) 352 rx_rate = float(rx_bytes_diff) / float(date_delta_num)
380 tx_rate = float(tx_bytes_diff) / float(date_delta_num) 353 tx_rate = float(tx_bytes_diff) / float(date_delta_num)
381 stats = virt_inspector.InterfaceRateStats(rx_rate, tx_rate)
382 354
383 # Yield the results back to the invoker. 355 # The name will be the location code. MAC is identified from
384 yield (interface, stats) 356 # above. Others appear libvirt specific.
357 yield virt_inspector.InterfaceRateStats(
358 name=metric_cna.physical_location,
359 mac=mac, fref=None, parameters=None,
360 rx_bytes_rate=rx_rate, tx_bytes_rate=tx_rate)
385 361
386 def inspect_disks(self, instance): 362 def inspect_disks(self, instance):
387 """Inspect the disk statistics for an instance. 363 """Inspect the disk statistics for an instance.
@@ -419,12 +395,10 @@ class PowerVMInspector(virt_inspector.Inspector):
419 for adpt in adpts: 395 for adpt in adpts:
420 # PowerVM only shows the connection (SCSI or FC). Name after 396 # PowerVM only shows the connection (SCSI or FC). Name after
421 # the connection name 397 # the connection name
422 disk = virt_inspector.Disk(device=adpt.name) 398 yield virt_inspector.DiskStats(
423 stats = virt_inspector.DiskStats( 399 device=adpt.name, read_requests=adpt.num_reads,
424 read_requests=adpt.num_reads, read_bytes=adpt.read_bytes, 400 read_bytes=adpt.read_bytes, write_requests=adpt.num_writes,
425 write_requests=adpt.num_writes, write_bytes=adpt.write_bytes, 401 write_bytes=adpt.write_bytes, errors=0)
426 errors=0)
427 yield (disk, stats)
428 402
429 def inspect_disk_iops(self, instance): 403 def inspect_disk_iops(self, instance):
430 """Inspect the Disk Input/Output operations per second for an instance. 404 """Inspect the Disk Input/Output operations per second for an instance.
@@ -494,6 +468,5 @@ class PowerVMInspector(virt_inspector.Inspector):
494 468
495 # PowerVM only shows the connection (SCSI or FC). Name after 469 # PowerVM only shows the connection (SCSI or FC). Name after
496 # the connection name 470 # the connection name
497 disk = virt_inspector.Disk(device=cur_adpt.name) 471 yield virt_inspector.DiskIOPSStats(device=cur_adpt.name,
498 stats = virt_inspector.DiskIOPSStats(iops_count=iops) 472 iops_count=iops)
499 yield (disk, stats)
diff --git a/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py b/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py
index 96d03c7..32cd24e 100644
--- a/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py
+++ b/ceilometer_powervm/tests/compute/virt/powervm/test_inspector.py
@@ -79,41 +79,18 @@ class TestPowerVMInspector(base.BaseTestCase):
79 self.inspector = p_inspect.PowerVMInspector(None) 79 self.inspector = p_inspect.PowerVMInspector(None)
80 self.inspector.vm_metrics = self.mock_metrics 80 self.inspector.vm_metrics = self.mock_metrics
81 81
82 def test_inspect_cpus(self): 82 def test_inspect_instance_stats(self):
83 """Validates PowerVM's inspect_cpus method.""" 83 """Validates PowerVM's inspect_instance method."""
84 # Validate that an error is raised if the instance can't be found 84 # Validate that an error is raised if the instance can't be found
85 # in the sample 85 # in the sample
86 self.mock_metrics.get_latest_metric.return_value = None, None 86 self.mock_metrics.get_latest_metric.return_value = None, None
87 self.assertRaises(virt_inspector.InstanceNotFoundException, 87 self.assertRaises(virt_inspector.InstanceNotFoundException,
88 self.inspector.inspect_cpus, mock.Mock()) 88 self.inspector.inspect_instance, mock.Mock())
89
90 # Build a response from the metric cache.
91 metric = mock.MagicMock()
92 metric.processor.util_cap_proc_cycles = 5
93 metric.processor.util_uncap_proc_cycles = 6
94 metric.processor.virt_procs = 12
95 self.mock_metrics.get_latest_metric.return_value = mock.Mock(), metric
96
97 # Invoke with the test data
98 resp = self.inspector.inspect_cpus(mock.Mock())
99
100 # Validate the metrics that came back
101 self.assertEqual(11, resp.time)
102 self.assertEqual(12, resp.number)
103
104 def test_inspect_cpu_util(self):
105 """Validates PowerVM's inspect_cpu_util method."""
106 # Validate that an error is raised if the instance can't be found in
107 # the sample data.
108 self.mock_metrics.get_latest_metric.return_value = None, None
109 self.mock_metrics.get_previous_metric.return_value = None, None
110 self.assertRaises(virt_inspector.InstanceNotFoundException,
111 self.inspector.inspect_cpu_util,
112 mock.Mock(), duration=30)
113 89
114 def mock_metric(util_cap, util_uncap, idle, donated, entitled): 90 def mock_metric(util_cap, util_uncap, idle, donated, entitled):
115 """Helper method to create mock proc metrics.""" 91 """Helper method to create mock proc metrics."""
116 metric = mock.MagicMock() 92 metric = mock.MagicMock()
93 metric.processor.virt_procs = 12
117 metric.processor.util_cap_proc_cycles = util_cap 94 metric.processor.util_cap_proc_cycles = util_cap
118 metric.processor.util_uncap_proc_cycles = util_uncap 95 metric.processor.util_uncap_proc_cycles = util_uncap
119 metric.processor.idle_proc_cycles = idle 96 metric.processor.idle_proc_cycles = idle
@@ -126,8 +103,9 @@ class TestPowerVMInspector(base.BaseTestCase):
126 self.mock_metrics.get_latest_metric.return_value = ( 103 self.mock_metrics.get_latest_metric.return_value = (
127 mock.Mock(), mock_metric(7000, 50, 1000, 5000, 10000)) 104 mock.Mock(), mock_metric(7000, 50, 1000, 5000, 10000))
128 self.mock_metrics.get_previous_metric.return_value = None, None 105 self.mock_metrics.get_previous_metric.return_value = None, None
129 self.assertRaises(virt_inspector.InstanceNotFoundException, 106 resp = self.inspector.inspect_instance(mock.Mock())
130 self.inspector.inspect_cpu_util, mock.Mock()) 107 self.assertEqual(7050, resp.cpu_time)
108 self.assertEqual(12, resp.cpu_number)
131 109
132 # Mock up a mixed use environment. 110 # Mock up a mixed use environment.
133 cur = mock_metric(7000, 50, 1000, 5000, 10000) 111 cur = mock_metric(7000, 50, 1000, 5000, 10000)
@@ -136,8 +114,8 @@ class TestPowerVMInspector(base.BaseTestCase):
136 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev 114 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev
137 115
138 # Execute and validate 116 # Execute and validate
139 resp = self.inspector.inspect_cpu_util(mock.Mock()) 117 resp = self.inspector.inspect_instance(mock.Mock())
140 self.assertEqual(.5, resp.util) 118 self.assertEqual(.5, resp.cpu_util)
141 119
142 # Mock an instance with a dedicated processor, but idling and donating 120 # Mock an instance with a dedicated processor, but idling and donating
143 # cycles to others. In these scenarios, util_cap shows full use, but 121 # cycles to others. In these scenarios, util_cap shows full use, but
@@ -148,8 +126,8 @@ class TestPowerVMInspector(base.BaseTestCase):
148 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev 126 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev
149 127
150 # Execute and validate 128 # Execute and validate
151 resp = self.inspector.inspect_cpu_util(mock.Mock()) 129 resp = self.inspector.inspect_instance(mock.Mock())
152 self.assertEqual(51.0, resp.util) 130 self.assertEqual(51.0, resp.cpu_util)
153 131
154 # Mock an instance with a shared processor. By nature, this doesn't 132 # Mock an instance with a shared processor. By nature, this doesn't
155 # idle or donate. If it is 'idling' it is simply giving the cycles 133 # idle or donate. If it is 'idling' it is simply giving the cycles
@@ -160,8 +138,8 @@ class TestPowerVMInspector(base.BaseTestCase):
160 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev 138 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev
161 139
162 # Execute and validate 140 # Execute and validate
163 resp = self.inspector.inspect_cpu_util(mock.Mock()) 141 resp = self.inspector.inspect_instance(mock.Mock())
164 self.assertEqual(80.0, resp.util) 142 self.assertEqual(80.0, resp.cpu_util)
165 143
166 # Mock an instance with a shared processor - but using cycles from 144 # Mock an instance with a shared processor - but using cycles from
167 # the uncap pool. This means it is using extra cycles from other 145 # the uncap pool. This means it is using extra cycles from other
@@ -173,8 +151,8 @@ class TestPowerVMInspector(base.BaseTestCase):
173 151
174 # Execute and validate. This should be running at 300% CPU 152 # Execute and validate. This should be running at 300% CPU
175 # utilization. Fast! 153 # utilization. Fast!
176 resp = self.inspector.inspect_cpu_util(mock.Mock()) 154 resp = self.inspector.inspect_instance(mock.Mock())
177 self.assertEqual(300.0, resp.util) 155 self.assertEqual(300.0, resp.cpu_util)
178 156
179 # Mock an instance that hasn't been started yet. 157 # Mock an instance that hasn't been started yet.
180 cur = mock_metric(0, 0, 0, 0, 0) 158 cur = mock_metric(0, 0, 0, 0, 0)
@@ -183,8 +161,8 @@ class TestPowerVMInspector(base.BaseTestCase):
183 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev 161 self.mock_metrics.get_previous_metric.return_value = mock.Mock(), prev
184 162
185 # This should have 0% utilization 163 # This should have 0% utilization
186 resp = self.inspector.inspect_cpu_util(mock.Mock()) 164 resp = self.inspector.inspect_instance(mock.Mock())
187 self.assertEqual(0.0, resp.util) 165 self.assertEqual(0.0, resp.cpu_util)
188 166
189 @staticmethod 167 @staticmethod
190 def _mock_vnic_metric(rec_bytes, tx_bytes, rec_pkts, tx_pkts, phys_loc, 168 def _mock_vnic_metric(rec_bytes, tx_bytes, rec_pkts, tx_pkts, phys_loc,
@@ -252,9 +230,9 @@ class TestPowerVMInspector(base.BaseTestCase):
252 resp = list(self.inspector.inspect_vnics(mock.Mock())) 230 resp = list(self.inspector.inspect_vnics(mock.Mock()))
253 self.assertEqual(3, len(resp)) 231 self.assertEqual(3, len(resp))
254 232
255 interface1, stats1 = resp[0] 233 stats1 = resp[0]
256 self.assertEqual('aa:bb:cc:dd:ee:ff', interface1.mac) 234 self.assertEqual('aa:bb:cc:dd:ee:ff', stats1.mac)
257 self.assertEqual('a', interface1.name) 235 self.assertEqual('a', stats1.name)
258 self.assertEqual(1000, stats1.rx_bytes) 236 self.assertEqual(1000, stats1.rx_bytes)
259 self.assertEqual(1000, stats1.tx_bytes) 237 self.assertEqual(1000, stats1.tx_bytes)
260 self.assertEqual(10, stats1.rx_packets) 238 self.assertEqual(10, stats1.rx_packets)
@@ -302,23 +280,23 @@ class TestPowerVMInspector(base.BaseTestCase):
302 self.assertEqual(3, len(resp)) 280 self.assertEqual(3, len(resp))
303 281
304 # First metric. No delta 282 # First metric. No delta
305 interface1, stats1 = resp[0] 283 stats1 = resp[0]
306 self.assertEqual('aa:bb:cc:dd:ee:ff', interface1.mac) 284 self.assertEqual('aa:bb:cc:dd:ee:ff', stats1.mac)
307 self.assertEqual('a', interface1.name) 285 self.assertEqual('a', stats1.name)
308 self.assertEqual(0, stats1.rx_bytes_rate) 286 self.assertEqual(0, stats1.rx_bytes_rate)
309 self.assertEqual(0, stats1.tx_bytes_rate) 287 self.assertEqual(0, stats1.tx_bytes_rate)
310 288
311 # Second metric 289 # Second metric
312 interface2, stats2 = resp[1] 290 stats2 = resp[1]
313 self.assertEqual('aa:bb:cc:dd:ee:11', interface2.mac) 291 self.assertEqual('aa:bb:cc:dd:ee:11', stats2.mac)
314 self.assertEqual('b', interface2.name) 292 self.assertEqual('b', stats2.name)
315 self.assertEqual(60.0, stats2.rx_bytes_rate) 293 self.assertEqual(60.0, stats2.rx_bytes_rate)
316 self.assertEqual(60.0, stats2.tx_bytes_rate) 294 self.assertEqual(60.0, stats2.tx_bytes_rate)
317 295
318 # Third metric had no previous. 296 # Third metric had no previous.
319 interface3, stats3 = resp[2] 297 stats3 = resp[2]
320 self.assertEqual('aa:bb:cc:dd:ee:22', interface3.mac) 298 self.assertEqual('aa:bb:cc:dd:ee:22', stats3.mac)
321 self.assertEqual('c', interface3.name) 299 self.assertEqual('c', stats3.name)
322 self.assertEqual(100.0, stats3.rx_bytes_rate) 300 self.assertEqual(100.0, stats3.rx_bytes_rate)
323 self.assertEqual(100.0, stats3.tx_bytes_rate) 301 self.assertEqual(100.0, stats3.tx_bytes_rate)
324 302
@@ -387,17 +365,17 @@ class TestPowerVMInspector(base.BaseTestCase):
387 self.assertEqual(3, len(resp)) 365 self.assertEqual(3, len(resp))
388 366
389 # Two vSCSI's 367 # Two vSCSI's
390 disk1, stats1 = resp[0] 368 stats1 = resp[0]
391 self.assertEqual('vscsi1', disk1.device) 369 self.assertEqual('vscsi1', stats1.device)
392 self.assertEqual(33, stats1.iops_count) 370 self.assertEqual(33, stats1.iops_count)
393 371
394 disk2, stats2 = resp[1] 372 stats2 = resp[1]
395 self.assertEqual('vscsi2', disk2.device) 373 self.assertEqual('vscsi2', stats2.device)
396 self.assertEqual(133, stats2.iops_count) 374 self.assertEqual(133, stats2.iops_count)
397 375
398 # Next is the vFC metric 376 # Next is the vFC metric
399 disk3, stats3 = resp[2] 377 stats3 = resp[2]
400 self.assertEqual('vfc1', disk3.device) 378 self.assertEqual('vfc1', stats3.device)
401 self.assertEqual(66, stats3.iops_count) 379 self.assertEqual(66, stats3.iops_count)
402 380
403 def test_inspect_disks(self): 381 def test_inspect_disks(self):
@@ -425,16 +403,16 @@ class TestPowerVMInspector(base.BaseTestCase):
425 self.assertEqual(3, len(resp)) 403 self.assertEqual(3, len(resp))
426 404
427 # Two vSCSIs. 405 # Two vSCSIs.
428 disk1, stats1 = resp[0] 406 stats1 = resp[0]
429 self.assertEqual('vscsi1', disk1.device) 407 self.assertEqual('vscsi1', stats1.device)
430 self.assertEqual(1000, stats1.read_requests) 408 self.assertEqual(1000, stats1.read_requests)
431 self.assertEqual(100000, stats1.read_bytes) 409 self.assertEqual(100000, stats1.read_bytes)
432 self.assertEqual(1000, stats1.write_requests) 410 self.assertEqual(1000, stats1.write_requests)
433 self.assertEqual(100000, stats1.write_bytes) 411 self.assertEqual(100000, stats1.write_bytes)
434 self.assertEqual(0, stats1.errors) 412 self.assertEqual(0, stats1.errors)
435 413
436 disk2, stats2 = resp[1] 414 stats2 = resp[1]
437 self.assertEqual('vscsi2', disk2.device) 415 self.assertEqual('vscsi2', stats2.device)
438 self.assertEqual(2000, stats2.read_requests) 416 self.assertEqual(2000, stats2.read_requests)
439 self.assertEqual(200000, stats2.read_bytes) 417 self.assertEqual(200000, stats2.read_bytes)
440 self.assertEqual(2000, stats2.write_requests) 418 self.assertEqual(2000, stats2.write_requests)
@@ -442,8 +420,8 @@ class TestPowerVMInspector(base.BaseTestCase):
442 self.assertEqual(0, stats1.errors) 420 self.assertEqual(0, stats1.errors)
443 421
444 # Next is the vFC metric 422 # Next is the vFC metric
445 disk3, stats3 = resp[2] 423 stats3 = resp[2]
446 self.assertEqual('vfc1', disk3.device) 424 self.assertEqual('vfc1', stats3.device)
447 self.assertEqual(3000, stats3.read_requests) 425 self.assertEqual(3000, stats3.read_requests)
448 self.assertEqual(300000, stats3.read_bytes) 426 self.assertEqual(300000, stats3.read_bytes)
449 self.assertEqual(3000, stats3.write_requests) 427 self.assertEqual(3000, stats3.write_requests)