[libvirt] [PATCH go-xml] Add support for device sound

zhenwei.pi posted 1 patch 6 years, 10 months ago
Failed in applying to current master (apply log)
domain.go      | 11 +++++++++++
domain_test.go | 20 ++++++++++++++++++++
2 files changed, 31 insertions(+)
[libvirt] [PATCH go-xml] Add support for device sound
Posted by zhenwei.pi 6 years, 10 months ago
---
 domain.go      | 11 +++++++++++
 domain_test.go | 20 ++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/domain.go b/domain.go
index de47c07..bf0b851 100644
--- a/domain.go
+++ b/domain.go
@@ -283,6 +283,16 @@ type DomainMemBalloon struct {
 	Address *DomainAddress `xml:"address"`
 }
 
+type DomainSoundCodec struct {
+	Type string `xml:"type,attr"`
+}
+
+type DomainSound struct {
+	Model   string            `xml:"model,attr"`
+	Codec   *DomainSoundCodec `xml:"codec"`
+	Address *DomainAddress    `xml:"address"`
+}
+
 type DomainDeviceList struct {
 	Controllers []DomainController `xml:"controller"`
 	Disks       []DomainDisk       `xml:"disk"`
@@ -295,6 +305,7 @@ type DomainDeviceList struct {
 	Videos      []DomainVideo      `xml:"video"`
 	Channels    []DomainChardev    `xml:"channel"`
 	MemBalloon  *DomainMemBalloon  `xml:"memballoon"`
+	Sounds      []DomainSound      `xml:"sound"`
 }
 
 type DomainMemory struct {
diff --git a/domain_test.go b/domain_test.go
index 2c7173b..7990627 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -45,6 +45,7 @@ var ifaceAddr = Address{0, 0, 4, 0}
 var videoAddr = Address{0, 0, 5, 0}
 var fsAddr = Address{0, 0, 6, 0}
 var balloonAddr = Address{0, 0, 7, 0}
+var duplexAddr = Address{0, 0, 8, 0}
 
 var serialPort uint = 0
 
@@ -276,6 +277,21 @@ var domainTestData = []struct {
 						},
 					},
 				},
+				Sounds: []DomainSound{
+					DomainSound{
+						Model: "ich6",
+						Codec: &DomainSoundCodec{
+							Type: "duplex",
+						},
+						Address: &DomainAddress{
+							Type:     "pci",
+							Domain:   &duplexAddr.Domain,
+							Bus:      &duplexAddr.Bus,
+							Slot:     &duplexAddr.Slot,
+							Function: &duplexAddr.Function,
+						},
+					},
+				},
 			},
 		},
 		Expected: []string{
@@ -295,6 +311,10 @@ var domainTestData = []struct {
 			`    <memballoon model="virtio">`,
 			`      <address type="pci" domain="0" bus="0" slot="7" function="0"></address>`,
 			`    </memballoon>`,
+			`    <sound model="ich6">`,
+			`      <codec type="duplex"></codec>`,
+			`      <address type="pci" domain="0" bus="0" slot="8" function="0"></address>`,
+			`    </sound>`,
 			`  </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 support for device sound
Posted by Daniel P. Berrange 6 years, 10 months ago
On Thu, Jun 01, 2017 at 10:58:06AM +0800, zhenwei.pi wrote:
> ---
>  domain.go      | 11 +++++++++++
>  domain_test.go | 20 ++++++++++++++++++++
>  2 files changed, 31 insertions(+)

Thanks for your contribution, pushed to git


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