Support acloud list command.
Enable the ability to list remote instances created by the user
and disply the info of instances including avd spec and status.
Bug: 118405737
Test: acloud list && acloud list -v && acloud delete
atest acloud_test
Change-Id: I8420f69c8f8c30046eeffe95c5b5d2d184ec4738
diff --git a/internal/lib/gcompute_client.py b/internal/lib/gcompute_client.py
index cd30763..ada5306 100755
--- a/internal/lib/gcompute_client.py
+++ b/internal/lib/gcompute_client.py
@@ -1077,7 +1077,8 @@
disk_args=None,
image_project=None,
gpu=None,
- extra_disk_name=None):
+ extra_disk_name=None,
+ labels=None):
"""Create a gce instance with a gce image.
Args:
@@ -1097,6 +1098,7 @@
None no gpus will be attached. For more details see:
https://cloud.google.com/compute/docs/gpus/add-gpus
extra_disk_name: String,the name of the extra disk to attach.
+ labels: Dict, will be added to the instance's labels.
"""
disk_args = (disk_args
or self._GetDiskArgs(instance, image_name, image_project))
@@ -1113,6 +1115,8 @@
}],
}
+ if labels is not None:
+ body["labels"] = labels
if gpu:
body["guestAccelerators"] = [{
"acceleratorType": self.GetAcceleratorUrl(gpu, zone),