servo: Use servod port number to avoid scp collisions.

The approach of using random filenames results in leftover files if
tests don't clean up the files afterwards.  By using the servo port
number, we can avoid colllisions while keeping the names consistent,
thus conserving disk space.

BUG=chromium:1037626
BUG=chromium:1034037
TEST=Run provision_FirmwareUpdate on an octopus device

Change-Id: Iaabe5f34a18401c44ca1945f4d60ef76275ba46a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1983636
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Commit-Queue: Dana Goyette <dgoyette@chromium.org>
Tested-by: Dana Goyette <dgoyette@chromium.org>
diff --git a/server/cros/servo/servo.py b/server/cros/servo/servo.py
index bc7b4d4..ce9e605 100644
--- a/server/cros/servo/servo.py
+++ b/server/cros/servo/servo.py
@@ -8,10 +8,8 @@
 import ast
 import logging
 import os
-import random
 import re
 import socket
-import string
 import time
 import xmlrpclib
 
@@ -977,17 +975,15 @@
         When programming a firmware image on the DUT, the image must be
         located on the host to which the servo device is connected. Sometimes
         servo is controlled by a remote host, in this case the image needs to
-        be transferred to the remote host. This adds a random extension to
-        prevent multiple tests from copying a image to the same location on
-        the remote host.
+        be transferred to the remote host. This adds the servod port number, to
+        make sure tests for different DUTs don't trample on each other's files.
 
         @param image_path: a string, name of the firmware image file to be
                transferred.
         @return: a string, full path name of the copied file on the remote.
         """
         name = os.path.basename(image_path)
-        ext = ''.join([random.choice(string.ascii_letters) for i in xrange(10)])
-        remote_name = name + '.' + ext
+        remote_name = 'dut_%s.%s' % (self._servo_host.servo_port, name)
         dest_path = os.path.join('/tmp', remote_name)
         logging.info('Copying %s to %s', name, dest_path)
         self._servo_host.send_file(image_path, dest_path)