Fix two resource IDs generated for same one NIC
If a zvm virtual machine did a resize once, its userid changed. Right now, when inspecting nic data, two different userid will have two resource IDs generated which will make consumer confused. Fix this bug by remove vswitch and userid from nic_id. Change-Id: I9cedf71be5702d4f31b80bc91fbc23267dfed5a9
This commit is contained in:
parent
0c8e3ac1a5
commit
ef127c85b2
|
@ -179,10 +179,8 @@ class ZVMInspector(virt_inspector.Inspector):
|
|||
def inspect_vnics(self, instance):
|
||||
inst_stat = self._get_inst_stat('vnics', instance)
|
||||
for nic in inst_stat['nics']:
|
||||
nic_id = '_'.join((nic['vswitch_name'], inst_stat['userid'],
|
||||
nic['nic_vdev']))
|
||||
interface = virt_inspector.Interface(
|
||||
name=nic_id,
|
||||
name=nic['nic_vdev'],
|
||||
mac=None,
|
||||
fref=None,
|
||||
parameters=None)
|
||||
|
|
|
@ -310,7 +310,7 @@ class TestZVMInspector(base.BaseTestCase):
|
|||
'nic_fr_rx_err': 0,
|
||||
'nic_fr_tx_err': 0}]}
|
||||
nic, stat = list(self.inspector.inspect_vnics({'inst1': 'INST1'}))[0]
|
||||
if nic.name == 'vsw1_INST1_0600':
|
||||
if nic.name == '0600':
|
||||
self.assertEqual(99999, stat.rx_packets)
|
||||
else:
|
||||
self.assertEqual(8888888, stat.rx_bytes)
|
||||
|
|
Loading…
Reference in New Issue