[libvirt] [PATCH go-xml] fix type tag for rdp and destkop graphics devices

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

On Sun, Mar 04, 2018 at 10:41:43AM -0500, Ryan Goodfellow wrote:
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.
The patch looks good, but we recently started to require all contributors to indicate their compliance with the DCO https://developercertificate.org/ you can do this by simply by adding 'Signed-off-by: Your Name <your@email>' in commit message for patches you submit - in this case no need to re-submit the patch - just reply to my email here with a Signed-off-by under your name and then I'll merge it.
--- 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
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Signed-off-by: Ryan Goodfellow <rgoodfel@isi.edu> On Mon, Mar 5, 2018 at 4:25 AM, Daniel P. Berrangé <berrange@redhat.com> wrote:
On Sun, Mar 04, 2018 at 10:41:43AM -0500, Ryan Goodfellow wrote:
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.
The patch looks good, but we recently started to require all contributors to indicate their compliance with the DCO
https://developercertificate.org/
' in commit message for patches you submit - in this case no need to re-submit
you can do this by simply by adding 'Signed-off-by: Your Name <your@email the patch - just reply to my email here with a Signed-off-by under your name and then I'll merge it.
--- 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
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/ dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/ dberrange :|
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- *ry**@isi*

Thanks, I've pushed this to git now On Sat, Mar 10, 2018 at 06:46:30PM -0500, Ryan Goodfellow wrote:
Signed-off-by: Ryan Goodfellow <rgoodfel@isi.edu>
On Mon, Mar 5, 2018 at 4:25 AM, Daniel P. Berrangé <berrange@redhat.com> wrote:
On Sun, Mar 04, 2018 at 10:41:43AM -0500, Ryan Goodfellow wrote:
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.
The patch looks good, but we recently started to require all contributors to indicate their compliance with the DCO
https://developercertificate.org/
' in commit message for patches you submit - in this case no need to re-submit
you can do this by simply by adding 'Signed-off-by: Your Name <your@email the patch - just reply to my email here with a Signed-off-by under your name and then I'll merge it.
--- 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
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/ dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/ dberrange :|
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- *ry**@isi*
Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
Ryan Goodfellow