another check for custom cpu xml
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
2df36637bf
commit
acdd6e9c5b
|
@ -251,14 +251,14 @@ func updateNetwork(d *DropletT, domcfg *libvirtxml.Domain) bool {
|
|||
}
|
||||
|
||||
/* from vm3-with-nvme-1.5GB-sec.xml
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/nvme4n1'/>
|
||||
<backingStore/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<alias name='virtio-disk1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
<disk type='block' device='disk'>
|
||||
<driver name='qemu' type='raw'/>
|
||||
<source dev='/dev/nvme4n1'/>
|
||||
<backingStore/>
|
||||
<target dev='vdb' bus='virtio'/>
|
||||
<alias name='virtio-disk1'/>
|
||||
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
|
||||
</disk>
|
||||
*/
|
||||
|
||||
// returns false if something went wrong
|
||||
|
|
|
@ -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() {
|
||||
|
|
10
xml.go
10
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,8 +524,10 @@ 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)
|
||||
fmt.Printf("Unknown Emulator: %s\n", domcfg.Devices.Emulator)
|
||||
}
|
||||
|
||||
// ignore Channels == SpiceVMC
|
||||
|
|
Loading…
Reference in New Issue