From patchwork Wed Mar 2 23:28:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amos Kong X-Patchwork-Id: 604421 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p22NKF02029315 for ; Wed, 2 Mar 2011 23:20:15 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754507Ab1CBXUK (ORCPT ); Wed, 2 Mar 2011 18:20:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:24303 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753827Ab1CBXUJ (ORCPT ); Wed, 2 Mar 2011 18:20:09 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p22NK8vj025086 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 2 Mar 2011 18:20:08 -0500 Received: from [10.66.91.115] (dhcp-91-115.nay.redhat.com [10.66.91.115]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p22NK6WT023463; Wed, 2 Mar 2011 18:20:07 -0500 Subject: [PATCH] KVM-test: Support qxl and vga parameters in make_qemu_command. To: autotest@test.kernel.org From: Amos Kong Cc: kvm@vger.kernel.org Date: Thu, 03 Mar 2011 07:28:45 +0800 Message-ID: <20110302232845.9158.89833.stgit@t115> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 02 Mar 2011 23:20:15 +0000 (UTC) diff --git a/client/tests/kvm/kvm_vm.py b/client/tests/kvm/kvm_vm.py index 41f7491..da3142f 100755 --- a/client/tests/kvm/kvm_vm.py +++ b/client/tests/kvm/kvm_vm.py @@ -335,6 +335,7 @@ class VM: if not glob.glob("/tmp/*%s" % self.instance): break + self.spice_port = 8000 self.name = name self.params = params self.root_dir = root_dir @@ -553,6 +554,26 @@ class VM: def add_pcidevice(help, host): return " -pcidevice host='%s'" % host + def add_spice(help, port, param): + if has_option(help,"spice"): + return " -spice port=%s,%s" % (port, param) + else: + return "" + + def add_qxl_vga(help, qxl, vga, qxl_dev_nr=None): + str = "" + if has_option(help, "qxl"): + if qxl and qxl_dev_nr is not None: + str += " -qxl %s" % qxl_dev_nr + if has_option(help, "vga") and vga and vga != "qxl": + str += " -vga %s" % vga + elif has_option(help, "vga"): + if qxl: + str += " -vga qxl" + elif vga: + str += " -vga %s" % vga + return str + def add_kernel(help, filename): return " -kernel '%s'" % filename @@ -720,6 +741,19 @@ class VM: qemu_cmd += add_sdl(help) elif params.get("display") == "nographic": qemu_cmd += add_nographic(help) + elif params.get("display") == "spice": + qemu_cmd += add_spice(help, self.spice_port, params.get("spice")) + + qxl = "" + vga = "" + if params.get("qxl"): + qxl = params.get("qxl") + if params.get("vga"): + vga = params.get("vga") + if qxl or vga: + if params.get("display") == "spice": + qxl_dev_nr = params.get("qxl_dev_nr", None) + qemu_cmd += add_qxl_vga(help, qxl, vga, qxl_dev_nr) if params.get("uuid") == "random": qemu_cmd += add_uuid(help, vm.uuid) @@ -845,6 +879,10 @@ class VM: if params.get("display") == "vnc": self.vnc_port = kvm_utils.find_free_port(5900, 6100) + # Find available spice port + if params.get("spice"): + self.spice_port = kvm_utils.find_free_port(8000, 8100) + # Find random UUID if specified 'uuid = random' in config file if params.get("uuid") == "random": f = open("/proc/sys/kernel/random/uuid") diff --git a/client/tests/kvm/tests_base.cfg.sample b/client/tests/kvm/tests_base.cfg.sample index fa64265..b6a4d88 100644 --- a/client/tests/kvm/tests_base.cfg.sample +++ b/client/tests/kvm/tests_base.cfg.sample @@ -40,6 +40,10 @@ shell_port = 22 display = vnc drive_index_cd1 = 1 +qxl = on +qxl_dev_nr = 1 +spice = disable-ticketing + # Monitor params monitor_type = human