[Kimchi-devel] [PATCH 10/16] Move all resources related to interfaces to control/interfaces.py

Ramon Medeiros ramonn at linux.vnet.ibm.com
Mon Dec 23 19:58:02 UTC 2013


On 12/23/2013 04:41 PM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> Interfaces(Collection) and Interface(Resource) were moved to a new -
> control/interfaces.py
> That way we can easily know where interface resource is implemented.
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
>   Makefile.am                      |    1 +
>   src/kimchi/control/interfaces.py |   44 ++++++++++++++++++++++++++++++++++++++
>   2 files changed, 45 insertions(+)
>   create mode 100644 src/kimchi/control/interfaces.py
>
> diff --git a/Makefile.am b/Makefile.am
> index c9a1faf..76953ea 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -47,6 +47,7 @@ PEP8_WHITELIST = \
>   	src/kimchi/server.py \
>   	src/kimchi/control/base.py \
>   	src/kimchi/control/debugreports.py \
> +	src/kimchi/control/interfaces.py \
>   	src/kimchi/control/storagepools.py \
>   	src/kimchi/control/storagevolumes.py \
>   	src/kimchi/control/templates.py \
> diff --git a/src/kimchi/control/interfaces.py b/src/kimchi/control/interfaces.py
> new file mode 100644
> index 0000000..33afea2
> --- /dev/null
> +++ b/src/kimchi/control/interfaces.py
> @@ -0,0 +1,44 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013
> +#
> +# Authors:
> +#  Adam Litke <agl at linux.vnet.ibm.com>
> +#  Aline Manera <alinefm at linux.vnet.ibm.com>
> +#
> +# 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 kimchi.control.base import Collection, Resource
> +
> +
> +class Interfaces(Collection):
> +    def __init__(self, model):
> +        super(Interfaces, self).__init__(model)
> +        self.resource = Interface
> +
> +
> +class Interface(Resource):
> +    def __init__(self, model, ident):
> +        super(Interface, self).__init__(model, ident)
> +        self.uri_fmt = "/interfaces/%s"
make a constant!
> +
> +    @property
> +    def data(self):
> +        return {'name': self.ident,
> +                'type': self.info['type'],
> +                'ipaddr': self.info['ipaddr'],
> +                'netmask': self.info['netmask'],
> +                'status': self.info['status']}


-- 
Ramon Nunes Medeiros
Software Engineer - Linux Technology Center Brazil
IBM Systems & Technology Group
Phone : +55 19 2132 7878
ramonn at br.ibm.com




More information about the Kimchi-devel mailing list