[PATCH go-xml] Add support for device sound

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]
  Powered by Linux