Move shared directory creation out of vm generating function
This commit is contained in:
parent
f1fd2e1505
commit
57e15fa0a0
13
appvm.go
13
appvm.go
@ -165,8 +165,8 @@ func isRunning(l *libvirt.Libvirt, name string) bool {
|
|||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateAppVM(l *libvirt.Libvirt, appvmPath, name string, verbose,
|
func generateAppVM(l *libvirt.Libvirt, name, appvmPath, sharedDir string,
|
||||||
online bool) (err error) {
|
verbose, online bool) (err error) {
|
||||||
|
|
||||||
err = os.Chdir(appvmPath)
|
err = os.Chdir(appvmPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -178,9 +178,6 @@ func generateAppVM(l *libvirt.Libvirt, appvmPath, name string, verbose,
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
sharedDir := fmt.Sprintf(os.Getenv("HOME") + "/appvm/" + name)
|
|
||||||
os.MkdirAll(sharedDir, 0700)
|
|
||||||
|
|
||||||
xml := generateXML(name, online, realpath, reginfo, qcow2, sharedDir)
|
xml := generateXML(name, online, realpath, reginfo, qcow2, sharedDir)
|
||||||
_, err = l.DomainCreateXML(xml, libvirt.DomainStartValidate)
|
_, err = l.DomainCreateXML(xml, libvirt.DomainStartValidate)
|
||||||
return
|
return
|
||||||
@ -255,7 +252,11 @@ func start(l *libvirt.Libvirt, name string, verbose, online bool,
|
|||||||
if !verbose {
|
if !verbose {
|
||||||
go stupidProgressBar()
|
go stupidProgressBar()
|
||||||
}
|
}
|
||||||
err = generateAppVM(l, appvmPath, name, verbose, online)
|
|
||||||
|
sharedDir := fmt.Sprintf(os.Getenv("HOME") + "/appvm/" + name)
|
||||||
|
os.MkdirAll(sharedDir, 0700)
|
||||||
|
|
||||||
|
err = generateAppVM(l, name, appvmPath, sharedDir, verbose, online)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user