[libvirt] [PATCH go-xml] Add support for domain input address

ZhenweiPi zhenwei.pi at youruncloud.com
Fri Jun 2 00:47:07 UTC 2017


---

  domain.go      |  5 +++--
  domain_test.go | 11 ++++++++++-
  2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/domain.go b/domain.go
index bf0b851..dcb8f65 100644
--- a/domain.go
+++ b/domain.go
@@ -232,8 +232,9 @@ type DomainChardev struct {
  }
  
  type DomainInput struct {
-	Type string `xml:"type,attr"`
-	Bus  string `xml:"bus,attr"`
+	Type    string         `xml:"type,attr"`
+	Bus     string         `xml:"bus,attr"`
+	Address *DomainAddress `xml:"address"`
  }
  
  type DomainGraphicListener struct {
diff --git a/domain_test.go b/domain_test.go
index 7990627..632b714 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -48,6 +48,8 @@ var balloonAddr = Address{0, 0, 7, 0}
  var duplexAddr = Address{0, 0, 8, 0}
  
  var serialPort uint = 0
+var tabletBus uint = 0
+var tabletPort uint = 1
  
  var domainTestData = []struct {
  	Object   *Domain
@@ -230,6 +232,11 @@ var domainTestData = []struct {
  					DomainInput{
  						Type: "tablet",
  						Bus:  "usb",
+						Address: &DomainAddress{
+							Type: "usb",
+							Bus:  &tabletBus,
+							Port: &tabletPort,
+						},
  					},
  					DomainInput{
  						Type: "keyboard",
@@ -301,7 +308,9 @@ var domainTestData = []struct {
  			`    <serial type="pty">`,
  			`      <target port="0"></target>`,
  			`    </serial>`,
-			`    <input type="tablet" bus="usb"></input>`,
+			`    <input type="tablet" bus="usb">`,
+			`      <address type="usb" bus="0" port="1"></address>`,
+			`    </input>`,
  			`    <input type="keyboard" bus="ps2"></input>`,
  			`    <graphics type="vnc"></graphics>`,
  			`    <video>`,
-- 
2.7.4





More information about the libvir-list mailing list