saltstack/salt — pull request #939 by teancom (2012-03-17 18:29:12+00:00)
Title: Add get_nics() and get_macs() to virt.py

Example output from get_macs() on a machine with one interface, then two:

[ david@brampton100 ] $ sudo salt-call virt.get_macs testing123
{'local': [u'00:16:36:e7:2f:e9']}
[ david@brampton100 ] $ sudo salt-call virt.get_macs new_test
{'local': [u'00:16:36:9d:d9:30', u'52:54:00:ab:cd:ef']}

Example output from get_nics() on a machine with one interface, then two:

[ david@brampton100 ] $ sudo salt-call virt.get_nics testing123
{'local': {u'00:16:36:e7:2f:e9': {'address': {u'bus': u'0x00',
u'domain': u'0x0000',
u'function': u'0x0',
u'slot': u'0x03',
u'type': u'pci'},
'mac': u'00:16:36:e7:2f:e9',
'model': u'virtio',
'source': {u'bridge': u'br104'},
'type': u'bridge'}}}

[ david@brampton100 ] $ sudo salt-call virt.get_nics new_test
{'local': {u'00:16:36:9d:d9:30': {'address': {u'bus': u'0x00',
u'domain': u'0x0000',
u'function': u'0x0',
u'slot': u'0x03',
u'type': u'pci'},
'mac': u'00:16:36:9d:d9:30',
'model': u'virtio',
'source': {u'bridge': u'br104'},
'type': u'bridge'},
u'52:54:00:ab:cd:ef': {'address': {u'bus': u'0x00',
u'domain': u'0x0000',
u'function': u'0x0',
u'slot': u'0x06',
u'type': u'pci'},
'mac': u'52:54:00:ab:cd:ef',
'model': u'virtio',
'source': {u'bridge': u'br104'},
'type': u'bridge'}}}