<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I had a few problems when testing this patchset. Below is the
sequence of commands I tried, their outputs and my opinions. I'm
running Fedora 21.<br>
<br>
First, I tried to query the current VGs on my system:<br>
<br>
<tt>GET /host/vgs</tt><tt><br>
</tt><tt>[</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/fedora",</tt><tt><br>
</tt><tt> "name":"fedora",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"19,51g"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>]</tt><br>
<br>
That is the default VG created by the Fedora installer. The field
"size" contains "19,51g" and I think that's not a desirable output
due to these two reasons:<br>
<br>
1) The value contains a unit. No other API on Kimchi returns a size
value with a unit, the return unit is always documented. For
example, in docs/API.md there is the following description for
/storagepools/<pool>: "capacity: The total space which can be
used to store volumes. <b>The unit is Bytes</b>". Notice how the
unit is specified on the documentation. This makes it easy for the
user to parse the output value because they always know which unit
the value will be in. On Kimchi, we have the function
"kimchi.utils.convert_data_size" which converts values from any unit
to any other unit. I suggest we use bytes as the VG size unit as it
is also the unit used elsewhere.<br>
<br>
2) The value contains a comma instead of a dot. Probably that's
because my system is using a Brazilian Portuguese locale (for
context: in Brazilian Portuguese we use commas instead of dots to
split decimal values, e.g. "1,5" = one and a half, unlike in
English, where they use "1.5"). We shouldn't output different values
based on the system's locale, otherwise, the user will never know
how to parse the server's output. If we use bytes as the unit as
suggested above, we wouldn't even need to use a decimal separator
here, because we don't deal with values less than one byte anyway.<br>
<br>
Both of the problems above are probably related to the output of
"vgs". We should normalize that output so the user always know what
to expect.<br>
<br>
Another problem I'm having here is that I can't filter the VGs based
on the field 'pool':<br>
<br>
<tt>GET /host/vgs?pool='x'</tt><tt><br>
</tt><tt>[</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/fedora",</tt><tt><br>
</tt><tt> "name":"fedora",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"19,51g"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>]</tt><br>
<br>
If I understand correctly, I should get an empty list here because I
filtered for "pool=x", and the result doesn't have "pool=x".<br>
<br>
Then I created a new VG using "vgcreate" and I queried Kimchi again:<br>
<br>
<tt>GET /host/vgs</tt><tt><br>
</tt><tt>[</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/fedora",</tt><tt><br>
</tt><tt> "name":"fedora",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"19,51g"</tt><tt><br>
</tt><tt> },</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/kimchivg",</tt><tt><br>
</tt><tt> "name":"kimchivg",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"5,00g"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>]</tt><br>
<br>
And then I created a new storage pool with that VG:<br>
<br>
<tt>POST /storagepools/ '{"path": "kimchivg", "name":
"kimchi-logical" "type": "logical"}'</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> "available":0,</tt><tt><br>
</tt><tt> "nr_volumes":0,</tt><tt><br>
</tt><tt> "path":"/dev/kimchi-logical",</tt><tt><br>
</tt><tt> "allocated":0,</tt><tt><br>
</tt><tt> "capacity":0,</tt><tt><br>
</tt><tt> "name":"kimchi-logical",</tt><tt><br>
</tt><tt> "persistent":true,</tt><tt><br>
</tt><tt> "source":{},</tt><tt><br>
</tt><tt> "state":"inactive",</tt><tt><br>
</tt><tt> "autostart":false,</tt><tt><br>
</tt><tt> "type":"logical"</tt><tt><br>
</tt><tt>}</tt><br>
<br>
However, if I query the VGs again, "kimchivg" still doesn't report
that it now belongs to "kimchi-logical":<br>
<br>
<tt>GET /host/vgs?name='kimchivg'</tt><tt><br>
</tt><tt>[</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/fedora",</tt><tt><br>
</tt><tt> "name":"fedora",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"19,51g"</tt><tt><br>
</tt><tt> },</tt><tt><br>
</tt><tt> {</tt><tt><br>
</tt><tt> "path":"/dev/kimchivg",</tt><tt><br>
</tt><tt> "name":"kimchivg",</tt><tt><br>
</tt><tt> "pool":"",</tt><tt><br>
</tt><tt> "size":"5,00g"</tt><tt><br>
</tt><tt> }</tt><tt><br>
</tt><tt>]</tt><br>
<br>
Notice how I couldn't filter by the VG name as well. And "pool" in
"kimchivg" is empty. As far as I understand, it should contain
"kimchi-logical" now.<br>
<br>
And lastly, when I tried to activate that new storage pool, I got an
error:<br>
<br>
<tt>POST /storagepools/kimchi-logical/activate</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> "reason":"KCHPOOL0009E: Unable to activate storage pool
kimchi-logical. Details: internal error: Child process
(/usr/sbin/vgchange -aly kimchi-logical) unexpected exit status
5: Volume group \"kimchi-logical\" not found\n Cannot process
volume group kimchi-logical\n",</tt><tt><br>
</tt><tt> "code":"500 Internal Server Error",</tt><tt><br>
</tt><tt> "call_stack":"Traceback (most recent call last):\n File
\"/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py\", line
656, in respond\n response.body = self.handler()\n File
\"/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py\",
line 188, in __call__\n self.body = self.oldhandler(*args,
**kwargs)\n File
\"/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py\", line
34, in __call__\n return self.callable(*self.args,
**self.kwargs)\n File
\"/home/kimchi/kimchi/src/kimchi/control/base.py\", line 129, in
wrapper\n raise cherrypy.HTTPError(500, e.message)\nHTTPError:
(500, u'KCHPOOL0009E: Unable to activate storage pool
kimchi-logical. Details: internal error: Child process
(/usr/sbin/vgchange -aly kimchi-logical) unexpected exit status
5: Volume group \"kimchi-logical\" not found\\n Cannot process
volume group kimchi-logical\\n')\n"</tt><br>
<br>
By looking at that error message, I guess Kimchi is assuming that
"kimchi-logical" is the VG name. Currently, when Kimchi creates the
VGs before creating the logical storage pools, we use the VG name
the same as the pool name. With this patchset, that may not be the
case anymore; I have a VG named "kimchivg" and a storage pool named
"kimchi-logical", and I believe that's the root of this error here.<br>
<br>
Please correct me if I misunderstood something about this new
patchset. As this is still a new feature, I may have assumed
something wrong.<br>
<br>
<div class="moz-cite-prefix">On 12-04-2015 11:13,
<a class="moz-txt-link-abbreviated" href="mailto:lvroyce@linux.vnet.ibm.com">lvroyce@linux.vnet.ibm.com</a> wrote:<br>
</div>
<blockquote
cite="mid:1428848036-30492-1-git-send-email-lvroyce@linux.vnet.ibm.com"
type="cite">
<pre wrap="">From: Royce Lv <a class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com"><lvroyce@linux.vnet.ibm.com></a>
Royce Lv (6):
Storagepool on existent VG: Update document
Add helper function to retrieve vg information
Update controller
Update model for existent VG
Update mockmodel tests
Fix fh leak in run_command subprocess
docs/API.md | 20 ++++++++++++++++
src/kimchi/control/host.py | 6 +++++
src/kimchi/i18n.py | 2 ++
src/kimchi/mockmodel.py | 9 ++++++++
src/kimchi/model/libvirtstoragepool.py | 11 +++++----
src/kimchi/model/storagepools.py | 28 +++++++++++++----------
src/kimchi/model/vgs.py | 42 ++++++++++++++++++++++++++++++++++
src/kimchi/utils.py | 22 ++++++++++++++++--
tests/test_mock_storagepool.py | 9 +++++++-
9 files changed, 130 insertions(+), 19 deletions(-)
create mode 100644 src/kimchi/model/vgs.py
</pre>
</blockquote>
<br>
</body>
</html>