another check for custom cpu xml
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2df36637bf
commit
acdd6e9c5b
|
@ -84,16 +84,37 @@ func readConfigFile(filename string) error {
|
|||
}
|
||||
|
||||
func writeConfigFile() {
|
||||
test := time.Now().Format("YYYYMMDD-HH-MM")
|
||||
if !writeConfigFileTmp("virtigo.json.new." + test) {
|
||||
log.Println("config file write error")
|
||||
os.Exit(-1)
|
||||
}
|
||||
if !writeConfigFileTmp("virtigo.json") {
|
||||
log.Println("config file write error")
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
||||
origname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "virtigo.json")
|
||||
newname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "virtigo.json.old")
|
||||
err := os.Rename(origname, newname)
|
||||
if err != nil {
|
||||
log.Printf("rename fail: %s", err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
}
|
||||
|
||||
func writeConfigFileTmp(filename string) bool {
|
||||
fullname := filepath.Join(os.Getenv("VIRTIGO_HOME"), "virtigo.json")
|
||||
cfgfile, err := os.OpenFile(fullname, os.O_RDWR|os.O_CREATE, 0666)
|
||||
defer cfgfile.Close()
|
||||
if err != nil {
|
||||
log.Info("open config file :", err)
|
||||
return
|
||||
return false
|
||||
}
|
||||
json := me.cluster.FormatJSON()
|
||||
fmt.Fprintln(cfgfile, json)
|
||||
log.Info("Write:", fullname, "OK")
|
||||
return true
|
||||
}
|
||||
|
||||
func writeConfigFileDroplets() {
|
||||
|
|
8
xml.go
8
xml.go
|
@ -328,7 +328,13 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
|||
domcfg.CPU = nil
|
||||
case "host-model":
|
||||
domcfg.CPU = nil
|
||||
case "custom":
|
||||
fmt.Printf("? CPU: %+v\n", domcfg.CPU)
|
||||
fmt.Printf("? CPU Model: %+v\n", domcfg.CPU.Model)
|
||||
domcfg.CPU = nil
|
||||
default:
|
||||
fmt.Printf("? CPU: %+v\n", domcfg.CPU)
|
||||
fmt.Printf("? CPU Model: %+v\n", domcfg.CPU.Model)
|
||||
fmt.Printf("? CPU Mode: %+v\n", domcfg.CPU.Mode)
|
||||
}
|
||||
}
|
||||
|
@ -518,6 +524,8 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
|
|||
domcfg.Devices.Emulator = ""
|
||||
case "/usr/bin/kvm":
|
||||
domcfg.Devices.Emulator = ""
|
||||
case "/usr/bin/kvm-spice":
|
||||
domcfg.Devices.Emulator = ""
|
||||
default:
|
||||
fmt.Printf("Unknown Emulator: %s\n", domcfg.Devices.Emulator)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue