public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Amos Kong <akong@redhat.com>
To: autotest@test.kernel.org
Cc: kvm@vger.kernel.org
Subject: [PATCH] KVM-test: Support qxl and vga parameters in make_qemu_command.
Date: Thu, 03 Mar 2011 07:28:45 +0800	[thread overview]
Message-ID: <20110302232845.9158.89833.stgit@t115> (raw)

The behave is difference on RHEL6.0 and RHEL5.
On RHEL5, qxl and vag are two parameters. But on RHEL6, qxl
is one option in vga.
This patch could work on RHEL5 and RHEL6 hosts.
On RHEL6, if we set qxl and vga together in tests_base.cfg,
vga will be set to qxl, no matter what you set to vga.

Signed-off-by: Feng Yang <fyang@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
---
 client/tests/kvm/kvm_vm.py             |   38 ++++++++++++++++++++++++++++++++
 client/tests/kvm/tests_base.cfg.sample |    4 +++
 2 files changed, 42 insertions(+), 0 deletions(-)

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

                 reply	other threads:[~2011-03-02 23:28 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110302232845.9158.89833.stgit@t115 \
    --to=akong@redhat.com \
    --cc=autotest@test.kernel.org \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox