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

Daniel Henrique Barboza dhbarboza82 at gmail.com
Tue Feb 16 17:46:11 UTC 2016



On 02/16/2016 03:05 PM, Lucio Correia wrote:
> On 16-02-2016 11:08, dhbarboza82 at gmail.com wrote:
>> 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 | 13 +++++++------
>>   i18n.py     |  5 +++--
>>   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..9457a4c 100644
>> --- a/docs/API.md
>> +++ b/docs/API.md
>> @@ -675,9 +675,10 @@ 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 interface on the 
>> host.
>> +                               For "macvtap" and "bridge" 
>> connections, the
>> +                               first interface can be a nic, bridge 
>> or bonding
>> +                               device.
> For macvtap it cannot be a bridge.

I guess the best move here is to eliminate this explanation in the 
'interfaces'
parameter, since we have the same explanation when describing the connection
types.
>
>
>>       * vlan_id *(optional)*: VLAN tagging ID for the macvtap bridge 
>> network.
>>
>>   ### Resource: Network
>> @@ -710,9 +711,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..5e1cdd7 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,7 @@ 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."),
>>
>>       "KCHSR0001E": _("Storage server %(server)s was not used by 
>> Kimchi"),
>>
>
>




More information about the Kimchi-devel mailing list