[Kimchi-devel] [PATCH 2/5] Delete http_port from /config API as it is not in use anymore

Aline Manera alinefm at linux.vnet.ibm.com
Tue Aug 26 13:24:20 UTC 2014


On 08/26/2014 03:50 AM, Royce Lv wrote:
> On 2014年08月21日 05:15, Aline Manera wrote:
>> http_port information was used to display the guest console
>> But since we have changed how to redirect user to guest console by 
>> adding
>> the ui/pages/websockify/console.html it is not in use anymore.
>> So remove it.
>>
>> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
>> ---
>>   docs/API.md                | 1 -
>>   src/kimchi/mockmodel.py    | 5 ++---
>>   src/kimchi/model/config.py | 3 +--
>>   src/kimchi/server.py       | 1 -
>>   tests/test_rest.py         | 3 ++-
>>   5 files changed, 5 insertions(+), 8 deletions(-)
>>
>> diff --git a/docs/API.md b/docs/API.md
>> index d75c55f..32f56ff 100644
>> --- a/docs/API.md
>> +++ b/docs/API.md
>> @@ -594,7 +594,6 @@ Contains information about the application 
>> environment and configuration.
>>   **Methods:**
>>
>>   * **GET**: Retrieve configuration information
>> -    * http_port: The port number on which the server is listening
> I think http_port is the one nginx serves outside request, and user 
> use this port to connect kimchi server.
> We may use cmd options to change this port, so maybe we want to retain 
> this port?

The nginx port must be known prior to access the API to access Kimchi 
server. So exposing it on API does not make sense for me.
The only reason would be to UI gets it for some use but it is not the case.


>>       * display_proxy_port: Port for vnc and spice's websocket proxy 
>> to listen on
>>       * version: The version of the kimchi service
>>   * **POST**: *See Configuration Actions*
>> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
>> index fc474de..57a58d7 100644
>> --- a/src/kimchi/mockmodel.py
>> +++ b/src/kimchi/mockmodel.py
>> @@ -918,9 +918,8 @@ class MockModel(object):
>>           return disks.get_partition_details(name)
>>
>>       def config_lookup(self, name):
>> -        return {'http_port': cherrypy.config.nginx_port,
>> -                'display_proxy_port':
>> -                kconfig.get('display', 'display_proxy_port'),
>> +        return {'display_proxy_port': kconfig.get('display',
>> + 'display_proxy_port'),
>>                   'version': config.get_version()}
>>
>>       def packagesupdate_get_list(self):
>> diff --git a/src/kimchi/model/config.py b/src/kimchi/model/config.py
>> index 0466f6f..90bb923 100644
>> --- a/src/kimchi/model/config.py
>> +++ b/src/kimchi/model/config.py
>> @@ -40,8 +40,7 @@ class ConfigModel(object):
>>
>>       def lookup(self, name):
>>           proxy_port = kconfig.get('display', 'display_proxy_port')
>> -        return {'http_port': cherrypy.config.nginx_port,
>> -                'display_proxy_port': proxy_port,
>> +        return {'display_proxy_port': proxy_port,
>>                   'version': get_version()}
>>
>>
>> diff --git a/src/kimchi/server.py b/src/kimchi/server.py
>> index bca2147..10f5dff 100644
>> --- a/src/kimchi/server.py
>> +++ b/src/kimchi/server.py
>> @@ -87,7 +87,6 @@ class Server(object):
>>           # directly. You must go through the proxy.
>>           cherrypy.server.socket_host = '127.0.0.1'
>>           cherrypy.server.socket_port = options.cherrypy_port
>> -        cherrypy.config.nginx_port = options.port
>>
>>           cherrypy.log.screen = True
>>           cherrypy.log.access_file = options.access_log
>> diff --git a/tests/test_rest.py b/tests/test_rest.py
>> index 2117399..9066857 100644
>> --- a/tests/test_rest.py
>> +++ b/tests/test_rest.py
>> @@ -1525,7 +1525,8 @@ class RestTests(unittest.TestCase):
>>       def test_config(self):
>>           resp = self.request('/config').read()
>>           conf = json.loads(resp)
>> -        self.assertEquals(port, conf['http_port'])
>> +        keys = ["display_proxy_port", "version"]
>> +        self.assertEquals(keys, sorted(conf.keys()))
>>
>>       def test_capabilities(self):
>>           resp = self.request('/config/capabilities').read()
>




More information about the Kimchi-devel mailing list