network_WiFi_UpdateRouter: stop running recover_duts on test routers

BUG=chromium:836633, b:177380545
TEST=schedule network_WiFi_UpdateRouter on a lab device;
     `status recover_duts`

Change-Id: I9f66c348afe247ec40216e898a02e38199337471
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/2693288
Reviewed-by: Harpreet Grewal <harpreet@chromium.org>
Reviewed-by: Will Donnelly <wgd@google.com>
Commit-Queue: Brian Norris <briannorris@chromium.org>
Tested-by: Brian Norris <briannorris@chromium.org>
diff --git a/server/cros/provisioner.py b/server/cros/provisioner.py
index 47bb134..b03b8e7 100644
--- a/server/cros/provisioner.py
+++ b/server/cros/provisioner.py
@@ -44,7 +44,7 @@
 # parts of the system in Chromium OS test images will behave in ways
 # convenient to the test lab when this file is present.  Generally,
 # we create this immediately after any update completes.
-_LAB_MACHINE_FILE = '/mnt/stateful_partition/.labmachine'
+LAB_MACHINE_FILE = '/mnt/stateful_partition/.labmachine'
 
 # _TARGET_VERSION - A file containing the new version to which we plan
 # to update.  This file is used by the CrOS shutdown code to detect and
@@ -468,10 +468,10 @@
         # Touch the lab machine file to leave a marker that
         # distinguishes this image from other test images.
         # Afterwards, we must re-run the autoreboot script because
-        # it depends on the _LAB_MACHINE_FILE.
+        # it depends on the LAB_MACHINE_FILE.
         autoreboot_cmd = ('FILE="%s" ; [ -f "$FILE" ] || '
                           '( touch "$FILE" ; start autoreboot )')
-        self._run(autoreboot_cmd % _LAB_MACHINE_FILE)
+        self._run(autoreboot_cmd % LAB_MACHINE_FILE)
         try:
             kernel_utils.verify_boot_expectations(
                     expected_kernel, NewBuildUpdateError.ROLLBACK_FAILURE,
diff --git a/server/site_tests/network_WiFi_UpdateRouter/network_WiFi_UpdateRouter.py b/server/site_tests/network_WiFi_UpdateRouter/network_WiFi_UpdateRouter.py
index e592e39..498170a 100644
--- a/server/site_tests/network_WiFi_UpdateRouter/network_WiFi_UpdateRouter.py
+++ b/server/site_tests/network_WiFi_UpdateRouter/network_WiFi_UpdateRouter.py
@@ -89,6 +89,18 @@
         for path in self.FILES_TO_REMOVE:
             device_host.run('rm -rf %s' % path, ignore_status=True)
 
+    def stop_recover_duts(self, device_host):
+        """Stop running recover_duts on the host.
+
+        b/177380545: recover_duts is currently providing negative value on
+        routers. TBD: decided whether we should re-enable this when router
+        images are updated to fix hang issues?
+
+        @param device_host: router / pcap host object
+        """
+        device_host.run('rm -f %s' % provisioner.LAB_MACHINE_FILE,
+                        ignore_status=True)
+        device_host.run('stop recover_duts', ignore_status=True)
 
     def run_once(self, host, is_pcap=False):
         """Update router / packet capture associated with host.
@@ -119,10 +131,17 @@
         device_host = hosts.create_host(device_hostname,
                                         host_class=hosts.CrosHost,
                                         allow_failure=True)
+
+        # Stop recover_duts now, for cases where we don't go through a full
+        # update below.
+        self.stop_recover_duts(device_host)
+
         # Remove un-wanted files to freeup diskspace before starting update.
         self.freeup_disk_space(device_host)
         self.update_device(device_host)
 
+        # Stop recover_duts again, in case provisioning re-enabled it.
+        self.stop_recover_duts(device_host)
 
     def update_device(self, device_host):
         """Update router and pcap associated with host.