down to the last standard DomainDeviceList thing

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-10-23 14:20:59 -05:00
parent 6de8f66794
commit 0b1c4f92cd
1 changed files with 47 additions and 7 deletions

54
xml.go
View File

@ -427,14 +427,42 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
domcfg.Devices.Channels = nil domcfg.Devices.Channels = nil
} }
var domain libvirtxml.DomainDeviceList // this is probably for spice to have keyboard and mouse input
t := reflect.TypeOf(domain) normalSpice = true
if domcfg.Devices.RedirDevs != nil {
fmt.Println("Fields in libvirtxml.DomainDeviceList:") for _, c := range domcfg.Devices.RedirDevs {
for i := 0; i < t.NumField(); i++ { s := c.Source
field := t.Field(i) if s != nil {
fmt.Println(field.Name) if s.SpiceVMC != nil {
// this is the normal USB redirection (I guess)
} else {
normalSpice = false
}
} else {
normalSpice = false
}
// fmt.Printf("? RedirDevs: %+v\n", c)
// fmt.Printf("? RedirDevs Source: %+v\n", s)
// fmt.Printf("? RedirDevs SpiceVMC: %d\n", *s.SpiceVMC)
// fmt.Printf("? RedirDevs Address: %+v\n", c.Address)
// fmt.Printf("? RedirDevs USB: %+v\n", c.Address.USB)
}
} }
if normalSpice {
domcfg.Devices.RedirDevs = nil
}
// 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
}
if normalVideo {
domcfg.Devices.Videos = nil
}
// dumpLibvirtxmlDomain()
updatedXML, err := xml.MarshalIndent(domcfg, "", " ") updatedXML, err := xml.MarshalIndent(domcfg, "", " ")
if err != nil { if err != nil {
@ -446,3 +474,15 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) {
fmt.Println(string(updatedXML)) fmt.Println(string(updatedXML))
os.Exit(-1) os.Exit(-1)
} }
// dump out all the fields in libvirtxml.DomainDeviceList
func dumpLibvirtxmlDomain() {
var domain libvirtxml.DomainDeviceList
t := reflect.TypeOf(domain)
fmt.Println("Fields in libvirtxml.DomainDeviceList:")
for i := 0; i < t.NumField(); i++ {
field := t.Field(i)
fmt.Println(field.Name)
}
}