[Kimchi-devel] [PATCHv9 04/10] storage server: update controller.py
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jan 23 13:01:09 UTC 2014
On 01/22/2014 02:13 PM, lvroyce at linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>
> Add storage server collection and resource to report
> used storage server.
>
> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
> ---
> src/kimchi/API.json | 11 ++++++++++
> src/kimchi/control/storageservers.py | 41 ++++++++++++++++++++++++++++++++++++
> src/kimchi/root.py | 2 ++
> 3 files changed, 54 insertions(+)
> create mode 100644 src/kimchi/control/storageservers.py
>
> diff --git a/src/kimchi/API.json b/src/kimchi/API.json
> index 46818d4..9b86164 100644
> --- a/src/kimchi/API.json
> +++ b/src/kimchi/API.json
> @@ -237,6 +237,17 @@
> },
> "additionalProperties": false
> },
> + "storageservers_get_list": {
> + "type": "object",
> + "properties": {
> + "_target_type": {
> + "description": "List storage servers of given type",
> + "type": "string",
> + "pattern": "^netfs$"
> + }
> + },
> + "additionalProperties": false
> + },
> "template_update": {
> "type": "object",
> "properties": {
> diff --git a/src/kimchi/control/storageservers.py b/src/kimchi/control/storageservers.py
> new file mode 100644
> index 0000000..c692fae
> --- /dev/null
> +++ b/src/kimchi/control/storageservers.py
> @@ -0,0 +1,41 @@
> +#
> +# Project Kimchi
> +#
> +# Copyright IBM, Corp. 2014
> +#
> +# Authors:
> +# Royce Lv <lvroyce 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
> +from kimchi.control.utils import get_class_name, model_fn
> +import kimchi.template
> +
> +
> +class StorageServers(Collection):
> + def __init__(self, model):
> + super(StorageServers, self).__init__(model)
> + self.resource = StorageServer
> +
> +
> +class StorageServer(Resource):
> + def __init__(self, model, ident):
> + super(StorageServer, self).__init__(model, ident)
> + self.storagetargets = StorageTargets(self.model, self.ident.decode("utf-8"))
> +
> + @property
> + def data(self):
> + return self.info
> diff --git a/src/kimchi/root.py b/src/kimchi/root.py
> index 3cc6321..ec531c0 100644
> --- a/src/kimchi/root.py
> +++ b/src/kimchi/root.py
> @@ -36,6 +36,7 @@ from kimchi.control.interfaces import Interfaces
> from kimchi.control.networks import Networks
> from kimchi.control.plugins import Plugins
> from kimchi.control.storagepools import StoragePools
> +from kimchi.control.storageserver import StorageServers
It should be:
from kimchi.control.storageservers import StorageServers
I will fix it before applying the patch =)
So you don't need to send again the patch set
> from kimchi.control.tasks import Tasks
> from kimchi.control.templates import Templates
> from kimchi.control.utils import parse_request
> @@ -60,6 +61,7 @@ class Root(Resource):
> self.vms = VMs(model)
> self.templates = Templates(model)
> self.storagepools = StoragePools(model)
> + self.storageservers = StorageServers(model)
> self.interfaces = Interfaces(model)
> self.networks = Networks(model)
> self.tasks = Tasks(model)
More information about the Kimchi-devel
mailing list