aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2016-11-25 17:11:56 +0100
committerDmitry Vyukov <dvyukov@google.com>2016-11-25 17:11:56 +0100
commit9d672cd451330195801dfd01395e9d4818037f5d (patch)
treebf600209c4ea86c7a330a884cf0774c179b87c8e /config
parent9604794dce636f25332e4efcdbd6ac9195d94f9b (diff)
config: use dense indices for VMs
CreateVMConfig uses fileutil.ProcessTempDir to assign indices to VMs. fileutil.ProcessTempDir generates unique indices globally across several processes. This was required for old vm/qemu code that used the index to choose unique ssh port for the VM. Now vm/qemu does not use index as port and this global index assignment started causing problems for adb and gce. Adb really needs indexes to be dense -- index is used to choose adb device id (if we have 2 devices, index 3 causes out of bounds panic). For gce it leads to creation of unnecessary VM instances (if I set count=4, I want at most 4 VMs created). Don't use fileutil.ProcessTempDir-generated index in CreateVMConfig and instead just use the dense indices passed by caller.
Diffstat (limited to 'config')
-rw-r--r--config/config.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/config/config.go b/config/config.go
index 9a8562912..103238f0a 100644
--- a/config/config.go
+++ b/config/config.go
@@ -250,7 +250,7 @@ func CreateVMConfig(cfg *Config, index int) (*vm.Config, error) {
if index < 0 || index >= cfg.Count {
return nil, fmt.Errorf("invalid VM index %v (count %v)", index, cfg.Count)
}
- workdir, index, err := fileutil.ProcessTempDir(cfg.Workdir)
+ workdir, err := fileutil.ProcessTempDir(cfg.Workdir)
if err != nil {
return nil, fmt.Errorf("failed to create instance temp dir: %v", err)
}