[libvirt] [PATCH go-xml v2] Add support for QEMU

Daniel P. Berrange berrange at redhat.com
Mon Jul 10 10:12:09 UTC 2017


On Mon, Jul 10, 2017 at 11:15:14AM +0200, Thomas Hipp wrote:
> Add support for QEMU, and add test code.
> 
> Signed-off-by: Thomas Hipp <thipp at suse.de>
> ---
> Changes since v1:
>   - support multiple Args and Envs
> 
> ---
>  domain.go      | 50 +++++++++++++++++++++++++++++++++-----------------
>  domain_test.go | 28 ++++++++++++++++++++++++++++
>  2 files changed, 61 insertions(+), 17 deletions(-)
> 
> diff --git a/domain.go b/domain.go
> index b9b0f77..8c1fa76 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -590,27 +590,43 @@ type DomainFeatureList struct {
>  	SMM        *DomainFeatureState  `xml:"smm"`
>  }
>  
> +type DomainQEMUCommandlineArg struct {
> +	Value string `xml:"value,attr"`
> +}
> +
> +type DomainQEMUCommandlineEnv struct {
> +	Name  string `xml:"name,attr"`
> +	Value string `xml:"value,attr,omitempty"`
> +}
> +
> +type DomainQEMUCommandline struct {

Add

      XMLName xml.Name  `xml:"http://libvirt.org/schemas/domain/qemu/1.0 commandline"`

> +	Args []DomainQEMUCommandlineArg `xml:"qemu arg"`

And change to `xml:"arg"`

> +	Envs []DomainQEMUCommandlineEnv `xml:"qemu env"`

And change to `xml:"arg"`

> +}



> +
>  // NB, try to keep the order of fields in this struct
>  // matching the order of XML elements that libvirt
>  // will generate when dumping XML.
>  type Domain struct {

...snip...

> +	QEMUCommandline *DomainQEMUCommandline `xml:"qemu commandline"`

And change to `xml:"commandline"`

>  }

Then, I think it will generate valid XML that works with libvirt

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