fix: stat made qcow2 image creation return error every time
This commit is contained in:
parent
3483763938
commit
d9c651987b
8
appvm.go
8
appvm.go
@ -163,12 +163,8 @@ func generateVM(path, name string, verbose bool) (realpath, reginfo, qcow2 strin
|
|||||||
syscall.Unlink("result")
|
syscall.Unlink("result")
|
||||||
|
|
||||||
qcow2 = os.Getenv("HOME") + "/appvm/.fake.qcow2"
|
qcow2 = os.Getenv("HOME") + "/appvm/.fake.qcow2"
|
||||||
if _, err = os.Stat(qcow2); os.IsNotExist(err) {
|
if _, e := os.Stat(qcow2); os.IsNotExist(e) {
|
||||||
system.System("qemu-img", "create", "-f", "qcow2", qcow2, "512M")
|
system.System("qemu-img", "create", "-f", "qcow2", qcow2, "40M")
|
||||||
err = os.Chmod(qcow2, 0400) // qemu run with -snapshot, we only need it for create /dev/vda
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user