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

Daniel P. Berrangé berrange at redhat.com
Mon Mar 5 09:25:55 UTC 2018


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 at 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 at 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 :|




More information about the libvir-list mailing list