[Kimchi-devel] [PATCH] [Kimchi 4/4] Add tests to verify if cache and io of a disk can be changed

Ramon Medeiros posted 4 patches 7 years, 3 months ago
There is a newer version of this series
[Kimchi-devel] [PATCH] [Kimchi 4/4] Add tests to verify if cache and io of a disk can be changed
Posted by Ramon Medeiros 7 years, 3 months ago
Signed-off-by: Ramon Medeiros <ramonn@linux.vnet.ibm.com>
---
 tests/test_rest.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tests/test_rest.py b/tests/test_rest.py
index 852e4bd..a9f92fe 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -330,6 +330,34 @@ class RestTests(unittest.TestCase):
         resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd', req, 'PUT')
         self.assertEquals(400, resp.status)
 
+        # add volume as scsi
+        mock_base = '/tmp/mock.img'
+        os.system("qemu-img create -f qcow2 %s 100M" % mock_base)
+        req = json.dumps({'type': 'disk',
+                          'path': mock_base,
+                          'bus': 'scsi'})
+        resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd/storages',
+                            req, 'POST')
+        self.assertEquals(201, resp.status)
+        resp = json.loads(resp.read())
+        self.assertEquals("scsi", resp["bus"])
+        dev = resp["dev"]
+
+        # change io/cache
+        req = json.dumps({"io": "threads", "cache": "unsafe"})
+        resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd/storages/' +
+                            str(dev), req, 'PUT')
+        self.assertEquals(200, resp.status)
+        resp = json.loads(resp.read())
+        self.assertEquals('threads', resp['io'])
+        self.assertEquals('unsafe', resp['cache'])
+
+        # remove disk
+        resp = self.request('/plugins/kimchi/vms/∨м-црdαtеd/storages/' +
+                            str(dev), req, 'DELETE')
+        os.system("rm -rf " + mock_base)
+        self.assertEquals(204, resp.status)
+
     def test_vm_lifecycle(self):
         # Create a Template
         req = json.dumps({'name': 'test',
-- 
2.9.3

_______________________________________________
Kimchi-devel mailing list
Kimchi-devel@ovirt.org
http://lists.ovirt.org/mailman/listinfo/kimchi-devel