diff options
| author | Jeff Carr <[email protected]> | 2024-10-23 14:20:59 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-10-23 14:20:59 -0500 |
| commit | 0b1c4f92cdc35c75d3622002a25bffcc9055ef94 (patch) | |
| tree | 956cf4f374f8675f4845bbfe9b7bca21c3b0f35b /xml.go | |
| parent | 6de8f66794384d847fcda0d3bf5ee1004ed5b646 (diff) | |
down to the last standard DomainDeviceList thing
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'xml.go')
| -rw-r--r-- | xml.go | 52 |
1 files changed, 46 insertions, 6 deletions
@@ -427,14 +427,42 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { domcfg.Devices.Channels = nil } - var domain libvirtxml.DomainDeviceList - t := reflect.TypeOf(domain) + // this is probably for spice to have keyboard and mouse input + normalSpice = true + if domcfg.Devices.RedirDevs != nil { + for _, c := range domcfg.Devices.RedirDevs { + s := c.Source + if s != nil { + 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 + } - fmt.Println("Fields in libvirtxml.DomainDeviceList:") - for i := 0; i < t.NumField(); i++ { - field := t.Field(i) - fmt.Println(field.Name) + // 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, "", " ") if err != nil { @@ -446,3 +474,15 @@ func dumpNonStandardXML(domcfg *libvirtxml.Domain) { fmt.Println(string(updatedXML)) 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) + } +} |
