[libvirt] [PATCH go-xml] add emulator supported

zhenwei.pi posted 1 patch 6 years, 10 months ago
Failed in applying to current master (apply log)
domain.go      | 1 +
domain_test.go | 6 ++++++
2 files changed, 7 insertions(+)
[libvirt] [PATCH go-xml] add emulator supported
Posted by zhenwei.pi 6 years, 10 months ago
---
 domain.go      | 1 +
 domain_test.go | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/domain.go b/domain.go
index dcb8f65..723e761 100644
--- a/domain.go
+++ b/domain.go
@@ -307,6 +307,7 @@ type DomainDeviceList struct {
 	Channels    []DomainChardev    `xml:"channel"`
 	MemBalloon  *DomainMemBalloon  `xml:"memballoon"`
 	Sounds      []DomainSound      `xml:"sound"`
+	Emulator    string             `xml:"emulator,omitempty"`
 }
 
 type DomainMemory struct {
diff --git a/domain_test.go b/domain_test.go
index 632b714..9efbd6b 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -572,6 +572,9 @@ var domainTestData = []struct {
 					DomainCPUFeature{Policy: "disable", Name: "lahf_lm"},
 				},
 			},
+			Devices: &DomainDeviceList{
+				Emulator: "/bin/qemu-kvm",
+			},
 		},
 		Expected: []string{
 			`<domain type="kvm">`,
@@ -582,6 +585,9 @@ var domainTestData = []struct {
 			`    <topology sockets="1" cores="2" threads="1"></topology>`,
 			`    <feature policy="disable" name="lahf_lm"></feature>`,
 			`  </cpu>`,
+			`  <devices>`,
+			`    <emulator>/bin/qemu-kvm</emulator>`,
+			`  </devices>`,
 			`</domain>`,
 		},
 	},
-- 
2.7.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH go-xml] add emulator supported
Posted by Daniel P. Berrange 6 years, 10 months ago
On Sat, Jun 03, 2017 at 09:30:00AM +0800, zhenwei.pi wrote:
> ---
>  domain.go      | 1 +
>  domain_test.go | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/domain.go b/domain.go
> index dcb8f65..723e761 100644
> --- a/domain.go
> +++ b/domain.go
> @@ -307,6 +307,7 @@ type DomainDeviceList struct {
>  	Channels    []DomainChardev    `xml:"channel"`
>  	MemBalloon  *DomainMemBalloon  `xml:"memballoon"`
>  	Sounds      []DomainSound      `xml:"sound"`
> +	Emulator    string             `xml:"emulator,omitempty"`
>  }
>  
>  type DomainMemory struct {
> diff --git a/domain_test.go b/domain_test.go
> index 632b714..9efbd6b 100644
> --- a/domain_test.go
> +++ b/domain_test.go
> @@ -572,6 +572,9 @@ var domainTestData = []struct {
>  					DomainCPUFeature{Policy: "disable", Name: "lahf_lm"},
>  				},
>  			},
> +			Devices: &DomainDeviceList{
> +				Emulator: "/bin/qemu-kvm",
> +			},
>  		},
>  		Expected: []string{
>  			`<domain type="kvm">`,
> @@ -582,6 +585,9 @@ var domainTestData = []struct {
>  			`    <topology sockets="1" cores="2" threads="1"></topology>`,
>  			`    <feature policy="disable" name="lahf_lm"></feature>`,
>  			`  </cpu>`,
> +			`  <devices>`,
> +			`    <emulator>/bin/qemu-kvm</emulator>`,
> +			`  </devices>`,
>  			`</domain>`,
>  		},
>  	},

Thanks, I've pushed this to git with just one small change - i listed
'Emulator' as the first thing in the DomainDeviceList struct to match
ordering libvirt uses.

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