On 09/01/2016 07:51 PM, Aline Manera wrote:
On 09/01/2016 04:16 AM, Suresh Babu Angadi wrote:
>
>
> On 09/01/2016 02:26 AM, Aline Manera wrote:
>>
>> Hi Suresh,
>>
>> Is this patch part of the work to enabling assigning network
>> interfaces to a guest without relying on libvirt?
>> So you need to expose an API to list the OVS bridges to UI be able
>> to show the available values to user. Is that correct?
> Hi Aline,
> Yes correct. To allow users to attach host ovs bridges directly to
> guest without libvirt network, we need to list host ovs bridges in UI
>>
>> A minor comment below:
>>
>> On 08/31/2016 06:21 AM, sureshab(a)linux.vnet.ibm.com wrote:
>>> From: Suresh Babu Angadi <sureshab(a)in.ibm.com>
>>>
>>> As Per RFC:
>>> [Kimchi-devel] [RFC] listing of ovs bridges
>>>
>>> this patch adds new API /plugins/kimchi/ovsbridges
>>> to list ovsbridges
>>>
>>> Signed-off-by: Suresh Babu Angadi <sureshab(a)in.ibm.com>
>>> ---
>>> control/ovsbridges.py | 29 +++++++++++++++++++++++++++++
>>> docs/API.md | 8 ++++++++
>>> model/ovsbridges.py | 31 +++++++++++++++++++++++++++++++
>>> 3 files changed, 68 insertions(+)
>>> create mode 100644 control/ovsbridges.py
>>> create mode 100644 model/ovsbridges.py
>>>
>>> diff --git a/control/ovsbridges.py b/control/ovsbridges.py
>>> new file mode 100644
>>> index 0000000..974e954
>>> --- /dev/null
>>> +++ b/control/ovsbridges.py
>>> @@ -0,0 +1,29 @@
>>> +#
>>> +# Project Kimchi
>>> +#
>>> +# Copyright IBM Corp, 2016
>>> +#
>>> +# This library is free software; you can redistribute it and/or
>>> +# modify it under the terms of the GNU Lesser General Public
>>> +# License as published by the Free Software Foundation; either
>>> +# version 2.1 of the License, or (at your option) any later version.
>>> +#
>>> +# This library is distributed in the hope that it will be useful,
>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> +# Lesser General Public License for more details.
>>> +#
>>> +# You should have received a copy of the GNU Lesser General Public
>>> +# License along with this library; if not, write to the Free Software
>>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> 02110-1301 USA
>>> +
>>> +from wok.control.base import SimpleCollection
>>> +from wok.control.utils import UrlSubNode
>>> +
>>> +
>>> +@UrlSubNode("ovsbridges", True)
>>> +class OVSBridges(SimpleCollection):
>>> + def __init__(self, model):
>>> + super(OVSBridges, self).__init__(model)
>>
>>> + self.role_key = 'ovsbridges'
>>
>> The role_key represents which tab the information provided by the
>> API will be used.
>> If the plans is to allow user attach a new network interface to a
>> guest on Edit Guest, the right value for role_key would be 'guests'.
> What should be the role_key if the list needs to be shown on Edit
> Guest and Edit Template? Current kimchi control files have only one
> role_key.
In this case, I'd suggest to remove the role_key config there. So
everyone can have access to the info.
As it is just for listing interfaces names, I don't see it as a
security issue.
What do you think?
looks good to me, i will send a v2 with this change.
>>
>>> + self.admin_methods = ['GET']
>>> diff --git a/docs/API.md b/docs/API.md
>>> index 7bd677f..49540b9 100644
>>> --- a/docs/API.md
>>> +++ b/docs/API.md
>>> @@ -1028,3 +1028,11 @@ List of available groups.
>>>
>>> * **GET**: Return the list of Kimchi peers in the same network
>>> (It uses openSLP for discovering)
>>> +
>>> +### Simple Collection: OVSBridges
>>> +
>>> +**URI:** /plugins/kimchi/ovsbridges
>>> +
>>> +**Methods:**
>>> +
>>> +* **GET**: Return list of OVS bridges of the host.
>>> diff --git a/model/ovsbridges.py b/model/ovsbridges.py
>>> new file mode 100644
>>> index 0000000..212520f
>>> --- /dev/null
>>> +++ b/model/ovsbridges.py
>>> @@ -0,0 +1,31 @@
>>> +#
>>> +# Project Kimchi
>>> +#
>>> +# Copyright IBM Corp, 2016
>>> +#
>>> +# This library is free software; you can redistribute it and/or
>>> +# modify it under the terms of the GNU Lesser General Public
>>> +# License as published by the Free Software Foundation; either
>>> +# version 2.1 of the License, or (at your option) any later version.
>>> +#
>>> +# This library is distributed in the hope that it will be useful,
>>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
>>> +# Lesser General Public License for more details.
>>> +#
>>> +# You should have received a copy of the GNU Lesser General Public
>>> +# License along with this library; if not, write to the Free Software
>>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
>>> 02110-1301 USA
>>> +
>>> +from wok.plugins.gingerbase.netinfo import ovs_bridges
>>> +
>>> +
>>> +class OVSBridgesModel(object):
>>> +
>>> + def get_list(self):
>>> + """
>>> +
>>> + Returns: list of ovs bridge names
>>> +
>>> + """
>>> + return ovs_bridges()
>>
>
--
Regards,
Suresh Babu Angadi