[Kimchi-devel] [PATCH] Add a disk to the VM when testing snapshot

Crístian Viana vianac at linux.vnet.ibm.com
Thu Jan 8 20:12:12 UTC 2015


The test case which tests snapshots creates a VM without any disk and
then creates a snapshot of it. However, newer versions of libvirt don't
allow snapshots to be taken of shutoff domains which don't contain any
disk - because there's nothing to take snapshot of.

Update the test case "ModelTests.test_vm_lifecycle" so the VM has one
disk and a snapshot of it can be created.

Signed-off-by: Crístian Viana <vianac at linux.vnet.ibm.com>
---
 tests/test_model.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tests/test_model.py b/tests/test_model.py
index eac5b05..f1ad017 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -102,7 +102,18 @@ class ModelTests(unittest.TestCase):
         inst = model.Model(objstore_loc=self.tmp_store)
 
         with RollbackContext() as rollback:
-            params = {'name': 'test', 'disks': [], 'cdrom': self.kimchi_iso}
+            vol_params = {'name': u'test-vol', 'capacity': 1024}
+            task = inst.storagevolumes_create(u'default', vol_params)
+            rollback.prependDefer(inst.storagevolume_delete, u'default',
+                                  vol_params['name'])
+            inst.task_wait(task['id'])
+            task = inst.task_lookup(task['id'])
+            self.assertEquals('finished', task['status'])
+            vol = inst.storagevolume_lookup(u'default', vol_params['name'])
+
+            params = {'name': 'test', 'disks': [{'base': vol['path'],
+                                                 'size': 1}],
+                      'cdrom': self.kimchi_iso}
             inst.templates_create(params)
             rollback.prependDefer(inst.template_delete, 'test')
 
-- 
2.1.0




More information about the Kimchi-devel mailing list