Skip to content

Commit

Permalink
Unique VirtioFS Tags (#76)
Browse files Browse the repository at this point in the history
* Unique VirtioFS Tags

As reported in [this comment](#73 (comment)) it seems host VirtioFS server is getting confused when the same tag is used in two VMs simultaneously. Let's make them unique.

* fixed lint
  • Loading branch information
fkorotkov authored May 29, 2024
1 parent 4d29d8d commit 1f5b77e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/commands/prepare/prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func runPrepareVM(cmd *cobra.Command, args []string) error {

mountPoint := fmt.Sprintf("/Users/%s/%s", config.SSHUsername, dirToMount)
mkdirScript := fmt.Sprintf("mkdir -p %s", mountPoint)
mountScript := fmt.Sprintf("mount_virtiofs tart.virtiofs.%s %s", dirToMount, mountPoint)
mountScript := fmt.Sprintf("mount_virtiofs tart.virtiofs.%s.%s %s", dirToMount, gitLabEnv.JobID, mountPoint)
session.Stdin = bytes.NewBufferString(strings.Join([]string{mkdirScript, mountScript, ""}, "\n"))
session.Stdout = os.Stdout
session.Stderr = os.Stderr
Expand Down
7 changes: 4 additions & 3 deletions internal/tart/vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,14 @@ func (vm *VM) Start(
}

if config.HostDir {
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.hostdir", gitLabEnv.HostDirPath()))
hostDir := gitLabEnv.HostDirPath()
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.hostdir.%s", hostDir, gitLabEnv.JobID))
} else if buildsDir, ok := os.LookupEnv(EnvTartExecutorInternalBuildsDir); ok {
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.buildsdir", buildsDir))
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.buildsdir.%s", buildsDir, gitLabEnv.JobID))
}

if cacheDir, ok := os.LookupEnv(EnvTartExecutorInternalCacheDir); ok {
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.cachedir", cacheDir))
runArgs = append(runArgs, "--dir", fmt.Sprintf("%s:tag=tart.virtiofs.cachedir.%s", cacheDir, gitLabEnv.JobID))
}

runArgs = append(runArgs, vm.id)
Expand Down

0 comments on commit 1f5b77e

Please sign in to comment.