Support instance directory outside of acloud temporary directory
This commit adds --local-instance-dir that links the instance directory
to the specified directory. When acloud deletes and restarts the
instance, it preserves the directory. The infrastructure can safely
collect the log files in it.
Test: acloud-dev create --local-instance --local-image \
--local-instance-dir ./temp
Bug: 160942364
Change-Id: I4097cdd4ff924df539ed2c1073663a1240472a57
diff --git a/create/create_args.py b/create/create_args.py
index 4258334..f54c1a2 100644
--- a/create/create_args.py
+++ b/create/create_args.py
@@ -216,6 +216,11 @@
"local gpu support.")
# Hide following args for users, it is only used in infra.
parser.add_argument(
+ "--local-instance-dir",
+ dest="local_instance_dir",
+ required=False,
+ help=argparse.SUPPRESS)
+ parser.add_argument(
"--num-avds-per-instance",
type=int,
dest="num_avds_per_instance",
@@ -510,6 +515,10 @@
raise errors.CheckPathError(
"Specified path doesn't exist: %s" % args.local_image)
+ if args.local_instance_dir and not os.path.exists(args.local_instance_dir):
+ raise errors.CheckPathError(
+ "Specified path doesn't exist: %s" % args.local_instance_dir)
+
# TODO(b/133211308): Support TYPE_CF.
if args.local_system_image != "" and args.avd_type != constants.TYPE_GF:
raise errors.UnsupportedCreateArgs("%s instance does not support "