Browse Source

fix: stat made qcow2 image creation return error every time

tags/v0.5
Vladimir Serov 10 months ago
parent
commit
d9c651987b
1 changed files with 2 additions and 6 deletions
  1. 2
    6
      appvm.go

+ 2
- 6
appvm.go View File

@@ -163,12 +163,8 @@ func generateVM(path, name string, verbose bool) (realpath, reginfo, qcow2 strin
syscall.Unlink("result")

qcow2 = os.Getenv("HOME") + "/appvm/.fake.qcow2"
if _, err = os.Stat(qcow2); os.IsNotExist(err) {
system.System("qemu-img", "create", "-f", "qcow2", qcow2, "512M")
err = os.Chmod(qcow2, 0400) // qemu run with -snapshot, we only need it for create /dev/vda
if err != nil {
return
}
if _, e := os.Stat(qcow2); os.IsNotExist(e) {
system.System("qemu-img", "create", "-f", "qcow2", qcow2, "40M")
}

return

Loading…
Cancel
Save