The current behavior is to generate a type="vnc" tag in the <graphics>
element generated from either a DomainGrapicRDP or DomainGraphicDesktop.
The correct tags should be type="rdp" and type="desktop"
respectively.
This commit emits the correct tags and adds a test for correct graphics
device tagging.
---
domain.go | 4 ++--
domain_test.go | 26 ++++++++++++++++++++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/domain.go b/domain.go
index ea53dfc..1de4ade 100644
--- a/domain.go
+++ b/domain.go
@@ -4226,12 +4226,12 @@ func (a *DomainGraphic) MarshalXML(e *xml.Encoder, start
xml.StartElement) error
return e.EncodeElement(a.VNC, start)
} else if a.RDP != nil {
start.Attr = append(start.Attr, xml.Attr{
- xml.Name{Local: "type"}, "vnc",
+ xml.Name{Local: "type"}, "rdp",
})
return e.EncodeElement(a.RDP, start)
} else if a.Desktop != nil {
start.Attr = append(start.Attr, xml.Attr{
- xml.Name{Local: "type"}, "vnc",
+ xml.Name{Local: "type"}, "desktop",
})
return e.EncodeElement(a.Desktop, start)
} else if a.Spice != nil {
diff --git a/domain_test.go b/domain_test.go
index 7c9d3a2..1715e01 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -3782,6 +3782,32 @@ var domainTestData = []struct {
`</domain>`,
},
},
+ {
+ Object: &Domain{
+ Name: "demo",
+ Devices: &DomainDeviceList{
+ Graphics: []DomainGraphic{
+ DomainGraphic{SDL: &DomainGraphicSDL{}},
+ DomainGraphic{VNC: &DomainGraphicVNC{}},
+ DomainGraphic{RDP: &DomainGraphicRDP{}},
+ DomainGraphic{Desktop: &DomainGraphicDesktop{}},
+ DomainGraphic{Spice: &DomainGraphicSpice{}},
+ },
+ },
+ },
+ Expected: []string{
+ `<domain>`,
+ ` <name>demo</name>`,
+ ` <devices>`,
+ ` <graphics type="sdl"></graphics>`,
+ ` <graphics type="vnc"></graphics>`,
+ ` <graphics type="rdp"></graphics>`,
+ ` <graphics type="desktop"></graphics>`,
+ ` <graphics type="spice"></graphics>`,
+ ` </devices>`,
+ `</domain>`,
+ },
+ },
}
func TestDomain(t *testing.T) {
--
2.14.3