Provide zone args for acloud create to help TF host allocating resources.

Bug: 160548800
Test: acloud-dev create_cf --zone us-central1-c --branch aosp-master \
--build-target aosp_cf_x86_phone-userdebug
acloud-py3-dev create --zone us-central1-b

Change-Id: I3d50f4356c8b08107c34174e6fc77a30521b56a5
diff --git a/create/create_args.py b/create/create_args.py
index 1903e24..31ecdc5 100644
--- a/create/create_args.py
+++ b/create/create_args.py
@@ -214,7 +214,7 @@
         help="GPU accelerator to use if any. e.g. nvidia-tesla-k80. For local "
              "instances, this arg without assigning any value is to enable "
              "local gpu support.")
-    # Hide this arg for users, it is only used in infra.
+    # Hide following args for users, it is only used in infra.
     parser.add_argument(
         "--num-avds-per-instance",
         type=int,
@@ -222,6 +222,12 @@
         required=False,
         default=1,
         help=argparse.SUPPRESS)
+    parser.add_argument(
+        "--zone",
+        type=str,
+        dest="zone",
+        required=False,
+        help=argparse.SUPPRESS)
 
     # TODO(b/118439885): Old arg formats to support transition, delete when
     # transistion is done.
diff --git a/public/config.py b/public/config.py
index f612a0a..dcb856c 100755
--- a/public/config.py
+++ b/public/config.py
@@ -247,6 +247,7 @@
         # Verify validity of configurations.
         self.Verify()
 
+    # pylint: disable=too-many-branches
     def OverrideWithArgs(self, parsed_args):
         """Override configuration values with args passed in from cmd line.
 
@@ -275,6 +276,9 @@
                 self.network = parsed_args.network
             if parsed_args.multi_stage_launch is not None:
                 self.enable_multi_stage = parsed_args.multi_stage_launch
+        if parsed_args.which in [create_args.CMD_CREATE, "create_cf", "create_gf"]:
+            if parsed_args.zone:
+                self.zone = parsed_args.zone
         if (parsed_args.which == "create_cf" and
                 parsed_args.num_avds_per_instance > 1):
             scrubbed_args = [arg for arg in self.launch_args.split()
diff --git a/public/config_test.py b/public/config_test.py
index 510fb13..88f2899 100644
--- a/public/config_test.py
+++ b/public/config_test.py
@@ -288,6 +288,15 @@
         cfg.OverrideWithArgs(args)
         self.assertEqual(cfg.hw_property, "")
 
+        # test override zone.
+        cfg.zone = "us-central1-f"
+        args = mock.MagicMock()
+        args.which = "create"
+        args.flavor = "phone"
+        args.zone = "us-central1-b"
+        cfg.OverrideWithArgs(args)
+        self.assertEqual(cfg.zone, "us-central1-b")
+
 
 if __name__ == "__main__":
     unittest.main()