From: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
Signed-off-by: Royce Lv <lvroyce(a)linux.vnet.ibm.com>
---
src/kimchi/mockmodel.py | 9 +++++++++
tests/test_mock_storagepool.py | 9 ++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index 413ac5d..faa517e 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -306,6 +306,15 @@ class MockModel(Model):
return self._model_storagevolume_lookup(pool, vol)
+ def _mock_vgs_get_list(self):
+ vgs = list()
+
+ for i in range(3):
+ vg = dict(path='/dev/vg%s' % i, name='vg%s' % i,
size='10G')
+ vgs.append(vg)
+
+ return vgs
+
def _mock_partitions_get_list(self):
return self._mock_partitions.partitions.keys()
diff --git a/tests/test_mock_storagepool.py b/tests/test_mock_storagepool.py
index 1dc9277..7b70d3e 100644
--- a/tests/test_mock_storagepool.py
+++ b/tests/test_mock_storagepool.py
@@ -71,6 +71,10 @@ class MockStoragepoolTests(unittest.TestCase):
fc_devs = json.loads(self.request('/host/devices?_cap=fc_host').read())
fc_devs = [dev['name'] for dev in fc_devs]
+ # MockModel always returns 3 vgs
+ vgs = json.loads(self.request('/host/vgs').read())
+ self.assertEquals(3, len(vgs))
+
poolDefs = [
{'type': 'dir', 'name':
u'kīмсhīUnitTestDirPool',
'path': '/tmp/kimchi-images'},
@@ -83,7 +87,10 @@ class MockStoragepoolTests(unittest.TestCase):
'source': {'host': '127.0.0.1',
'target':
'iqn.2015-01.localhost.kimchiUnitTest'}},
{'type': 'logical', 'name':
u'kīмсhīUnitTestLogicalPool',
- 'source': {'devices': [devs[0]]}}]
+ 'source': {'devices': [devs[0]]}},
+ {'type': 'logical', 'name': vgs[0]['name'],
+ 'path': vgs[0]['path']}
+ ]
def _do_test(params):
name = params['name']
--
2.1.0