autotest: dns_server: Send more specific exception error

If the backup file goes missing, this might be due to the shill
process restarting while the test runs.  We should raise an
exception that represents the true reason for the test failure.

BUG=chromium-os:35984
TEST=Run desktopui_DocViewing test; remove resolv.conf.bak while
test is running.  Note that the crash error message mentions
this specific condition.

Change-Id: I075e8decb419cbff0b8c3ba9a8d590dd9c26cced
Reviewed-on: https://gerrit.chromium.org/gerrit/37545
Reviewed-by: Chris Masone <cmasone@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/client/cros/dns_server.py b/client/cros/dns_server.py
index b31f9e5..57571cb 100644
--- a/client/cros/dns_server.py
+++ b/client/cros/dns_server.py
@@ -5,6 +5,7 @@
 import common, constants, logging, os, socket, stat, sys, threading, time
 
 from autotest_lib.client.bin import utils
+from autotest_lib.client.common_lib import error
 
 class LocalDns(object):
     """A wrapper around miniFakeDns that runs the server in a separate thread
@@ -101,7 +102,15 @@
             resolv_dir = os.path.dirname(resolv)
             resolv_bak = os.path.join(resolv_dir, self._resolv_bak_file)
             os.chmod(resolv_dir, self._resolv_dir_mode)
-            os.rename(resolv_bak, resolv)
+            if os.path.exists(resolv_bak):
+                os.rename(resolv_bak, resolv)
+            else:
+                # This probably means shill restarted during the execution
+                # of our test, and has cleaned up the .bak file we created.
+                raise error.TestError('Backup file %s no longer exists!  '
+                                      'Connection manager probably crashed '
+                                      'during the test run.' %
+                                      resolv_bak)
 
             utils.poll_for_condition(
                 lambda: self.__attempt_resolve('www.google.com.',