PATCH go-xml : add virtualport support

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

 



Hi guys!

Working with terraform libvirt plugin I discovered lack of openvswitch support - but in libvirt-go there is no support for virtualport entry.. this patch adds virtualport support.

diff --git a/network.go b/network.go
index 10c4dfc..0f072ec 100644
--- a/network.go
+++ b/network.go
@@ -36,6 +36,16 @@ type NetworkBridge struct {
 	MACTableManager string `xml:"macTableManager,attr,omitempty"`
 }

+type VirtualPortParameters struct {
+	InterfaceID string `xml:"interfaceid,attr,omitempty"`
+	ProfileID   string `xml:"profileid,attr,omitempty"`
+}
+
+type VirtualPort struct {
+	Type       string                  `xml:"type,attr,omitempty"`
+	Parameters []VirtualPortParameters `xml:"parameters,omitempty"`
+}
+
 type NetworkDomain struct {
 	Name      string `xml:"name,attr,omitempty"`
 	LocalOnly string `xml:"localOnly,attr,omitempty"`
@@ -152,6 +162,7 @@ type Network struct {
 	UUID                string          `xml:"uuid,omitempty"`
 	MAC                 *NetworkMAC     `xml:"mac"`
 	Bridge              *NetworkBridge  `xml:"bridge"`
+	VirtualPort         *VirtualPort    `xml:"virtualport"`
 	Forward             *NetworkForward `xml:"forward"`
 	Domain              *NetworkDomain  `xml:"domain"`
 	IPs                 []NetworkIP     `xml:"ip"`
diff --git a/network_test.go b/network_test.go
index 3efb278..10cce66 100644
--- a/network_test.go
+++ b/network_test.go
@@ -65,6 +65,14 @@ var networkTestData = []struct {
 			Bridge: &NetworkBridge{
 				Name: "virbr0",
 			},
+			VirtualPort: &VirtualPort{
+				Type: "openvswitch",
+				Parameters: []VirtualPortParameters{
+					VirtualPortParameters{
+						InterfaceID: "09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f",
+					},
+				},
+			},
 			Forward: &NetworkForward{
 				Mode: "nat",
 				NAT: &NetworkForwardNAT{
@@ -175,6 +183,9 @@ var networkTestData = []struct {
 			`<network>`,
 			`  <name>test</name>`,
 			`  <bridge name="virbr0"></bridge>`,
+			`  <virtualport type="openvswitch">`,
+			`    <parameters interfaceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa4f"></parameters>`,
+			`  </virtualport>`,
 			`  <forward mode="nat">`,
 			`    <nat>`,
 			`      <address start="1.2.3.4" end="1.2.3.10"></address>`,


Best,
Karol




--
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