From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
This patch changes test_test.py by:
- adds a new test called 'test_edit_vm_cpuhotplug' to test the
CPU Hotplug feature;
- removes the CPU hotplug test from 'test_edit_vm'. This test
was meant to fail because CPU hotplug wasn't possible until now.
Signed-off-by: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
---
tests/test_rest.py | 33 ++++++++++++++++++++++++++++-----
1 file changed, 28 insertions(+), 5 deletions(-)
diff --git a/tests/test_rest.py b/tests/test_rest.py
index f6b81a6..f25a693 100644
--- a/tests/test_rest.py
+++ b/tests/test_rest.py
@@ -123,6 +123,34 @@ class RestTests(unittest.TestCase):
self.assertEquals([], vm['users'])
self.assertEquals([], vm['groups'])
+ def test_edit_vm_cpuhotplug(self):
+ req = json.dumps({'name': 'template_cpuhotplug',
+ 'source_media': {'type': 'disk',
'path': fake_iso}})
+ resp = self.request('/plugins/kimchi/templates', req, 'POST')
+ self.assertEquals(201, resp.status)
+
+ req = json.dumps(
+ {'name': 'vm-cpuhotplug',
+ 'template':
'/plugins/kimchi/templates/template_cpuhotplug'}
+ )
+ resp = self.request('/plugins/kimchi/vms', req, 'POST')
+ self.assertEquals(202, resp.status)
+ task = json.loads(resp.read())
+ wait_task(self._task_lookup, task['id'])
+
+ req = json.dumps({'cpu_info': {'maxvcpus': 5, 'vcpus':
1}})
+ resp = self.request('/plugins/kimchi/vms/vm-cpuhotplug',
+ req, 'PUT')
+ self.assertEquals(200, resp.status)
+
+ resp = self.request('/plugins/kimchi/vms/vm-cpuhotplug/start',
+ '{}', 'POST')
+ self.assertEquals(200, resp.status)
+
+ req = json.dumps({'cpu_info': {'vcpus': 5}})
+ resp = self.request('/plugins/kimchi/vms/vm-cpuhotplug', req,
'PUT')
+ self.assertEquals(200, resp.status)
+
def test_edit_vm(self):
req = json.dumps({'name': 'test',
'source_media': {'type': 'disk',
'path': fake_iso}})
@@ -168,11 +196,6 @@ class RestTests(unittest.TestCase):
resp = self.request('/plugins/kimchi/vms/vm-1', req, 'PUT')
self.assertEquals(400, resp.status)
- # Unable to do CPU hotplug
- req = json.dumps({'cpu_info': {'vcpus': 5}})
- resp = self.request('/plugins/kimchi/vms/vm-1', req, 'PUT')
- self.assertEquals(400, resp.status)
-
# Check if there is support to memory hotplug, once vm is running
resp = self.request('/plugins/kimchi/config/capabilities').read()
conf = json.loads(resp)
--
2.7.4