[Kimchi-devel] [PATCH v4] [Kimchi 1/8] Changing network API 'interface' to array: docs and API

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Thu Feb 18 10:56:24 UTC 2016


From: Daniel Henrique Barboza <dhbarboza82 at gmail.com>

Changed docs/API.md, i18n.py and API.json to reflect the new API.

interfaces[0] (the first element of this array) will have the
same effect as the former 'interface' parameter.

This change is necessary to better adapt the backend to networks
that can be created with more than one interface.

Signed-off-by: Daniel Henrique Barboza <dhbarboza82 at gmail.com>
---
 API.json    |  6 +++---
 docs/API.md | 12 ++++++------
 i18n.py     |  6 ++++--
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/API.json b/API.json
index 294be64..bc952b2 100644
--- a/API.json
+++ b/API.json
@@ -366,9 +366,9 @@
                     "type": "string",
                     "error": "KCHNET0013E"
                 },
-                "interface": {
-                    "description": "The name of a network interface on the host",
-                    "type": "string",
+                "interfaces": {
+                    "description": "An array of network interfaces of the host",
+                    "type": "array",
                     "error": "KCHNET0014E"
                 },
                 "vlan_id": {
diff --git a/docs/API.md b/docs/API.md
index a46e80e..e1433f0 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -675,9 +675,9 @@ A interface represents available interface on host.
                   it is not already a Linux bridge.
     * subnet *(optional)*: Network segment in slash-separated format with ip address and
                            prefix or netmask used to create nat network.
-    * interface *(optional)*: The name of a network interface on the host.
-                              For "macvtap" and "bridge" connections, the
-                              interface can be a nic, bridge or bonding device.
+    * interfaces *(optional)*: An array of network interfaces of the host.
+                               For "macvtap" and "bridge" connections, only
+                               one interface will be allowed in this array.
     * vlan_id *(optional)*: VLAN tagging ID for the macvtap bridge network.
 
 ### Resource: Network
@@ -710,9 +710,9 @@ A interface represents available interface on host.
         * bridge: Aggregated Public Network.
                   The VM that joines this network is seen as a peer on this network
                   and it may offer network services such as HTTP or SSH.
-    * interface: The name of a bridge network interface on the host.  All traffic
-                 on this network will be bridged through the indicated interface.
-                 The interface is a bridge or ethernet/bonding device.
+    * interfaces: An array of bridge network interfaces that belongs to this network
+                  All traffic on this network will be bridged through the first
+                  interface. The interface is a bridge or ethernet/bonding device.
     * persistent: If 'true', network will persist after a system reboot or be stopped.
                   All networks created by Kimchi are persistent.
 
diff --git a/i18n.py b/i18n.py
index 59e75f7..8280fe0 100644
--- a/i18n.py
+++ b/i18n.py
@@ -1,7 +1,7 @@
 #
 # Project Kimchi
 #
-# Copyright IBM, Corp. 2014-2016
+# Copyright IBM Corp, 2014-2016
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -262,7 +262,7 @@ messages = {
     "KCHNET0011E": _("Network name must be a string without slashes (/) or quotes (\")"),
     "KCHNET0012E": _("Supported network types are isolated, NAT, macvtap and bridge"),
     "KCHNET0013E": _("Network subnet must be a string with IP address and prefix or netmask"),
-    "KCHNET0014E": _("Network interface must be a string"),
+    "KCHNET0014E": _("Network interfaces must be an array."),
     "KCHNET0015E": _("Network VLAN ID must be an integer between 1 and 4094"),
     "KCHNET0016E": _("Specify name and type to create a Network"),
     "KCHNET0017E": _("Unable to delete network %(name)s. There are some virtual machines %(vms)s and/or templates linked to this network."),
@@ -275,6 +275,8 @@ messages = {
     "KCHNET0025E": _("Unable to create bridge %(name)s. Details: %(err)s"),
     "KCHNET0027E": _("Unable to create bridge with NetworkManager enabled. Disable it and try again."),
     "KCHNET0028E": _("Interface should be bare NIC or bonding."),
+    "KCHNET0029E": _("Network interfaces parameter must contain at least one interface."),
+    "KCHNET0030E": _("Only one interface is allowed for 'bridge' and 'macvtap' networks."),
 
     "KCHSR0001E": _("Storage server %(server)s was not used by Kimchi"),
 
-- 
2.5.0




More information about the Kimchi-devel mailing list