<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 01/23/2014 09:01 PM, Aline Manera
wrote:<br>
</div>
<blockquote cite="mid:52E11295.30807@linux.vnet.ibm.com" type="cite">On
01/22/2014 02:13 PM, <a class="moz-txt-link-abbreviated" href="mailto:lvroyce@linux.vnet.ibm.com">lvroyce@linux.vnet.ibm.com</a> wrote:
<br>
<blockquote type="cite">From: Royce Lv
<a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
<br>
<br>
Add storage server collection and resource to report
<br>
used storage server.
<br>
<br>
Signed-off-by: Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
<br>
---
<br>
src/kimchi/API.json | 11 ++++++++++
<br>
src/kimchi/control/storageservers.py | 41
++++++++++++++++++++++++++++++++++++
<br>
src/kimchi/root.py | 2 ++
<br>
3 files changed, 54 insertions(+)
<br>
create mode 100644 src/kimchi/control/storageservers.py
<br>
<br>
diff --git a/src/kimchi/API.json b/src/kimchi/API.json
<br>
index 46818d4..9b86164 100644
<br>
--- a/src/kimchi/API.json
<br>
+++ b/src/kimchi/API.json
<br>
@@ -237,6 +237,17 @@
<br>
},
<br>
"additionalProperties": false
<br>
},
<br>
+ "storageservers_get_list": {
<br>
+ "type": "object",
<br>
+ "properties": {
<br>
+ "_target_type": {
<br>
+ "description": "List storage servers of
given type",
<br>
+ "type": "string",
<br>
+ "pattern": "^netfs$"
<br>
+ }
<br>
+ },
<br>
+ "additionalProperties": false
<br>
+ },
<br>
"template_update": {
<br>
"type": "object",
<br>
"properties": {
<br>
diff --git a/src/kimchi/control/storageservers.py
b/src/kimchi/control/storageservers.py
<br>
new file mode 100644
<br>
index 0000000..c692fae
<br>
--- /dev/null
<br>
+++ b/src/kimchi/control/storageservers.py
<br>
@@ -0,0 +1,41 @@
<br>
+#
<br>
+# Project Kimchi
<br>
+#
<br>
+# Copyright IBM, Corp. 2014
<br>
+#
<br>
+# Authors:
<br>
+# Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
<br>
+#
<br>
+# This library is free software; you can redistribute it and/or
<br>
+# modify it under the terms of the GNU Lesser General Public
<br>
+# License as published by the Free Software Foundation; either
<br>
+# version 2.1 of the License, or (at your option) any later
version.
<br>
+#
<br>
+# This library is distributed in the hope that it will be
useful,
<br>
+# but WITHOUT ANY WARRANTY; without even the implied warranty
of
<br>
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU
<br>
+# Lesser General Public License for more details.
<br>
+#
<br>
+# You should have received a copy of the GNU Lesser General
Public
<br>
+# License along with this library; if not, write to the Free
Software
<br>
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301 USA
<br>
+
<br>
+from kimchi.control.base import Collection, Resource
<br>
+from kimchi.control.utils import get_class_name, model_fn
<br>
+import kimchi.template
<br>
+
<br>
+
<br>
+class StorageServers(Collection):
<br>
+ def __init__(self, model):
<br>
+ super(StorageServers, self).__init__(model)
<br>
+ self.resource = StorageServer
<br>
+
<br>
+
<br>
+class StorageServer(Resource):
<br>
+ def __init__(self, model, ident):
<br>
+ super(StorageServer, self).__init__(model, ident)
<br>
+ self.storagetargets = StorageTargets(self.model,
self.ident.decode("utf-8"))
<br>
+
<br>
+ @property
<br>
+ def data(self):
<br>
+ return self.info
<br>
diff --git a/src/kimchi/root.py b/src/kimchi/root.py
<br>
index 3cc6321..ec531c0 100644
<br>
--- a/src/kimchi/root.py
<br>
+++ b/src/kimchi/root.py
<br>
@@ -36,6 +36,7 @@ from kimchi.control.interfaces import
Interfaces
<br>
from kimchi.control.networks import Networks
<br>
from kimchi.control.plugins import Plugins
<br>
from kimchi.control.storagepools import StoragePools
<br>
+from kimchi.control.storageserver import StorageServers
<br>
</blockquote>
<br>
It should be:
<br>
<br>
from kimchi.control.storageservers import StorageServers
<br>
</blockquote>
after my patch, <font color="#909090"><font size="3"> "[PATCH]
improve controller" </font></font><br>
you do not need to touch root.py any more.<br>
<blockquote cite="mid:52E11295.30807@linux.vnet.ibm.com" type="cite">
<br>
I will fix it before applying the patch =)
<br>
So you don't need to send again the patch set
<br>
<br>
<blockquote type="cite"> from kimchi.control.tasks import Tasks
<br>
from kimchi.control.templates import Templates
<br>
from kimchi.control.utils import parse_request
<br>
@@ -60,6 +61,7 @@ class Root(Resource):
<br>
self.vms = VMs(model)
<br>
self.templates = Templates(model)
<br>
self.storagepools = StoragePools(model)
<br>
+ self.storageservers = StorageServers(model)
<br>
self.interfaces = Interfaces(model)
<br>
self.networks = Networks(model)
<br>
self.tasks = Tasks(model)
<br>
</blockquote>
<br>
_______________________________________________
<br>
Kimchi-devel mailing list
<br>
<a class="moz-txt-link-abbreviated" href="mailto:Kimchi-devel@ovirt.org">Kimchi-devel@ovirt.org</a>
<br>
<a class="moz-txt-link-freetext" href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a>
<br>
<br>
<br>
<br>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Thanks and best regards!
Sheldon Feng(冯少合)<a class="moz-txt-link-rfc2396E" href="mailto:shaohef@linux.vnet.ibm.com"><shaohef@linux.vnet.ibm.com></a>
IBM Linux Technology Center</pre>
</body>
</html>