diff mbox

[KVM-AUTOTEST] kvm_vm.py: add new VM parameter 'x11_display' that controls $DISPLAY

Message ID e581284215a95ca22c45b17a39d891809399cbf5.1243179847.git.mgoldish@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michael Goldish May 24, 2009, 3:46 p.m. UTC
If x11_display is specified, the DISPLAY environment variable is set to this
value for the QEMU process. This may be useful for SDL rendering.

Also add some comments.

Signed-off-by: Michael Goldish <mgoldish@redhat.com>
---
 client/tests/kvm_runtest_2/kvm_vm.py |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

Comments

Lucas Meneghel Rodrigues May 28, 2009, 1:26 p.m. UTC | #1
On Sun, 2009-05-24 at 18:46 +0300, Michael Goldish wrote:
> If x11_display is specified, the DISPLAY environment variable is set to this
> value for the QEMU process. This may be useful for SDL rendering.

Looks good to me!

> Also add some comments.
> 
> Signed-off-by: Michael Goldish <mgoldish@redhat.com>
> ---
>  client/tests/kvm_runtest_2/kvm_vm.py |   12 +++++++++++-
>  1 files changed, 11 insertions(+), 1 deletions(-)
> 
> diff --git a/client/tests/kvm_runtest_2/kvm_vm.py b/client/tests/kvm_runtest_2/kvm_vm.py
> index 9571a3b..7a4ce4a 100644
> --- a/client/tests/kvm_runtest_2/kvm_vm.py
> +++ b/client/tests/kvm_runtest_2/kvm_vm.py
> @@ -173,6 +173,8 @@ class VM:
>                  (iso_dir is pre-pended to the ISO filename)
>              extra_params -- a string to append to the qemu command
>              ssh_port -- should be 22 for SSH, 23 for Telnet
> +            x11_display -- if specified, the DISPLAY environment variable will be be set
> +                to this value for the qemu process (useful for SDL rendering)
>              images -- a list of image object names, separated by spaces
>              nics -- a list of NIC object names, separated by spaces
>  
> @@ -198,8 +200,16 @@ class VM:
>          if iso_dir == None:
>              iso_dir = self.iso_dir
>  
> -        qemu_cmd = qemu_path
> +        # Start constructing the qemu command
> +        qemu_cmd = ""
> +        # Set the X11 display parameter if requested
> +        if params.get("x11_display"):
> +            qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
> +        # Add the qemu binary
> +        qemu_cmd += qemu_path
> +        # Add the VM's name
>          qemu_cmd += " -name '%s'" % name
> +        # Add the monitor socket parameter
>          qemu_cmd += " -monitor unix:%s,server,nowait" % self.monitor_file_name
>  
>          for image_name in kvm_utils.get_sub_dict_names(params, "images"):
diff mbox

Patch

diff --git a/client/tests/kvm_runtest_2/kvm_vm.py b/client/tests/kvm_runtest_2/kvm_vm.py
index 9571a3b..7a4ce4a 100644
--- a/client/tests/kvm_runtest_2/kvm_vm.py
+++ b/client/tests/kvm_runtest_2/kvm_vm.py
@@ -173,6 +173,8 @@  class VM:
                 (iso_dir is pre-pended to the ISO filename)
             extra_params -- a string to append to the qemu command
             ssh_port -- should be 22 for SSH, 23 for Telnet
+            x11_display -- if specified, the DISPLAY environment variable will be be set
+                to this value for the qemu process (useful for SDL rendering)
             images -- a list of image object names, separated by spaces
             nics -- a list of NIC object names, separated by spaces
 
@@ -198,8 +200,16 @@  class VM:
         if iso_dir == None:
             iso_dir = self.iso_dir
 
-        qemu_cmd = qemu_path
+        # Start constructing the qemu command
+        qemu_cmd = ""
+        # Set the X11 display parameter if requested
+        if params.get("x11_display"):
+            qemu_cmd += "DISPLAY=%s " % params.get("x11_display")
+        # Add the qemu binary
+        qemu_cmd += qemu_path
+        # Add the VM's name
         qemu_cmd += " -name '%s'" % name
+        # Add the monitor socket parameter
         qemu_cmd += " -monitor unix:%s,server,nowait" % self.monitor_file_name
 
         for image_name in kvm_utils.get_sub_dict_names(params, "images"):