<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 2013&#24180;12&#26376;31&#26085; 03:49, Aline Manera
      wrote:<br>
    </div>
    <blockquote cite="mid:52C1CE4B.2090202@linux.vnet.ibm.com"
      type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 12/30/2013 12:17 AM, <a
          moz-do-not-send="true" class="moz-txt-link-abbreviated"
          href="mailto:lvroyce@linux.vnet.ibm.com">lvroyce@linux.vnet.ibm.com</a>
        wrote:<br>
      </div>
      <blockquote
        cite="mid:1388369850-16603-1-git-send-email-lvroyce@linux.vnet.ibm.com"
        type="cite">
        <pre wrap="">From: Royce Lv <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:lvroyce@linux.vnet.ibm.com">&lt;lvroyce@linux.vnet.ibm.com&gt;</a>

v3&gt;v4, fix inconsistency between doc and json schema
v1&gt;v3, fix racing problem, fix style.

Add parameters to GET request so that we will query storage server as:
    /storageservers?type=netfs

Royce Lv (5):
  Support params for GET method
  Add testcase for GET param
  Storage server: Update API.md
  storage server: update controller.py
  storage server: Update model and mockmodel

 docs/API.md              | 13 +++++++++++++
 src/kimchi/API.json      | 11 +++++++++++
 src/kimchi/controller.py | 26 ++++++++++++++++++++++++--
 src/kimchi/mockmodel.py  | 13 +++++++++++++
 src/kimchi/model.py      | 14 +++++++++++++-
 src/kimchi/root.py       |  1 +
 tests/test_rest.py       | 37 +++++++++++++++++++++++++++++++++++++
 7 files changed, 112 insertions(+), 3 deletions(-)

</pre>
      </blockquote>
      <br>
      <font face="DejaVu Sans Mono">Let me explain what I expect with
        this patch set:<br>
        <br>
        GET /storageservers will return all storage servers<br>
        Example:<br>
        <br>
        [<br>
        {'host': 'localhost',<br>
        &nbsp;'target_type': 'netfs',<br>
        &nbsp;'sources': ['/srv', '/mnt/isos'],<br>
        }</font><br>
      <font face="DejaVu Sans Mono"><font face="DejaVu Sans Mono">{'host':

          '123.234.123.12',<br>
          &nbsp;'target_type': 'iscsi',<br>
          &nbsp;'sources': ['</font></font>iqn.2013-06.com.example:iscsi-pool<font
        face="DejaVu Sans Mono"><font face="DejaVu Sans Mono">'],<br>
          }<br>
        </font>]<br>
      </font></blockquote>
    <font face="DejaVu Sans Mono">Aline, as posted inn my RFC patch:
      [project-kimchi][RFC]Storage backend targets probe<br>
      I explained, this is to give users a ref when he wants to fill the
      "host" blank of storagepool creation.<br>
      <br>
      GET /storageservers only returns *servers* we uses as source as
      storagepool, *targets* will not be covered here.<br>
      We can return non query parameter results here, but I haven't
      figured out a usecase for this one.<br>
      Normally we only create storagepool of a given kind.<br>
    </font>
    <blockquote cite="mid:52C1CE4B.2090202@linux.vnet.ibm.com"
      type="cite"><font face="DejaVu Sans Mono"> <br>
        <br>
        GET /storageservers?target_type=&lt;server-type&gt; will return
        only the storage servers with type &lt;server-type&gt;<br>
      </font>Example: GET <font face="DejaVu Sans Mono">/storageservers?target_type=netfs</font><br>
      <font face="DejaVu Sans Mono"><font face="DejaVu Sans Mono"><br>
          [<br>
          {'host': 'localhost',<br>
          &nbsp;'target_type': 'netfs',<br>
          &nbsp;'sources': ['/srv', '/mnt/isos'],<br>
          }<br>
          ]<br>
          <br>
        </font>GET /storageservers/&lt;id&gt; will return data related
        to this specific server<br>
      </font>Example: GET <font face="DejaVu Sans Mono">/storageservers/localhost<br>
        <br>
      </font><font face="DejaVu Sans Mono">{'host': 'localhost',<br>
        &nbsp;'target_type': 'netfs',<br>
        &nbsp;'sources': ['/srv', '/mnt/isos'],<br>
        }<br>
        <br>
      </font></blockquote>
    <font face="DejaVu Sans Mono">Because a host can serve as multiple
      server(iscsi, gluster, nfs) at same time. So I choose to make user
      query a specific kind by:<br>
      &nbsp;&nbsp;&nbsp; GET /storageservers/localhost?target_type=netfs<br>
      or<br>
      &nbsp;&nbsp;&nbsp; GET /storageservers/localhost?target_type=iscsi<br>
      like this.</font><br>
    <font face="DejaVu Sans Mono"><font face="DejaVu Sans Mono"><br>
      </font></font>
    <font face="DejaVu Sans Mono">This functionality is covered by
      [project-kimchi][PATCHv1 0/3] Storage targets support patchset.<br>
      <br>
    </font>
    <blockquote cite="mid:52C1CE4B.2090202@linux.vnet.ibm.com"
      type="cite"><font face="DejaVu Sans Mono"> The 'sources' for
        netfs, for example, will be the parsed output from "showmount -e
        &lt;host&gt;" command.<br>
        <br>
        So when the user want to create NFS pool with a new server
        (never used before)<br>
        <br>
        POST /storageservers/new-nfs-server<br>
      </font><br>
      <font face="DejaVu Sans Mono"><font face="DejaVu Sans Mono">{'host':

          '</font></font><font face="DejaVu Sans Mono"><font
          face="DejaVu Sans Mono"><font face="DejaVu Sans Mono">new-nfs-server</font>',<br>
          &nbsp;'target_type': 'netfs',<br>
          &nbsp;'sources': ['/srv', '/mnt'],<br>
          }<br>
          <br>
          Then the user know which paths are available to create the NFS
          pool<br>
        </font></font></blockquote>
    <font face="DejaVu Sans Mono">I don't quite agree... 'POST' to
      storage server means you want to create a storage server.<br>
      <br>
      When he wants to create a new NFS pool:<br>
      <br>
      1. If he knows his server, he fills it, if not he take a look at
      used NFS server by:<br>
      &nbsp;&nbsp;&nbsp; GET /storageservers?target_type=netfs<br>
      {'localhost', '9.1.1.2', 'a-nfs-server.com'}<br>
      &nbsp;&nbsp;&nbsp; Then he choose '9.1.1.2' as host<br>
      <br>
      2. Now he manually fills path or query the exposed path by:<br>
      &nbsp;&nbsp;&nbsp; GET /storageservers/9.1.1.2?target_type=netfs<br>
      {'type':'nfs',<br>
      &nbsp;'targets': ['/a-path', '/b-path'], <br>
      }<br>
      &nbsp;&nbsp;&nbsp; He decides to use 'a-path'<br>
      <br>
      3. Then it comes to real storagepool creation by sending request:<br>
      &nbsp;&nbsp;&nbsp; POST /storagepools<br>
      &nbsp;&nbsp;&nbsp; {'host': '9.1.1.2', 'path': '/a-path', 'name': 'a-pool'}<br>
    </font>
    <blockquote cite="mid:52C1CE4B.2090202@linux.vnet.ibm.com"
      type="cite"><font face="DejaVu Sans Mono"><font face="DejaVu Sans
          Mono"> <br>
          Does that make sense for you?</font></font><br>
    </blockquote>
    <font face="DejaVu Sans Mono">&nbsp;&nbsp;&nbsp; <br>
      <br>
    </font><br>
  </body>
</html>