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

[libvirt] [PATCH go-xml] support virtualport for interface and add test code



---
 domain.go      | 29 +++++++++++++++++------------
 domain_test.go |  4 ++++
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/domain.go b/domain.go
index eb7ff9e..ecb8550 100644
--- a/domain.go
+++ b/domain.go
@@ -185,19 +185,24 @@ type DomainInterfaceDriver struct {
 	Queues uint   `xml:"queues,attr,omitempty"`
 }
 
+type DomainInterfaceVirtualport struct {
+	Type string `xml:"type,attr"`
+}
+
 type DomainInterface struct {
-	XMLName xml.Name               `xml:"interface"`
-	Type    string                 `xml:"type,attr"`
-	MAC     *DomainInterfaceMAC    `xml:"mac"`
-	Model   *DomainInterfaceModel  `xml:"model"`
-	Source  *DomainInterfaceSource `xml:"source"`
-	Target  *DomainInterfaceTarget `xml:"target"`
-	Alias   *DomainInterfaceAlias  `xml:"alias"`
-	Link    *DomainInterfaceLink   `xml:"link"`
-	Boot    *DomainDeviceBoot      `xml:"boot"`
-	Script  *DomainInterfaceScript `xml:"script"`
-	Driver  *DomainInterfaceDriver `xml:"driver"`
-	Address *DomainAddress         `xml:"address"`
+	XMLName     xml.Name                    `xml:"interface"`
+	Type        string                      `xml:"type,attr"`
+	MAC         *DomainInterfaceMAC         `xml:"mac"`
+	Model       *DomainInterfaceModel       `xml:"model"`
+	Source      *DomainInterfaceSource      `xml:"source"`
+	Target      *DomainInterfaceTarget      `xml:"target"`
+	Alias       *DomainInterfaceAlias       `xml:"alias"`
+	Link        *DomainInterfaceLink        `xml:"link"`
+	Boot        *DomainDeviceBoot           `xml:"boot"`
+	Script      *DomainInterfaceScript      `xml:"script"`
+	Driver      *DomainInterfaceDriver      `xml:"driver"`
+	Virtualport *DomainInterfaceVirtualport `xml:"virtualport"`
+	Address     *DomainAddress              `xml:"address"`
 }
 
 type DomainChardevSource struct {
diff --git a/domain_test.go b/domain_test.go
index 6b37719..9de725c 100644
--- a/domain_test.go
+++ b/domain_test.go
@@ -565,6 +565,9 @@ var domainTestData = []struct {
 						Model: &DomainInterfaceModel{
 							Type: "virtio",
 						},
+						Virtualport: &DomainInterfaceVirtualport{
+							Type: "openvswitch",
+						},
 					},
 				},
 			},
@@ -577,6 +580,7 @@ var domainTestData = []struct {
 			`    <interface type="network">`,
 			`      <mac address="00:11:22:33:44:55"></mac>`,
 			`      <model type="virtio"></model>`,
+			`      <virtualport type="openvswitch"></virtualport>`,
 			`    </interface>`,
 			`  </devices>`,
 			`</domain>`,
-- 
2.7.4


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