netutils: use correct syntax of iproute2 when getting ip address (#26)
netutils: use correct syntax of iproute2 when getting ip address (#26)

Before this patch there was a bug when the interface name was actually "dev":

2016-10-11 19:45:05,025: ganeti-noded pid=15175 INFO RunCmd /sbin/ip -o addr show dev
2016-10-11 19:45:05,027: ganeti-noded pid=15175 ERROR Error running the ip command while getting the IP addresses of dev
2016-10-11 19:45:05,027: ganeti-noded pid=15175 ERROR Error in RPC call
Traceback (most recent call last):
  File "/usr/share/ganeti/2.12/ganeti/server/noded.py", line 191, in HandleRequest
    result = (True, method(serializer.LoadJson(req.request_body)))
  File "/usr/share/ganeti/2.12/ganeti/server/noded.py", line 627, in perspective_instance_start
    return backend.StartInstance(instance, startup_paused, trail)
  File "/usr/share/ganeti/2.12/ganeti/backend.py", line 1892, in StartInstance
    hyper.StartInstance(instance, block_devices, startup_paused)
  File "/usr/share/ganeti/2.12/ganeti/hypervisor/hv_kvm/__init__.py", line 1775, in StartInstance
    startup_paused, kvmhelp)
  File "/usr/share/ganeti/2.12/ganeti/hypervisor/hv_kvm/__init__.py", line 1269, in _GenerateKVMRuntime
    elif (addresses[constants.IP4_VERSION] and
TypeError: 'NoneType' object has no attribute '__getitem__'

The previous code only worked, because iproute2 is liberate in what it
excepts. However the correct syntax is:
ip address { show | save | flush } [ dev IFNAME ]

This patch fixes the bug by using the correct syntax.

Signed-off-by: Arnd Hannemann <f2c659f01951776204a6c5b902787d9019fbeebd@arndnet.de>
Reviewed-by: Federico Morg Pareschi <ff862f58af48d157b995cd83870fbfa4aec8edf3@google.com>
ganeti/ganeti,ganeti/ganeti,ganeti/ganeti,mbakke/ganeti,mbakke/ganeti,mbakke/ganeti