zenoss / ZenPacks.community.OpenSolaris

ZenPacks.community.OpenSolaris ZenPack
GNU General Public License v2.0
1 stars 2 forks source link

Model failure for aggregated network interfaces #1

Open jflemer-ndp opened 9 years ago

jflemer-ndp commented 9 years ago

When a host has an aggregated interface configure, the ifconfig modeler fails (throws an exception):

2014-12-30 15:40:35,460 ERROR zen.ZenModeler: Traceback (most recent call last):
File "/opt/zenoss/Products/DataCollector/zenmodeler.py", line 647, in processClient
datamaps = plugin.process(device, results, self.log)
File "/opt/zenoss/ZenPacks/ZenPacks.community.OpenSolaris-1.1-py2.7.egg/ZenPacks/community/OpenSolaris/modeler/plugins/zenoss/cmd/solaris/ifconfig.py", line 22, in process
relMap = self.parseIfconfig(ifconfig, arp, dladm, self.relMap())
File "/opt/zenoss/ZenPacks/ZenPacks.community.OpenSolaris-1.1-py2.7.egg/ZenPacks/community/OpenSolaris/modeler/plugins/zenoss/cmd/solaris/ifconfig.py", line 114, in parseIfconfig
iface.speed=dladmdict[ iface.interfaceName][0]
KeyError: 'aggr1' 

For reference, here is the raw command output from the command in the ifconfig.py:

lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000
igb0: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 2
        inet 10.42.10.101 netmask ffffff00 broadcast 10.42.10.255
igb1: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 1500 index 3
        inet 10.42.10.102 netmask ffffff00 broadcast 10.42.10.255
aggr1: flags=1004843<UP,BROADCAST,RUNNING,MULTICAST,DHCP,IPv4> mtu 9000 index 33
        inet 10.42.11.101 netmask ffffff00 broadcast 10.42.11.255
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
        inet6 ::1/128
__COMMAND__
LINK            PTYPE    STATE    AUTO  SPEED-DUPLEX                    PAUSE
igb0            current  up       yes   1G-f                            bi
igb1            current  up       yes   1G-f                            bi
ixgbe0          current  up       yes   10G-f                           bi
ixgbe1          current  up       yes   10G-f                           bi
__COMMAND__
Net to Media Table: IPv4
Device   IP Address               Mask      Flags      Phys Addr
------ -------------------- --------------- -------- ---------------
igb0   10.42.10.1          255.255.255.255          xx:xx:xx:xx:xx:xx
aggr1  10.42.11.101        255.255.255.255 SPLA     xx:xx:xx:xx:xx:xx
igb1   10.42.10.102        255.255.255.255 SPLA     xx:xx:xx:xx:xx:xx
igb0   10.42.10.101        255.255.255.255 SPLA     xx:xx:xx:xx:xx:xx

And of interest, here is the output of /usr/sbin/dladm show-aggr -L:

LINK        PORT         AGGREGATABLE SYNC COLL DIST DEFAULTED EXPIRED
aggr1       ixgbe0       yes          yes  yes  yes  no        no
--          ixgbe1       yes          yes  yes  yes  no        no
jflemer-ndp commented 9 years ago

A simple fix could be to just try / except around lines 114 and 115 (i.e. do not set speed and duplex for aggregated interfaces). More involved would be to also grab the output from dladm show-aggr -L, to get the first physical interface in the aggregation, and use that to find the speed and duplex.