Change the format of remote host goldfish instance names
The prefix "host-<ip_addr>-goldfish" is changed to
"host-goldfish-<ip_addr>". The new format can be distinguished from
the cuttlefish prefix "host-<ip_addr>".
Test: acloud-dev delete -vv --instance-names \
host-goldfish-192.168.9.3-5554-7476030-sdk_x86_64-sdk \
--host-user root \
--host-ssh-private-key-path ~/id_rsa \
--rpeort-file ./report.json
Bug: 198254814
Change-Id: I52de64a3a988b8a96d2f12ce9127e575ce1814db
diff --git a/delete/delete.py b/delete/delete.py
index a60f16d..47be404 100644
--- a/delete/delete.py
+++ b/delete/delete.py
@@ -306,7 +306,7 @@
This method can identify the following types of instance names:
local cuttlefish instance: local-instance-<id>
local goldfish instance: local-goldfish-instance-<id>
- remote host goldfish instance: host-<ip_addr>-goldfish-<port>-<build_info>
+ remote host goldfish instance: host-goldfish-<ip_addr>-<port>-<build_info>
remote instance: ins-<uuid>-<build_info>
Args:
diff --git a/delete/delete_test.py b/delete/delete_test.py
index 0359a33..23cb973 100644
--- a/delete/delete_test.py
+++ b/delete/delete_test.py
@@ -163,7 +163,7 @@
cfg_attrs = {"ssh_private_key_path": "cfg_key_path",
"extra_args_ssh_tunnel": "extra args"}
mock_cfg = mock.Mock(spec_set=list(cfg_attrs.keys()), **cfg_attrs)
- instance_name = "host-192.0.2.1-goldfish-5554-123456-sdk_x86_64-sdk"
+ instance_name = "host-goldfish-192.0.2.1-5554-123456-sdk_x86_64-sdk"
delete_report = report.Report(command="delete")
delete.DeleteHostGoldfishInstance(mock_cfg, instance_name,
@@ -212,7 +212,7 @@
mock_reset_lock.assert_called_with("local-instance-2", mock.ANY)
# Test delete remote host instances.
- instances = ["host-192.0.2.1-goldfish-5554-123456-sdk_x86_64-sdk"]
+ instances = ["host-goldfish-192.0.2.1-5554-123456-sdk_x86_64-sdk"]
delete.DeleteInstanceByNames(cfg, instances, "user", "key")
mock_delete_remote_host_gf.assert_called_with(
cfg, instances[0], "user", "key", mock.ANY)
diff --git a/internal/lib/goldfish_remote_host_client.py b/internal/lib/goldfish_remote_host_client.py
index dd41fb8..08e2f36 100644
--- a/internal/lib/goldfish_remote_host_client.py
+++ b/internal/lib/goldfish_remote_host_client.py
@@ -22,10 +22,10 @@
from acloud.public import config
-_INSTANCE_NAME_FORMAT = ("host-%(ip_addr)s-goldfish-%(console_port)s-"
+_INSTANCE_NAME_FORMAT = ("host-goldfish-%(ip_addr)s-%(console_port)s-"
"%(build_id)s-%(build_target)s")
_INSTANCE_NAME_PATTERN = re.compile(
- r"host-(?P<ip_addr>[\d.]+)-goldfish-(?P<console_port>\d+)-.+")
+ r"host-goldfish-(?P<ip_addr>[\d.]+)-(?P<console_port>\d+)-.+")
# Report keys
_VERSION = "version"
diff --git a/internal/lib/goldfish_remote_host_client_test.py b/internal/lib/goldfish_remote_host_client_test.py
index aec2dbc..3b3c72a 100644
--- a/internal/lib/goldfish_remote_host_client_test.py
+++ b/internal/lib/goldfish_remote_host_client_test.py
@@ -29,7 +29,7 @@
_CONSOLE_PORT = 5554
_BUILD_INFO = {"build_id": "123456",
"build_target": "sdk_phone_x86_64-userdebug"}
- _INSTANCE_NAME = ("host-192.0.2.1-goldfish-5554-"
+ _INSTANCE_NAME = ("host-goldfish-192.0.2.1-5554-"
"123456-sdk_phone_x86_64-userdebug")
_INVALID_NAME = "host-192.0.2.1-123456-aosp_cf_x86_phone-userdebug"
diff --git a/public/actions/remote_host_gf_device_factory_test.py b/public/actions/remote_host_gf_device_factory_test.py
index 1d848c1..95f3470 100644
--- a/public/actions/remote_host_gf_device_factory_test.py
+++ b/public/actions/remote_host_gf_device_factory_test.py
@@ -38,13 +38,13 @@
constants.BUILD_TARGET: "sdk_x86_64-sdk",
}
_X86_64_INSTANCE_NAME = (
- "host-192.0.2.1-goldfish-5554-123456-sdk_x86_64-sdk")
+ "host-goldfish-192.0.2.1-5554-123456-sdk_x86_64-sdk")
_ARM64_BUILD_INFO = {
constants.BUILD_ID: "123456",
constants.BUILD_TARGET: "sdk_arm64-sdk",
}
_ARM64_INSTANCE_NAME = (
- "host-192.0.2.1-goldfish-5554-123456-sdk_arm64-sdk")
+ "host-goldfish-192.0.2.1-5554-123456-sdk_arm64-sdk")
_CFG_ATTRS = {
"ssh_private_key_path": "cfg_key_path",
"extra_args_ssh_tunnel": "extra args",