[Kimchi-devel] [PATCH] [Kimchi 3/3] Add tests to verify if cache and io of a disk can be changed
Ramon Medeiros
ramonn at linux.vnet.ibm.com
Wed Mar 8 17:19:51 UTC 2017
Signed-off-by: Ramon Medeiros <ramonn at 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
More information about the Kimchi-devel
mailing list