[Kimchi-devel] [project-kimchi][PATCHv4 5/5] storage server: Update model and mockmodel
Aline Manera
alinefm at linux.vnet.ibm.com
Thu Jan 2 16:17:15 UTC 2014
On 01/02/2014 12:40 AM, Royce Lv wrote:
> On 2013年12月31日 03:35, Aline Manera wrote:
>> On 12/30/2013 12:17 AM, lvroyce at linux.vnet.ibm.com wrote:
>>> From: Royce Lv <lvroyce at linux.vnet.ibm.com>
>>>
>>> Query all storage pool to retrieve storage server we used.
>>>
>>> Signed-off-by: Royce Lv <lvroyce at linux.vnet.ibm.com>
>>> ---
>>> src/kimchi/mockmodel.py | 13 +++++++++++++
>>> src/kimchi/model.py | 14 +++++++++++++-
>>> 2 files changed, 26 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
>>> index 348127a..f53e799 100644
>>> --- a/src/kimchi/mockmodel.py
>>> +++ b/src/kimchi/mockmodel.py
>>> @@ -405,6 +405,19 @@ class MockModel(object):
>>> iso_volumes.append(res)
>>> return iso_volumes
>>
>>> + def storageservers_get_list(self, target_type):
>>> + pools = self.storagepools_get_list()
>>> + server_list = []
>>> + for pool in pools:
>>> + try:
>>> + pool_info = self.storagepool_lookup(pool)
>>> + if pool_info['type'] == target_type:
>>> + server_list.append(pool_info['source']['addr'])
>>> + except NotFoundError:
>>> + pass
>>> +
>>> + return server_list
>>
>> If any target_type is passed we should return all values
> By all value you mean iscsi servers and nfs servers and other possible
> remote servers, technically it is easy,
> temprorily I haven't had a usecase for this yet..
The query param should be optional. It is an additional feature.
If user would like to know all servers he can use he can use it.
>>
>>> +
>>> def dummy_interfaces(self):
>>> interfaces = {}
>>> ifaces = {"eth1": "nic", "bond0": "bonding",
>>> diff --git a/src/kimchi/model.py b/src/kimchi/model.py
>>> index 3bc5d6d..20f68f6 100644
>>> --- a/src/kimchi/model.py
>>> +++ b/src/kimchi/model.py
>>> @@ -1220,6 +1220,19 @@ class Model(object):
>>> else:
>>> raise
>>>
>>> + def storageservers_get_list(self, target_type):
>>> + pools = self.storagepools_get_list()
>>> + server_list = []
>>> + for pool in pools:
>>> + try:
>>> + pool_info = self.storagepool_lookup(pool)
>>> + if pool_info['type'] == target_type:
>>> + server_list.append(pool_info['source']['addr'])
>>> + except NotFoundError:
>>> + pass
>>> +
>>
>> Same as I commented for model.py
>>
>>> + return server_list
>>> +
>>> def _get_screenshot(self, vm_uuid):
>>> with self.objstore as session:
>>> try:
>>> @@ -1400,7 +1413,6 @@ class LibvirtVMTemplate(VMTemplate):
>>> pool.createXML(v['xml'].encode('utf-8'), 0)
>>> return vol_list
>>>
>>> -
>>> class LibvirtVMScreenshot(VMScreenshot):
>>> def __init__(self, vm_uuid, conn):
>>> VMScreenshot.__init__(self, vm_uuid)
>>
>
More information about the Kimchi-devel
mailing list