Reviewed-by: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
Yes, VMsModel need singleton.
We can not avoid cross refer between model classes.
this patch instantiates 3 model class. VMsModel, StoragePoolModel,
VMStorageModel.
Only VMsModel need singleton for background.
Check the code:
if one model class want to make use the attribute of another model class.
This attribute is usually set as static method.
But some attribute maybe can not be set as static method easily.
For most of them will try to access libvirt by a self.conn and self.objstore
Actually, we can call self.vms_get_list() instead of
VMsModel(**args).get_list().
But call VMsModel explicitly is more better.
We can consider a more better framework for model refator later.
On 03/06/2014 04:01 AM, Aline Manera wrote:
Reviewed-by: Aline Manera <alinefm(a)linux.vnet.ibm.com>
It depends on [PATCHv2 0/2] Make vms model singleton
On 03/05/2014 05:46 AM, lvroyce(a)linux.vnet.ibm.com wrote:
> From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
>
> Tested:
> 1. sudo make check
> 2. from UI: list storage volumes and unrefered volume ref_cnt is 0,
> ref_cnt for refered ones are 1.
>
> Available volumes will be tracked by volume reference count.
> Add this field to storage volume,
> so that storage volume/pool action validation can rely on it.
>
> Royce Lv (6):
> Fix vm disk path when it does not have source element
> Add volume ref_cnt: update api.md
> Add volume ref_cnt: Update controller and json schema
> Add volume ref_cnt: Add model and mockmodel implementation
> Add volume ref_cnt: Update test
> Multiple pep8 fixes
>
> docs/API.md | 3 +++
> src/kimchi/API.json | 25 +++++++++++++++++++++++++
> src/kimchi/control/storagevolumes.py | 1 +
> src/kimchi/i18n.py | 4 ++++
> src/kimchi/mockmodel.py | 10 +++++++---
> src/kimchi/model/debugreports.py | 2 +-
> src/kimchi/model/storagevolumes.py | 30 ++++++++++++++++++++++++++++++
> src/kimchi/model/templates.py | 2 +-
> src/kimchi/model/vmstorages.py | 23 +++++++++++++----------
> tests/test_model.py | 4 ++++
> tests/test_rest.py | 2 ++
> 11 files changed, 91 insertions(+), 15 deletions(-)
>
_______________________________________________
Kimchi-devel mailing list
Kimchi-devel(a)ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel
--
Thanks and best regards!
Sheldon Feng(冯少合)<shaohef(a)linux.vnet.ibm.com>
IBM Linux Technology Center