Skip to content

Commit

Permalink
Merge pull request #47 from akhiljns/pathnamefix
Browse files Browse the repository at this point in the history
fixing for mac and linux as well
  • Loading branch information
mhewedy authored Mar 20, 2024
2 parents 7655942 + aa5ffd5 commit 9baab15
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.idea
*.iml
.vscode/
vermin.exe
vermin.exe
vermin
23 changes: 6 additions & 17 deletions hypervisor/virtualbox/virtualbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,14 @@ func (*virtualbox) Commit(vmName, imageName string) error {
}

func (*virtualbox) Create(imageName, vmName string, cpus int, mem int) error {

imagePath := db.GetImageFilePath(imageName)

importArgs := []string{
"import",
imagePath,
importCmd := vboxManage(
"import", `"`+db.GetImageFilePath(imageName)+`"`,
"--vsys", "0",
"--vmname", vmName,
"--basefolder", db.VMsBaseDir,
"--cpus", strconv.Itoa(cpus),
"--memory", strconv.Itoa(mem),
}

for i, arg := range importArgs {
importArgs[i] = `"` + arg + `"`
}

importCmd := vboxManage(importArgs...)

"--basefolder", `"`+db.VMsBaseDir+`"`,
"--cpus", fmt.Sprintf("%d", cpus),
"--memory", fmt.Sprintf("%d", mem),
)
if _, err := importCmd.CallWithProgress(fmt.Sprintf("Creating %s from image %s", vmName, imageName)); err != nil {
return err
}
Expand Down

0 comments on commit 9baab15

Please sign in to comment.