diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-08 00:24:42 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-12-08 00:24:42 +0000 |
commit | ac8fd8b4d22456e138bbb5f25bff73a6705c35dc (patch) | |
tree | e1a51f52ec9b2ca2463f0f9b047a6fee18397987 | |
parent | bb8f7c3cb5c83bfecce51f07768b3c95fb31bcde (diff) | |
parent | bb056b09028eec422378bb2d7807e1436acd0cd6 (diff) | |
download | acloud-android14-qpr2-s3-release.tar.gz |
Snap for 11192287 from bb056b09028eec422378bb2d7807e1436acd0cd6 to 24Q1-releaseandroid-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Change-Id: Ifd71cca866e699caa494a6e4d72fd39b0021d8e9
-rw-r--r-- | internal/lib/goldfish_compute_client.py | 8 | ||||
-rw-r--r-- | internal/lib/goldfish_compute_client_test.py | 6 | ||||
-rw-r--r-- | public/acloud_main.py | 3 | ||||
-rw-r--r-- | public/actions/create_goldfish_action.py | 27 | ||||
-rw-r--r-- | public/actions/create_goldfish_action_test.py | 19 |
5 files changed, 44 insertions, 19 deletions
diff --git a/internal/lib/goldfish_compute_client.py b/internal/lib/goldfish_compute_client.py index 9ae7922b..c251912d 100644 --- a/internal/lib/goldfish_compute_client.py +++ b/internal/lib/goldfish_compute_client.py @@ -165,7 +165,8 @@ class GoldfishComputeClient(android_compute_client.AndroidComputeClient): avd_spec=None, extra_scopes=None, tags=None, - launch_args=None): + launch_args=None, + disable_external_ip=False): """Create a goldfish instance given a stable host image and a build id. Args: @@ -190,6 +191,8 @@ class GoldfishComputeClient(android_compute_client.AndroidComputeClient): tags: A list of tags to associate with the instance. e.g. ["http-server", "https-server"] launch_args: String of args for launch command. + disable_external_ip: Boolean, true if instance external ip should be + disabled. """ self._VerifyZoneByQuota() self._CheckMachineSize() @@ -258,4 +261,5 @@ class GoldfishComputeClient(android_compute_client.AndroidComputeClient): zone=self._zone, gpu=gpu, tags=tags, - extra_scopes=extra_scopes) + extra_scopes=extra_scopes, + disable_external_ip=disable_external_ip) diff --git a/internal/lib/goldfish_compute_client_test.py b/internal/lib/goldfish_compute_client_test.py index 02f649ad..e5b3981f 100644 --- a/internal/lib/goldfish_compute_client_test.py +++ b/internal/lib/goldfish_compute_client_test.py @@ -199,7 +199,8 @@ Jan 12 12:00:00 ins-abcdefgh-5000000-sdk-x86-64-sdk launch_emulator[123]: VIRTUA zone=self.ZONE, gpu=self.GPU, tags=self.TAGS, - extra_scopes=self.EXTRA_SCOPES) + extra_scopes=self.EXTRA_SCOPES, + disable_external_ip=False) @mock.patch("getpass.getuser", return_value="fake_user") def testCreateInstanceWithAvdSpec(self, _mock_user): @@ -270,7 +271,8 @@ Jan 12 12:00:00 ins-abcdefgh-5000000-sdk-x86-64-sdk launch_emulator[123]: VIRTUA zone=self.ZONE, gpu=self.GPU, tags=self.TAGS, - extra_scopes=self.EXTRA_SCOPES) + extra_scopes=self.EXTRA_SCOPES, + disable_external_ip=False) if __name__ == "__main__": diff --git a/public/acloud_main.py b/public/acloud_main.py index d3d85af9..308ee215 100644 --- a/public/acloud_main.py +++ b/public/acloud_main.py @@ -435,7 +435,8 @@ def main(argv=None): autoconnect=args.autoconnect, tags=args.tags, report_internal_ip=args.report_internal_ip, - boot_timeout_secs=args.boot_timeout_secs) + boot_timeout_secs=args.boot_timeout_secs, + disable_external_ip=args.disable_external_ip) elif args.which == delete_args.CMD_DELETE: reporter = delete.Run(args) elif args.which == list_args.CMD_LIST: diff --git a/public/actions/create_goldfish_action.py b/public/actions/create_goldfish_action.py index d4617433..aae9b8bb 100644 --- a/public/actions/create_goldfish_action.py +++ b/public/actions/create_goldfish_action.py @@ -59,6 +59,7 @@ class GoldfishDeviceFactory(base_device_factory.BaseDeviceFactory): "/home/vsoc-01/log/adb.log", "/var/log/daemon.log"] + #pylint: disable=too-many-locals def __init__(self, cfg, build_target, @@ -72,7 +73,8 @@ class GoldfishDeviceFactory(base_device_factory.BaseDeviceFactory): avd_spec=None, tags=None, branch=None, - emulator_branch=None): + emulator_branch=None, + disable_external_ip=False): """Initialize. @@ -88,6 +90,8 @@ class GoldfishDeviceFactory(base_device_factory.BaseDeviceFactory): ["http-server", "https-server"] branch: String, branch of the emulator build target. emulator_branch: String, branch of the emulator. + disable_external_ip: Boolean, true if instance external ip should be + disabled. """ self.credentials = auth.CreateCredentials(cfg) @@ -103,6 +107,7 @@ class GoldfishDeviceFactory(base_device_factory.BaseDeviceFactory): self._blank_data_disk_size_gb = cfg.extra_data_disk_size_gb self._extra_scopes = cfg.extra_scopes self._tags = tags + self._disable_external_ip = disable_external_ip # Configure clients self._build_client = android_build_client.AndroidBuildClient( @@ -168,7 +173,8 @@ class GoldfishDeviceFactory(base_device_factory.BaseDeviceFactory): avd_spec=self._avd_spec, tags=self._tags, extra_scopes=self._extra_scopes, - launch_args=self._cfg.launch_args) + launch_args=self._cfg.launch_args, + disable_external_ip=self._disable_external_ip) return instance @@ -246,7 +252,8 @@ def CreateDevices(avd_spec=None, branch=None, tags=None, report_internal_ip=False, - boot_timeout_secs=None): + boot_timeout_secs=None, + disable_external_ip=False): """Create one or multiple Goldfish devices. Args: @@ -274,6 +281,8 @@ def CreateDevices(avd_spec=None, external ip. boot_timeout_secs: Integer, the maximum time in seconds used to wait for the AVD to boot. + disable_external_ip: Boolean, true if instance external ip should be + disabled. Returns: A Report instance. @@ -293,6 +302,7 @@ def CreateDevices(avd_spec=None, report_internal_ip = avd_spec.report_internal_ip client_adb_port = avd_spec.client_adb_port boot_timeout_secs = avd_spec.boot_timeout_secs + disable_external_ip = avd_spec.disable_external_ip if not emulator_build_target: emulator_build_target = cfg.emulator_build_target @@ -329,10 +339,10 @@ def CreateDevices(avd_spec=None, "Creating a goldfish device in project %s, build_target: %s, " "build_id: %s, emulator_bid: %s, emulator_branch: %s, kernel_build_id: %s, " "kernel_branch: %s, kernel_build_target: %s, GPU: %s, num: %s, " - "serial_log_file: %s, " - "autoconnect: %s", cfg.project, build_target, build_id, - emulator_build_id, emulator_branch, kernel_build_id, kernel_branch, - kernel_build_target, gpu, num, serial_log_file, autoconnect) + "serial_log_file: %s, autoconnect: %s, disable_external_ip: %s", + cfg.project, build_target, build_id, emulator_build_id, + emulator_branch, kernel_build_id, kernel_branch, kernel_build_target, + gpu, num, serial_log_file, autoconnect, disable_external_ip) device_factory = GoldfishDeviceFactory( cfg, build_target, build_id, @@ -343,7 +353,8 @@ def CreateDevices(avd_spec=None, emulator_branch=emulator_branch, kernel_build_id=kernel_build_id, kernel_branch=kernel_branch, - kernel_build_target=kernel_build_target) + kernel_build_target=kernel_build_target, + disable_external_ip=disable_external_ip) return common_operations.CreateDevices("create_gf", cfg, device_factory, num, constants.TYPE_GF, diff --git a/public/actions/create_goldfish_action_test.py b/public/actions/create_goldfish_action_test.py index b784be44..b5d7b51c 100644 --- a/public/actions/create_goldfish_action_test.py +++ b/public/actions/create_goldfish_action_test.py @@ -82,6 +82,7 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): self.avd_spec.gpu = self.GPU self.avd_spec.serial_log_file = None self.avd_spec.autoconnect = False + self.avd_spec.disable_external_ip = False def _CreateCfg(self): """A helper method that creates a mock configuration object.""" @@ -153,7 +154,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=none_avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) self.assertEqual(report.data, { "devices": [ @@ -211,7 +213,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=self.avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) def testCreateDevicesWithoutBuildId(self): """Test CreateDevices when emulator sysimage buildid is not provided.""" @@ -277,7 +280,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=none_avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) self.assertEqual(report.data, { "devices": [{ @@ -333,7 +337,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=self.avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) #pylint: disable=invalid-name def testCreateDevicesWithoutEmulatorBuildId(self): @@ -392,7 +397,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=none_avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) self.assertEqual(report.data, { "devices": [{ @@ -448,7 +454,8 @@ class CreateGoldfishActionTest(driver_test_lib.BaseDriverTest): avd_spec=self.avd_spec, extra_scopes=self.EXTRA_SCOPES, tags=None, - launch_args=self.LAUNCH_ARGS) + launch_args=self.LAUNCH_ARGS, + disable_external_ip=False) if __name__ == "__main__": |