diff --git a/xml.go b/xml.go index 85d2c66..b5825ae 100644 --- a/xml.go +++ b/xml.go @@ -194,9 +194,6 @@ func setRandomMacs(domcfg *libvirtxml.Domain) { // there might be something interesting in a VM // 'standard' here means what I think is standard func dumpNonStandardXML(domcfg *libvirtxml.Domain) { - // Add more parts you are interested in - fmt.Printf("CPU Model: %+v\n", domcfg.CPU) - // dump all the clock stuff if it's standard var normalclock bool = true if domcfg.Clock.Offset != "utc" { @@ -277,6 +274,11 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { domcfg.Memory = nil domcfg.CurrentMemory = nil domcfg.VCPU = nil + if domcfg.CPU.Mode == "host-model" { + domcfg.CPU = nil + } else { + fmt.Printf("? CPU Mode: %+v\n", domcfg.CPU.Mode) + } // this will move elsewhere in the protobuf someday if domcfg.OnPoweroff == "destroy" { @@ -455,8 +457,15 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { // this is probably for spice to have keyboard and mouse input var normalVideo bool = true if domcfg.Devices.Videos != nil { - fmt.Printf("? Video: %+v\n", domcfg.Devices.Videos) - normalVideo = false + for _, v := range domcfg.Devices.Videos { + if (v.Model.Type == "qxl") && (v.Model.VRam == 65536) { + // standard qxl video + } else { + fmt.Printf("? Video: %+v\n", v) + fmt.Printf("? Video Model: %+v\n", v.Model) + normalVideo = false + } + } } if normalVideo { domcfg.Devices.Videos = nil @@ -477,12 +486,21 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { // dump out all the fields in libvirtxml.DomainDeviceList func dumpLibvirtxmlDomain() { - var domain libvirtxml.DomainDeviceList + var domain libvirtxml.Domain t := reflect.TypeOf(domain) + fmt.Println("Fields in libvirtxml.Domain:") + for i := 0; i < t.NumField(); i++ { + field := t.Field(i) + fmt.Println("Domain:", field.Name) + } + + var device libvirtxml.DomainDeviceList + t = reflect.TypeOf(device) + fmt.Println("Fields in libvirtxml.DomainDeviceList:") for i := 0; i < t.NumField(); i++ { field := t.Field(i) - fmt.Println(field.Name) + fmt.Println("DomainDeviceList:", field.Name) } }