nicolargo/glances — Issue #27: Plantage quand une interface réseau disparait
Author: Madko
Created: 2012-01-18 14:47:04+00:00
State: open

Cas typique avec la virtualisation, une VM tourne, utilisant une interface (par ex ici vnet0). On lance glances, là VM s'arrête, supprimant son interface réseau, hop plantage:

glances:628:displayNetwork:KeyError: 'vnet0'

Traceback (most recent call last):
File "/usr/bin/glances", line 839, in
main()
File "/usr/bin/glances", line 823, in main
screen.update(stats)
File "/usr/bin/glances", line 495, in update
self.display(stats)
File "/usr/bin/glances", line 479, in display
network_count = screen.displayNetwork(stats.getNetwork(), stats.getNetworkInterface())
File "/usr/bin/glances", line 628, in displayNetwork
self.term_window.addnstr(self.network_y+1+i, self.network_x+10, self.__autoUnit(network[i]['rx']/elapsed_time*8) + "b", 8, self.__getColor(network[i]['rx']/elapsed_time*8, speed[network[i]['interface_name']]))
KeyError: 'vnet0'

Local variables in innermost frame:
screen_y: 72
screen_x: 237
network: [{'tx': 140040L, 'rx': 140040L, 'systime': 1, 'ipackets': 136L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 136L, 'ierrors': 0L, 'interface_name': 'lo'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'wlan0'}, {'tx': 5240L, 'rx': 153904L, 'systime': 1, 'ipackets': 209L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 71L, 'ierrors': 0L, 'interface_name': 'eth0'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr1'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr1-nic'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr2'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr2-nic'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr0'}, {'tx': 0L, 'rx': 0L, 'systime': 1, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 0L, 'ierrors': 0L, 'interface_name': 'virbr0-nic'}, {'tx': 13660L, 'rx': 0L, 'systime': 1326897535, 'ipackets': 0L, 'oerrors': 0L, 'collisions': 0L, 'opackets': 257L, 'ierrors': 0L, 'interface_name': 'vnet0'}]
i: 9
self: <__main__.glancesScreen instance at 0x262b998>
networkinterface: [{'duplex': 2, 'interface_name': 'lo', 'speed': 0, 'up': 1}, {'duplex': 2, 'interface_name': 'wlan0', 'speed': 0, 'up': 0}, {'duplex': 0, 'interface_name': 'eth0', 'speed': 1000, 'up': 1}, {'duplex': 2, 'interface_name': 'virbr1', 'speed': 0, 'up': 1}, {'duplex': 0, 'interface_name': 'virbr1-nic', 'speed': 10, 'up': 0}, {'duplex': 2, 'interface_name': 'virbr2', 'speed': 0, 'up': 1}, {'duplex': 0, 'interface_name': 'virbr2-nic', 'speed': 10, 'up': 0}, {'duplex': 2, 'interface_name': 'virbr0', 'speed': 0, 'up': 1}, {'duplex': 0, 'interface_name': 'virbr0-nic', 'speed': 10, 'up': 0}]
elapsed_time: 1326897535
speed: {'lo': 0, 'virbr0-nic': 10000000, 'wlan0': 0, 'virbr1-nic': 10000000, 'virbr0': 0, 'virbr2-nic': 10000000, 'virbr2': 0, 'virbr1': 0, 'eth0': 1000000000}

Peut être sécuriser l'accès aux données du tableau network. Pas urgent comme bug non plus. Le problème arrive avec la version 1.3.4 en tout cas, j'ai pas testé avec la version 1.3.5.

--
[edouard@oberon ~]$ python -V
Python 2.7.2
[edouard@oberon ~]$ rpm -q libstatgrab
libstatgrab-0.17-1.fc16.x86_64
[edouard@oberon ~]$ rpm -q pystatgrab
pystatgrab-0.5-8.fc15.x86_64
[edouard@oberon ~]$ rpm -q glances
glances-1.3.4-1.fc16.noarch
--

Cordialement.