[Kimchi-devel] [PATCH 4/8] MockModel: Override storage pool validation

Aline Manera alinefm at linux.vnet.ibm.com
Thu Jan 22 13:32:54 UTC 2015


Model does some input validation to make sure a NFS and iSCSI pool will
work as expected. To skip that validation on MockModel and be able to
create any NFS and iSCSI pool (for testing proposals) the .prepare()
must be overridden.

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/kimchi/mockmodel.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/kimchi/mockmodel.py b/src/kimchi/mockmodel.py
index f8e317a..14891ee 100644
--- a/src/kimchi/mockmodel.py
+++ b/src/kimchi/mockmodel.py
@@ -32,6 +32,8 @@ from kimchi import imageinfo
 from kimchi import osinfo
 from kimchi.model.debugreports import DebugReportsModel
 from kimchi.model.host import DeviceModel
+from kimchi.model.libvirtstoragepool import IscsiPoolDef, NetfsPoolDef
+from kimchi.model.libvirtstoragepool import StoragePoolDef
 from kimchi.model.model import Model
 from kimchi.model.storagevolumes import StorageVolumesModel
 from kimchi.model.templates import LibvirtVMTemplate
@@ -78,6 +80,9 @@ class MockModel(Model):
         libvirt.virDomain.updateDeviceFlags = MockModel.updateDeviceFlags
         libvirt.virStorageVol.resize = MockModel.volResize
         libvirt.virStorageVol.wipePattern = MockModel.volWipePattern
+
+        IscsiPoolDef.prepare = NetfsPoolDef.prepare = StoragePoolDef.prepare
+
         PAMUsersModel.auth_type = 'fake'
         PAMGroupsModel.auth_type = 'fake'
 
-- 
2.1.0




More information about the Kimchi-devel mailing list