[Kimchi-devel] [PATCH 4/4 v3] [Memory HotPlug] Fix test and adds slot test

Aline Manera alinefm at linux.vnet.ibm.com
Fri Jun 5 13:11:51 UTC 2015


Please, add a test for memory hot plug.

For example, create a simple vm, start it and increase its memory in 1GB 
and check the result to confirm the memory was properly added.

On 04/06/2015 16:38, Rodrigo Trujillo wrote:
> This patch fixed the issues caused by previous changes in the guest xml,
> like use of NUMA and MAXMEMORY elements.
> It includes a slot number checking test as well.
>
> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
> ---
>   tests/test_model.py      | 2 +-
>   tests/test_rest.py       | 4 ++--
>   tests/test_vmtemplate.py | 5 ++++-
>   3 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/tests/test_model.py b/tests/test_model.py
> index 88c020e..7b6153a 100644
> --- a/tests/test_model.py
> +++ b/tests/test_model.py
> @@ -600,7 +600,7 @@ class ModelTests(unittest.TestCase):
>           inst = model.Model(None,
>                              objstore_loc=self.tmp_store)
>
> -        orig_params = {'name': 'test', 'memory': '1024', 'cpus': '1',
> +        orig_params = {'name': 'test', 'memory': 1024, 'cpus': 1,
>                          'cdrom': UBUNTU_ISO}
>           inst.templates_create(orig_params)
>
> diff --git a/tests/test_rest.py b/tests/test_rest.py
> index 914b602..64b3414 100644
> --- a/tests/test_rest.py
> +++ b/tests/test_rest.py
> @@ -201,7 +201,7 @@ class RestTests(unittest.TestCase):
>           resp = self.request('/vms/vm-1', req, 'PUT')
>           self.assertEquals(400, resp.status)
>
> -        params = {'name': u'∨м-црdαtеd', 'cpus': 5, 'memory': 4096}
> +        params = {'name': u'∨м-црdαtеd', 'cpus': 5, 'memory': 3072}
>           req = json.dumps(params)
>           resp = self.request('/vms/vm-1', req, 'PUT')
>           self.assertEquals(303, resp.status)
> @@ -1059,7 +1059,7 @@ class RestTests(unittest.TestCase):
>           keys = [u'libvirt_stream_protocols', u'qemu_stream', u'qemu_spice',
>                   u'screenshot', u'system_report_tool', u'update_tool',
>                   u'repo_mngt_tool', u'federation', u'kernel_vfio', u'auth',
> -                u'nm_running']
> +                u'nm_running', u'mem_hotplug_support']
>           self.assertEquals(sorted(keys), sorted(conf.keys()))
>
>       def test_peers(self):
> diff --git a/tests/test_vmtemplate.py b/tests/test_vmtemplate.py
> index b504fbc..7304220 100644
> --- a/tests/test_vmtemplate.py
> +++ b/tests/test_vmtemplate.py
> @@ -83,7 +83,8 @@ class VMTemplateTests(unittest.TestCase):
>       def test_to_xml(self):
>           graphics = {'type': 'spice', 'listen': '127.0.0.1'}
>           vm_uuid = str(uuid.uuid4()).replace('-', '')
> -        t = VMTemplate({'name': 'test-template', 'cdrom': self.iso})
> +        t = VMTemplate({'name': 'test-template', 'cdrom': self.iso,
> +                       'max_memory': 3072 << 10})
>           xml = t.to_vm_xml('test-vm', vm_uuid, graphics=graphics)
>           self.assertEquals(vm_uuid, xpath_get_text(xml, "/domain/uuid")[0])
>           self.assertEquals('test-vm', xpath_get_text(xml, "/domain/name")[0])
> @@ -91,6 +92,8 @@ class VMTemplateTests(unittest.TestCase):
>           self.assertEquals(graphics['type'], xpath_get_text(xml, expr)[0])
>           expr = "/domain/devices/graphics/@listen"
>           self.assertEquals(graphics['listen'], xpath_get_text(xml, expr)[0])
> +        expr = "/domain/maxMemory/@slots"
> +        self.assertEquals('2', xpath_get_text(xml, expr)[0])
>
>       def test_arg_merging(self):
>           """




More information about the Kimchi-devel mailing list