autotest/virt-test — pull request #1443 by jferlan (2014-02-14 20:57:09+00:00)
Title: wait_for_get_address: Handle dead vm

Pull request #1424 added logic to wait_for_get_address() in order to
try and renew the guest IP by using the serial console. However, it did
not take into account that the guest may not be running in this instance
and that failing and/or raising an exception may be an expected output.

As it turns out the virsh.attach_device test has such a need as part of
its processing - it expects/tests certain exceptions.

Without this change, the wait_for_get_address() eventually calls the
serial_login() function which fails (exception) when trying to determine
if the path to 'self.serial_console.inpipe_filename' exists. Trying
to change that code to call create_serial_console() will fail because
the VM is dead. So rather than go through that processing, just fail.

This issue was exacerbated by verify_ip_address_ownership() not returning
True from the mac in macs checking on the return from parse_arp(). Since
the IP address wasn't matched a failure would result, which led to going
into the new code. Exactly what caused that I'm not quite sure as it
was only reproducible for a short period of time and now it does find
the address. When the code does return True, the remote.remote_login()
call in the login() code will eventually fail since the guest is not
up with a LoginError exception, which is caught/handled by attach_device.

Hopefully @humanux can review and comment on this. I am open to other
suggestions, but this just seemed to be the easiest way.