[Kimchi-devel] [PATCH 00/16] Reorganize controller module

Aline Manera alinefm at linux.vnet.ibm.com
Thu Dec 26 18:40:09 UTC 2013


On 12/26/2013 04:55 AM, Shu Ming wrote:
> 2013/12/24 2:41, Aline Manera:
>> From: Aline Manera <alinefm at br.ibm.com>
>>
>> The current implemenation put all resources implementation into 
>> controller.py
>> file. That way this file tends to increase to infinity as more 
>> resources are
>> added to Kimchi.
>>
>> This patch splits controller module (controller.py) into small modules.
>> So each resource will have its own controller implementation under 
>> /control
>> It will make maintenance easier and anyone can easily identify where 
>> any resource
>> is implemented.
> I would argue that most the resources defined are pretty trival and 
> splitting these definitions into different files will add many small 
> files which cause unnecessary maintenance.  From  another point of 
> view,  the real logical is in model.py,  do you have plan to split the 
> model.py file?
>
>

Yeap! model/mockmodel will be the next step of re-factore backend task.

>>
>> This patch set does not change any logic - just move classes from 
>> controller
>> to a new module.
>>
>> Aline Manera (16):
>>    Move generate_action_handler() function to Resource() class
>>    Move common functions for Resource and Collection to control/utils.py
>>    Move login() and logout() functions from controller.py to root.py
>>    Move basic controller resources to control/base.py
>>    Move all resources related to vms to control/vms.py
>>    Move all resources related to templates to control/templates.py
>>    Move all resources related to debug reports to
>>      control/debugreports.py
>>    Move all resources related to storage pools to
>>      control/storagepools.py
>>    Move all resources related to storage volume to
>>      control/storagevolumes.py
>>    Move all resources related to interfaces to control/interfaces.py
>>    Move all resources related to networks to control/networks.py
>>    Move all resources related to config to control/config.py
>>    Move all resources related to host to control/host.py
>>    Move all resources related to plugins to control/plugins.py
>>    Move all resources related to tasks to control/tasks.py
>>    Use new control modules in root.py
>>
>>   Makefile.am                          |   13 +
>>   src/kimchi/control/__init__.py       |   21 +
>>   src/kimchi/control/base.py           |  290 +++++++++++++
>>   src/kimchi/control/config.py         |   65 +++
>>   src/kimchi/control/debugreports.py   |   52 +++
>>   src/kimchi/control/host.py           |   61 +++
>>   src/kimchi/control/interfaces.py     |   44 ++
>>   src/kimchi/control/networks.py       |   48 +++
>>   src/kimchi/control/plugins.py        |   44 ++
>>   src/kimchi/control/storagepools.py   |  125 ++++++
>>   src/kimchi/control/storagevolumes.py |   79 ++++
>>   src/kimchi/control/tasks.py          |   41 ++
>>   src/kimchi/control/templates.py      |   51 +++
>>   src/kimchi/control/utils.py          |  103 +++++
>>   src/kimchi/control/vms.py            |   64 +++
>>   src/kimchi/controller.py             |  755 
>> ----------------------------------
>>   src/kimchi/root.py                   |   61 ++-
>>   17 files changed, 1147 insertions(+), 770 deletions(-)
>>   create mode 100644 src/kimchi/control/__init__.py
>>   create mode 100644 src/kimchi/control/base.py
>>   create mode 100644 src/kimchi/control/config.py
>>   create mode 100644 src/kimchi/control/debugreports.py
>>   create mode 100644 src/kimchi/control/host.py
>>   create mode 100644 src/kimchi/control/interfaces.py
>>   create mode 100644 src/kimchi/control/networks.py
>>   create mode 100644 src/kimchi/control/plugins.py
>>   create mode 100644 src/kimchi/control/storagepools.py
>>   create mode 100644 src/kimchi/control/storagevolumes.py
>>   create mode 100644 src/kimchi/control/tasks.py
>>   create mode 100644 src/kimchi/control/templates.py
>>   create mode 100644 src/kimchi/control/utils.py
>>   create mode 100644 src/kimchi/control/vms.py
>>   delete mode 100644 src/kimchi/controller.py
>>
>




More information about the Kimchi-devel mailing list