[Kimchi-devel] [PATCH 13/16] Move all resources related to host to control/host.py
Sheldon
shaohef at linux.vnet.ibm.com
Tue Dec 24 10:52:17 UTC 2013
On 12/24/2013 02:41 AM, Aline Manera wrote:
> From: Aline Manera <alinefm at br.ibm.com>
>
> Host(Resource), HostStats(Resource), Partitions(Collection) and Partition(Resource)
> were moved to a new - control/host.py
> That way we can easily know where host resource is implemented.
>
> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
> ---
> Makefile.am | 1 +
> src/kimchi/control/host.py | 61 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 62 insertions(+)
> create mode 100644 src/kimchi/control/host.py
>
> diff --git a/Makefile.am b/Makefile.am
> index 5ae93cd..e942045 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -48,6 +48,7 @@ PEP8_WHITELIST = \
> src/kimchi/control/base.py \
> src/kimchi/control/config.py \
> src/kimchi/control/debugreports.py \
> + src/kimchi/control/host.py \
> src/kimchi/control/interfaces.py \
> src/kimchi/control/networks.py \
> src/kimchi/control/storagepools.py \
> diff --git a/src/kimchi/control/host.py b/src/kimchi/control/host.py
> new file mode 100644
> index 0000000..30e566e
> --- /dev/null
> +++ b/src/kimchi/control/host.py
> @@ -0,0 +1,61 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2013
> +#
> +# Authors:
> +# Adam Litke <agl at linux.vnet.ibm.com>
$ git show 1f558d70
$ git show 59a09764
The author are:
ShaoHe Feng <shaohef at linux.vnet.ibm.com>
Daniel Henrique Barboza <danielhb 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 Host(Resource):
> + def __init__(self, model, id=None):
> + super(Host, self).__init__(model, id)
> + self.uri_fmt = '/host/%s'
> + self.reboot = self.generate_action_handler(self, 'reboot')
> + self.shutdown = self.generate_action_handler(self, 'shutdown')
> + self.stats = HostStats(self.model)
> + self.stats.exposed = True
> + self.partitions = Partitions(self.model)
> + self.partitions.exposed = True
> +
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class HostStats(Resource):
> + @property
> + def data(self):
> + return self.info
> +
> +
> +class Partitions(Collection):
> + def __init__(self, model):
> + super(Partitions, self).__init__(model)
> + self.resource = Partition
> +
> +
> +class Partition(Resource):
> + def __init__(self, model, id):
> + super(Partition, self).__init__(model, id)
> +
> + @property
> + def data(self):
> + return self.info
--
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center
More information about the Kimchi-devel
mailing list