From patchwork Fri Apr 20 18:19:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 902112 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40SPdh6qWVz9s3F for ; Sat, 21 Apr 2018 04:34:16 +1000 (AEST) Received: from localhost ([::1]:50398 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9arP-0007KV-0a for incoming@patchwork.ozlabs.org; Fri, 20 Apr 2018 14:34:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f9ag5-0006R5-2D for qemu-devel@nongnu.org; Fri, 20 Apr 2018 14:22:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f9ag0-000395-3y for qemu-devel@nongnu.org; Fri, 20 Apr 2018 14:22:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46310) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f9afz-00036f-SB for qemu-devel@nongnu.org; Fri, 20 Apr 2018 14:22:28 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2A59628210; Fri, 20 Apr 2018 18:22:27 +0000 (UTC) Received: from localhost (ovpn-116-52.gru2.redhat.com [10.97.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 419A85D9CD; Fri, 20 Apr 2018 18:22:15 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Fri, 20 Apr 2018 15:19:40 -0300 Message-Id: <20180420181951.7252-14-ehabkost@redhat.com> In-Reply-To: <20180420181951.7252-1-ehabkost@redhat.com> References: <20180420181951.7252-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 20 Apr 2018 18:22:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC 13/24] avocado_qemu: Functional test for RHBZ#1431939 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?b?THVrw6HFoSBEb2t0b3I=?= , Fam Zheng , Stefan Hajnoczi , Amador Pahim , Cleber Rosa , Alistair Francis Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Amador Pahim This issue was fixed in commit d81d857. According to the RHBZ1431939, the issue is 'host nodes' returning '128'. It should return empty value when using default policy or 0 when using bind policy. Test consists in inspect the result of the 'info memdev' QMP command after hot-adding memory. Signed-off-by: Amador Pahim Signed-off-by: Eduardo Habkost --- tests/avocado/test_info_memdev_host_nodes.py | 66 ++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 tests/avocado/test_info_memdev_host_nodes.py diff --git a/tests/avocado/test_info_memdev_host_nodes.py b/tests/avocado/test_info_memdev_host_nodes.py new file mode 100644 index 0000000000..69891b723d --- /dev/null +++ b/tests/avocado/test_info_memdev_host_nodes.py @@ -0,0 +1,66 @@ +from avocado import main +from avocado_qemu import test + + +class TestInfoMemdev(test.QemuTest): + """ + + :avocado: enable + :avocado: tags=qmp,object_add,device_add,memdev + """ + + def setUp(self): + self.vm.args.extend(['-m', '4G,slots=32,maxmem=40G']) + self.vm.launch() + + def test_hotplug_memory_default_policy(self): + """ + According to the RHBZ1431939, the issue is 'host nodes' + returning '128'. It should return empty value when memory + hotplug default policy is used. + + Fixed in commit d81d857f4421d205395d55200425daa6591c28a5. + :avocado: tags=RHBZ1431939 + """ + + cmd = 'object_add memory-backend-ram,id=mem1,size=1G' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertEqual('', res['return']) + + cmd = 'device_add pc-dimm,id=dimm1,memdev=mem1' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertEqual('', res['return']) + + cmd = 'info memdev' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertIn('policy: default\r', res['return']) + self.assertIn('host nodes: \r', res['return']) + + def test_hotplug_memory_bind_policy(self): + """ + According to the RHBZ1431939, the issue is 'host nodes' + returning '128'. It should return 0 when memory hotplug + bind policy is used. + + Fixed in commit d81d857f4421d205395d55200425daa6591c28a5. + :avocado: tags=RHBZ1431939 + """ + + cmd = 'object_add memory-backend-ram,id=mem1,host-nodes=0,size=2G,policy=bind' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertEqual('', res['return']) + + cmd = 'device_add pc-dimm,id=dimm1,memdev=mem1' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertEqual('', res['return']) + + cmd = 'info memdev' + res = self.vm.qmp('human-monitor-command', command_line=cmd) + self.assertIn('policy: bind\r', res['return']) + self.assertIn('host nodes: 0\r', res['return']) + + def tearDown(self): + self.vm.shutdown() + +if __name__ == "__main__": + avocado.main()